From: Lionel Sambuc Date: Mon, 26 May 2014 08:41:06 +0000 (+0200) Subject: Message type for SYS_{S,G}ETMCONTEXT X-Git-Tag: v3.3.0~213 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.dnssec-keygen.html?a=commitdiff_plain;h=2027f8bc782fac1ecc773ada12841c943a1347b7;p=minix.git Message type for SYS_{S,G}ETMCONTEXT Change-Id: I388eee89ba8cc6e6603b3193297b81179c1e6975 --- diff --git a/include/minix/com.h b/include/minix/com.h index d11fbd135..3516d0be4 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -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 diff --git a/include/minix/ipc.h b/include/minix/ipc.h index e056658ec..f11364aeb 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -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; diff --git a/kernel/system/do_mcontext.c b/kernel/system/do_mcontext.c index e5d744901..db128b3c2 100644 --- a/kernel/system/do_mcontext.c +++ b/kernel/system/do_mcontext.c @@ -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); diff --git a/lib/libsys/sys_mcontext.c b/lib/libsys/sys_mcontext.c index 323304baa..087555fa9 100644 --- a/lib/libsys/sys_mcontext.c +++ b/lib/libsys/sys_mcontext.c @@ -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; }