New kernel call, SYS_PARAMCTL, that sets parameters of the caller
and is therefore unprivileged. Used to set grant tables.
This commit is contained in:
@@ -35,6 +35,7 @@ OBJECTS = \
|
||||
$(SYSTEM)(do_vcopy.o) \
|
||||
$(SYSTEM)(do_umap.o) \
|
||||
$(SYSTEM)(do_memset.o) \
|
||||
$(SYSTEM)(do_paramctl.o) \
|
||||
$(SYSTEM)(do_privctl.o) \
|
||||
$(SYSTEM)(do_segctl.o) \
|
||||
$(SYSTEM)(do_safecopy.o) \
|
||||
@@ -137,6 +138,9 @@ $(SYSTEM)(do_getinfo.o): do_getinfo.c
|
||||
$(SYSTEM)(do_abort.o): do_abort.c
|
||||
$(CC) do_abort.c
|
||||
|
||||
$(SYSTEM)(do_paramctl.o): do_paramctl.c
|
||||
$(CC) do_paramctl.c
|
||||
|
||||
$(SYSTEM)(do_privctl.o): do_privctl.c
|
||||
$(CC) do_privctl.c
|
||||
|
||||
|
||||
45
kernel/system/do_paramctl.c
Normal file
45
kernel/system/do_paramctl.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/* The kernel call implemented in this file:
|
||||
* m_type: SYS_PARAMCTL
|
||||
*
|
||||
* The parameters for this kernel call are:
|
||||
* PCTL_REQ request code (SYS_PARAM_*)
|
||||
* PCTL_INT[12] integer parameters
|
||||
* PCTL_ADDR1 address parameter
|
||||
*/
|
||||
|
||||
#include "../system.h"
|
||||
#include <minix/safecopies.h>
|
||||
|
||||
/*===========================================================================*
|
||||
* do_paramctl *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_paramctl(m_ptr)
|
||||
message *m_ptr;
|
||||
{
|
||||
struct proc *rp;
|
||||
int r;
|
||||
|
||||
/* Who wants to set a parameter? */
|
||||
rp = proc_addr(who_p);
|
||||
|
||||
/* Which parameter is it? */
|
||||
switch(m_ptr->PCTL_REQ) {
|
||||
|
||||
case SYS_PARAM_SET_GRANT:
|
||||
/* Copy grant table set in priv. struct. */
|
||||
if ((rp->p_rts_flags & NO_PRIV) || !(priv(rp))) {
|
||||
r = EPERM;
|
||||
} else {
|
||||
_K_SET_GRANT_TABLE(rp,
|
||||
(vir_bytes) m_ptr->PCTL_ADDR1,
|
||||
m_ptr->PCTL_INT1);
|
||||
r = OK;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
r = EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -163,12 +163,6 @@ message *m_ptr; /* pointer to request message */
|
||||
priv(rp)->s_nr_irq++;
|
||||
|
||||
return OK;
|
||||
case SYS_PRIV_SET_GRANTS:
|
||||
if ((rp->p_rts_flags & NO_PRIV) || !(priv(rp))) return(EPERM);
|
||||
_K_SET_GRANT_TABLE(rp,
|
||||
(vir_bytes) m_ptr->CTL_ARG_PTR, m_ptr->CTL_MM_PRIV);
|
||||
return OK;
|
||||
|
||||
default:
|
||||
kprintf("do_privctl: bad request %d\n", m_ptr->CTL_REQUEST);
|
||||
return EINVAL;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* The kernel call implemented in this file:
|
||||
* m_type: SYS_SAFECOPYFROM or SYS_SAFECOPYTO
|
||||
* m_type: SYS_SAFECOPYFROM or SYS_SAFECOPYTO or SYS_VSAFECOPY
|
||||
*
|
||||
* The parameters for this kernel call are:
|
||||
* SCP_FROM_TO other endpoint
|
||||
|
||||
Reference in New Issue
Block a user