From e1986cd160e3283f52a66fc5499e0bbb9e018111 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Tue, 13 May 2014 16:21:04 +0200 Subject: [PATCH] Message type for PM_MCONTEXT Change-Id: I4ab9fc23ce8d78e03582580feba5ba96541f0f7e --- include/minix/callnr.h | 3 --- include/minix/ipc.h | 8 ++++++++ include/minix/syslib.h | 4 ++-- lib/libc/sys-minix/_mcontext.c | 4 ++-- lib/libsys/sys_mcontext.c | 4 ++-- servers/pm/mcontext.c | 4 ++-- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/include/minix/callnr.h b/include/minix/callnr.h index fecfe2491..1f7d7434d 100644 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -85,9 +85,6 @@ #define PM_SIG_SET m2_sigset /* sigset_t */ #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 * *===========================================================================*/ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 50fb550c8..487d8d0d1 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -169,6 +169,13 @@ typedef struct { } 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 { int which; int who; @@ -1060,6 +1067,7 @@ typedef struct { mess_lc_pm_getsid m_lc_pm_getsid; mess_lc_pm_groups m_lc_pm_groups; 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_ptrace m_lc_pm_ptrace; mess_lc_pm_reboot m_lc_pm_reboot; diff --git a/include/minix/syslib.h b/include/minix/syslib.h index 834e0ee65..ad7d8d8de 100644 --- a/include/minix/syslib.h +++ b/include/minix/syslib.h @@ -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); /* machine context */ -int sys_getmcontext(endpoint_t proc, mcontext_t *mcp); -int sys_setmcontext(endpoint_t proc, mcontext_t *mcp); +int sys_getmcontext(endpoint_t proc, vir_bytes mcp); +int sys_setmcontext(endpoint_t proc, vir_bytes mcp); /* input */ int tty_input_inject(int type, int code, int val); diff --git a/lib/libc/sys-minix/_mcontext.c b/lib/libc/sys-minix/_mcontext.c index b881e220a..69b2ea0bb 100644 --- a/lib/libc/sys-minix/_mcontext.c +++ b/lib/libc/sys-minix/_mcontext.c @@ -14,7 +14,7 @@ int setmcontext(const mcontext_t *mcp) message 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)); } @@ -25,7 +25,7 @@ int getmcontext(mcontext_t *mcp) message 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)); } diff --git a/lib/libsys/sys_mcontext.c b/lib/libsys/sys_mcontext.c index 6b4b69533..323304baa 100644 --- a/lib/libsys/sys_mcontext.c +++ b/lib/libsys/sys_mcontext.c @@ -2,7 +2,7 @@ int sys_getmcontext(proc, mcp) 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. */ @@ -17,7 +17,7 @@ mcontext_t *mcp; /* where to store context */ int sys_setmcontext(proc, mcp) 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. */ diff --git a/servers/pm/mcontext.c b/servers/pm/mcontext.c index beac9e608..6c88e97e1 100644 --- a/servers/pm/mcontext.c +++ b/servers/pm/mcontext.c @@ -11,7 +11,7 @@ *===========================================================================*/ 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() { - return sys_getmcontext(who_e, (mcontext_t *) m_in.PM_MCONTEXT_CTX); + return sys_getmcontext(who_e, m_in.m_lc_pm_mcontext.ctx); }