Message type for SYS_{S,G}ETMCONTEXT
Change-Id: I388eee89ba8cc6e6603b3193297b81179c1e6975
This commit is contained in:
parent
f06c676a47
commit
2027f8bc78
4 changed files with 38 additions and 14 deletions
|
@ -361,7 +361,6 @@
|
|||
#define PR_PS_STR_PTR m1_p4 /* pointer to ps_strings, expected by __start */
|
||||
#define PR_FORK_FLAGS m1_i3 /* optional flags for fork operation */
|
||||
#define PR_FORK_MSGADDR m1_p1 /* reply message address of forked child */
|
||||
#define PR_CTX_PTR m1_p1 /* pointer to mcontext_t structure */
|
||||
|
||||
/* Constants for exec. FIXME: these do not belong here. */
|
||||
#define PMEF_AUXVECTORS 20
|
||||
|
|
|
@ -731,6 +731,14 @@ typedef struct {
|
|||
} mess_lsys_krn_sys_getinfo;
|
||||
_ASSERT_MSG_SIZE(mess_lsys_krn_sys_getinfo);
|
||||
|
||||
typedef struct {
|
||||
endpoint_t endpt;
|
||||
vir_bytes ctx_ptr;
|
||||
|
||||
uint8_t padding[48];
|
||||
} mess_lsys_krn_sys_getmcontext;
|
||||
_ASSERT_MSG_SIZE(mess_lsys_krn_sys_getmcontext);
|
||||
|
||||
typedef struct {
|
||||
endpoint_t endpt;
|
||||
int privflags;
|
||||
|
@ -803,6 +811,14 @@ typedef struct {
|
|||
} mess_lsys_krn_sys_setgrant;
|
||||
_ASSERT_MSG_SIZE(mess_lsys_krn_sys_setgrant);
|
||||
|
||||
typedef struct {
|
||||
endpoint_t endpt;
|
||||
vir_bytes ctx_ptr;
|
||||
|
||||
uint8_t padding[48];
|
||||
} mess_lsys_krn_sys_setmcontext;
|
||||
_ASSERT_MSG_SIZE(mess_lsys_krn_sys_setmcontext);
|
||||
|
||||
typedef struct {
|
||||
int request;
|
||||
|
||||
|
@ -1651,6 +1667,7 @@ typedef struct {
|
|||
mess_lsys_krn_sys_abort m_lsys_krn_sys_abort;
|
||||
mess_lsys_krn_sys_copy m_lsys_krn_sys_copy;
|
||||
mess_lsys_krn_sys_getinfo m_lsys_krn_sys_getinfo;
|
||||
mess_lsys_krn_sys_getmcontext m_lsys_krn_sys_getmcontext;
|
||||
mess_lsys_krn_sys_iopenable m_lsys_krn_sys_iopenable;
|
||||
mess_lsys_krn_sys_irqctl m_lsys_krn_sys_irqctl;
|
||||
mess_lsys_krn_sys_memset m_lsys_krn_sys_memset;
|
||||
|
@ -1658,6 +1675,7 @@ typedef struct {
|
|||
mess_lsys_krn_sys_sdevio m_lsys_krn_sys_sdevio;
|
||||
mess_lsys_krn_sys_setalarm m_lsys_krn_sys_setalarm;
|
||||
mess_lsys_krn_sys_setgrant m_lsys_krn_sys_setgrant;
|
||||
mess_lsys_krn_sys_setmcontext m_lsys_krn_sys_setmcontext;
|
||||
mess_lsys_krn_sys_statectl m_lsys_krn_sys_statectl;
|
||||
mess_lsys_krn_sys_stime m_lsys_krn_sys_stime;
|
||||
mess_lsys_krn_sys_settime m_lsys_krn_sys_settime;
|
||||
|
|
|
@ -2,10 +2,13 @@
|
|||
* m_type: SYS_SETMCONTEXT
|
||||
* m_type: SYS_GETMCONTEXT
|
||||
*
|
||||
* The parameters for these kernel calls are:
|
||||
* m1_i1: PR_ENDPT # proc endpoint doing call
|
||||
* m1_p1: PR_MEM_PTR # pointer to mcontext structure
|
||||
* The parameters for SYS_SETMCONTEXT kernel call are:
|
||||
* m_lsys_krn_sys_setmcontext.endpt # proc endpoint doing call
|
||||
* m_lsys_krn_sys_setmcontext.ctx_ptr # pointer to mcontext structure
|
||||
*
|
||||
* The parameters for SYS_GETMCONTEXT kernel call are:
|
||||
* m_lsys_krn_sys_getmcontext.endpt # proc endpoint doing call
|
||||
* m_lsys_krn_sys_getmcontext.ctx_ptr # pointer to mcontext structure
|
||||
*/
|
||||
|
||||
#include "kernel/system.h"
|
||||
|
@ -25,7 +28,8 @@ int do_getmcontext(struct proc * caller, message * m_ptr)
|
|||
int proc_nr, r;
|
||||
mcontext_t mc;
|
||||
|
||||
if (! isokendpt(m_ptr->PR_ENDPT, &proc_nr)) return(EINVAL);
|
||||
if (!isokendpt(m_ptr->m_lsys_krn_sys_getmcontext.endpt, &proc_nr))
|
||||
return(EINVAL);
|
||||
if (iskerneln(proc_nr)) return(EPERM);
|
||||
rp = proc_addr(proc_nr);
|
||||
|
||||
|
@ -35,7 +39,8 @@ int do_getmcontext(struct proc * caller, message * m_ptr)
|
|||
#endif
|
||||
|
||||
/* Get the mcontext structure into our address space. */
|
||||
if ((r = data_copy(m_ptr->PR_ENDPT, (vir_bytes) m_ptr->PR_CTX_PTR, KERNEL,
|
||||
if ((r = data_copy(m_ptr->m_lsys_krn_sys_getmcontext.endpt,
|
||||
m_ptr->m_lsys_krn_sys_getmcontext.ctx_ptr, KERNEL,
|
||||
(vir_bytes) &mc, (phys_bytes) sizeof(mcontext_t))) != OK)
|
||||
return(r);
|
||||
|
||||
|
@ -53,8 +58,9 @@ int do_getmcontext(struct proc * caller, message * m_ptr)
|
|||
|
||||
|
||||
/* Copy the mcontext structure to the user's address space. */
|
||||
if ((r = data_copy(KERNEL, (vir_bytes) &mc, m_ptr->PR_ENDPT,
|
||||
(vir_bytes) m_ptr->PR_CTX_PTR,
|
||||
if ((r = data_copy(KERNEL, (vir_bytes) &mc,
|
||||
m_ptr->m_lsys_krn_sys_getmcontext.endpt,
|
||||
m_ptr->m_lsys_krn_sys_getmcontext.ctx_ptr,
|
||||
(phys_bytes) sizeof(mcontext_t))) != OK)
|
||||
return(r);
|
||||
|
||||
|
@ -73,11 +79,12 @@ int do_setmcontext(struct proc * caller, message * m_ptr)
|
|||
int proc_nr, r;
|
||||
mcontext_t mc;
|
||||
|
||||
if (!isokendpt(m_ptr->PR_ENDPT, &proc_nr)) return(EINVAL);
|
||||
if (!isokendpt(m_ptr->m_lsys_krn_sys_setmcontext.endpt, &proc_nr)) return(EINVAL);
|
||||
rp = proc_addr(proc_nr);
|
||||
|
||||
/* Get the mcontext structure into our address space. */
|
||||
if ((r = data_copy(m_ptr->PR_ENDPT, (vir_bytes) m_ptr->PR_CTX_PTR, KERNEL,
|
||||
if ((r = data_copy(m_ptr->m_lsys_krn_sys_setmcontext.endpt,
|
||||
m_ptr->m_lsys_krn_sys_setmcontext.ctx_ptr, KERNEL,
|
||||
(vir_bytes) &mc, (phys_bytes) sizeof(mcontext_t))) != OK)
|
||||
return(r);
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ vir_bytes mcp; /* where to store context */
|
|||
message m;
|
||||
int r;
|
||||
|
||||
m.PR_ENDPT = proc;
|
||||
m.PR_CTX_PTR = (char *) mcp;
|
||||
m.m_lsys_krn_sys_getmcontext.endpt = proc;
|
||||
m.m_lsys_krn_sys_getmcontext.ctx_ptr = mcp;
|
||||
r = _kernel_call(SYS_GETMCONTEXT, &m);
|
||||
return r;
|
||||
}
|
||||
|
@ -24,8 +24,8 @@ vir_bytes mcp; /* where to get context from */
|
|||
message m;
|
||||
int r;
|
||||
|
||||
m.PR_ENDPT = proc;
|
||||
m.PR_CTX_PTR = (char *) mcp;
|
||||
m.m_lsys_krn_sys_setmcontext.endpt = proc;
|
||||
m.m_lsys_krn_sys_setmcontext.ctx_ptr = mcp;
|
||||
r = _kernel_call(SYS_SETMCONTEXT, &m);
|
||||
return r;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue