Message type for PM_MCONTEXT

Change-Id: I4ab9fc23ce8d78e03582580feba5ba96541f0f7e
This commit is contained in:
Lionel Sambuc 2014-05-13 16:21:04 +02:00
parent ca31c1caae
commit e1986cd160
6 changed files with 16 additions and 11 deletions

View file

@ -85,9 +85,6 @@
#define PM_SIG_SET m2_sigset /* sigset_t */ #define PM_SIG_SET m2_sigset /* sigset_t */
#define PM_SIG_CTX m2_p1 /* struct sigcontext * */ #define PM_SIG_CTX m2_p1 /* struct sigcontext * */
/* Field names for the getmcontext(2)/setmcontext(2) calls. */
#define PM_MCONTEXT_CTX m1_p1 /* mcontext_t * */
/*===========================================================================* /*===========================================================================*
* Calls to VFS * * Calls to VFS *
*===========================================================================*/ *===========================================================================*/

View file

@ -169,6 +169,13 @@ typedef struct {
} mess_lc_pm_itimer; } mess_lc_pm_itimer;
_ASSERT_MSG_SIZE(mess_lc_pm_itimer); _ASSERT_MSG_SIZE(mess_lc_pm_itimer);
typedef struct {
vir_bytes ctx; /* mcontext_t * */
uint8_t padding[52];
} mess_lc_pm_mcontext;
_ASSERT_MSG_SIZE(mess_lc_pm_mcontext);
typedef struct { typedef struct {
int which; int which;
int who; int who;
@ -1060,6 +1067,7 @@ typedef struct {
mess_lc_pm_getsid m_lc_pm_getsid; mess_lc_pm_getsid m_lc_pm_getsid;
mess_lc_pm_groups m_lc_pm_groups; mess_lc_pm_groups m_lc_pm_groups;
mess_lc_pm_itimer m_lc_pm_itimer; mess_lc_pm_itimer m_lc_pm_itimer;
mess_lc_pm_mcontext m_lc_pm_mcontext;
mess_lc_pm_priority m_lc_pm_priority; mess_lc_pm_priority m_lc_pm_priority;
mess_lc_pm_ptrace m_lc_pm_ptrace; mess_lc_pm_ptrace m_lc_pm_ptrace;
mess_lc_pm_reboot m_lc_pm_reboot; mess_lc_pm_reboot m_lc_pm_reboot;

View file

@ -255,8 +255,8 @@ int sys_cprof(int action, int size, endpoint_t endpt, void *ctl_ptr,
int sys_profbuf(void *ctl_ptr, void *mem_ptr); int sys_profbuf(void *ctl_ptr, void *mem_ptr);
/* machine context */ /* machine context */
int sys_getmcontext(endpoint_t proc, mcontext_t *mcp); int sys_getmcontext(endpoint_t proc, vir_bytes mcp);
int sys_setmcontext(endpoint_t proc, mcontext_t *mcp); int sys_setmcontext(endpoint_t proc, vir_bytes mcp);
/* input */ /* input */
int tty_input_inject(int type, int code, int val); int tty_input_inject(int type, int code, int val);

View file

@ -14,7 +14,7 @@ int setmcontext(const mcontext_t *mcp)
message m; message m;
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
m.PM_MCONTEXT_CTX = (char *) __UNCONST(mcp); m.m_lc_pm_mcontext.ctx = (vir_bytes)mcp;
return(_syscall(PM_PROC_NR, PM_SETMCONTEXT, &m)); return(_syscall(PM_PROC_NR, PM_SETMCONTEXT, &m));
} }
@ -25,7 +25,7 @@ int getmcontext(mcontext_t *mcp)
message m; message m;
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
m.PM_MCONTEXT_CTX = (char *) mcp; m.m_lc_pm_mcontext.ctx = (vir_bytes)mcp;
return(_syscall(PM_PROC_NR, PM_GETMCONTEXT, &m)); return(_syscall(PM_PROC_NR, PM_GETMCONTEXT, &m));
} }

View file

@ -2,7 +2,7 @@
int sys_getmcontext(proc, mcp) int sys_getmcontext(proc, mcp)
endpoint_t proc; /* process retrieving context */ endpoint_t proc; /* process retrieving context */
mcontext_t *mcp; /* where to store context */ vir_bytes mcp; /* where to store context */
{ {
/* A process wants to store its context in mcp. */ /* A process wants to store its context in mcp. */
@ -17,7 +17,7 @@ mcontext_t *mcp; /* where to store context */
int sys_setmcontext(proc, mcp) int sys_setmcontext(proc, mcp)
endpoint_t proc; /* process setting context */ endpoint_t proc; /* process setting context */
mcontext_t *mcp; /* where to get context from */ vir_bytes mcp; /* where to get context from */
{ {
/* A process wants to restore context stored in ucp. */ /* A process wants to restore context stored in ucp. */

View file

@ -11,7 +11,7 @@
*===========================================================================*/ *===========================================================================*/
int do_setmcontext() int do_setmcontext()
{ {
return sys_setmcontext(who_e, (mcontext_t *) m_in.PM_MCONTEXT_CTX); return sys_setmcontext(who_e, m_in.m_lc_pm_mcontext.ctx);
} }
@ -20,6 +20,6 @@ int do_setmcontext()
*===========================================================================*/ *===========================================================================*/
int do_getmcontext() int do_getmcontext()
{ {
return sys_getmcontext(who_e, (mcontext_t *) m_in.PM_MCONTEXT_CTX); return sys_getmcontext(who_e, m_in.m_lc_pm_mcontext.ctx);
} }