diff options
-rw-r--r-- | sys/alpha/alpha/machdep.c | 4 | ||||
-rw-r--r-- | sys/amd64/amd64/machdep.c | 4 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 4 | ||||
-rw-r--r-- | sys/ia64/ia64/machdep.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_context.c | 4 | ||||
-rw-r--r-- | sys/pc98/i386/machdep.c | 4 | ||||
-rw-r--r-- | sys/pc98/pc98/machdep.c | 4 | ||||
-rw-r--r-- | sys/powerpc/aim/machdep.c | 2 | ||||
-rw-r--r-- | sys/powerpc/powerpc/machdep.c | 2 | ||||
-rw-r--r-- | sys/sparc64/sparc64/machdep.c | 4 | ||||
-rw-r--r-- | sys/sys/ucontext.h | 11 |
11 files changed, 27 insertions, 20 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index 5de6070..91f90e4 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -2027,14 +2027,14 @@ set_regs(td, regs) } int -get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) +get_mcontext(struct thread *td, mcontext_t *mcp, int flags) { /* * Use a trapframe for getsetcontext, so just copy the * threads trapframe. */ bcopy(td->td_frame, &mcp->mc_regs, sizeof(struct trapframe)); - if (clear_ret != 0) { + if (flags & GET_MC_CLEAR_RET) { mcp->mc_regs[FRAME_V0] = 0; mcp->mc_regs[FRAME_A4] = 0; mcp->mc_regs[FRAME_A3] = 0; diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 8272f72..5e6254d 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1441,7 +1441,7 @@ set_fpregs(struct thread *td, struct fpreg *fpregs) * Get machine context. */ int -get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) +get_mcontext(struct thread *td, mcontext_t *mcp, int flags) { struct trapframe *tp; @@ -1462,7 +1462,7 @@ get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) mcp->mc_rbp = tp->tf_rbp; mcp->mc_rbx = tp->tf_rbx; mcp->mc_rcx = tp->tf_rcx; - if (clear_ret != 0) { + if (flags & GET_MC_CLEAR_RET) { mcp->mc_rax = 0; mcp->mc_rdx = 0; } else { diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index f1ef3e7..1edd08f 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -2377,7 +2377,7 @@ set_fpregs(struct thread *td, struct fpreg *fpregs) * Get machine context. */ int -get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) +get_mcontext(struct thread *td, mcontext_t *mcp, int flags) { struct trapframe *tp; @@ -2394,7 +2394,7 @@ get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) mcp->mc_esi = tp->tf_esi; mcp->mc_ebp = tp->tf_ebp; mcp->mc_isp = tp->tf_isp; - if (clear_ret != 0) { + if (flags & GET_MC_CLEAR_RET) { mcp->mc_eax = 0; mcp->mc_edx = 0; } else { diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c index fb4d5bf..25630c8 100644 --- a/sys/ia64/ia64/machdep.c +++ b/sys/ia64/ia64/machdep.c @@ -1073,7 +1073,7 @@ freebsd4_sigreturn(struct thread *td, struct freebsd4_sigreturn_args *uap) #endif int -get_mcontext(struct thread *td, mcontext_t *mc, int clear_ret) +get_mcontext(struct thread *td, mcontext_t *mc, int flags) { struct _special s; struct trapframe *tf; @@ -1108,7 +1108,7 @@ get_mcontext(struct thread *td, mcontext_t *mc, int clear_ret) * return register, just like gr8-gr10. */ mc->mc_flags |= _MC_FLAGS_RETURN_VALID; - if (!clear_ret) { + if ((flags & GET_MC_CLEAR_RET) == 0) { mc->mc_scratch.gr8 = tf->tf_scratch.gr8; mc->mc_scratch.gr9 = tf->tf_scratch.gr9; mc->mc_scratch.gr10 = tf->tf_scratch.gr10; diff --git a/sys/kern/kern_context.c b/sys/kern/kern_context.c index ca3e2b1..300b1f4 100644 --- a/sys/kern/kern_context.c +++ b/sys/kern/kern_context.c @@ -70,7 +70,7 @@ getcontext(struct thread *td, struct getcontext_args *uap) if (uap->ucp == NULL) ret = EINVAL; else { - get_mcontext(td, &uc.uc_mcontext, 1); + get_mcontext(td, &uc.uc_mcontext, GET_MC_CLEAR_RET); PROC_LOCK(td->td_proc); uc.uc_sigmask = td->td_sigmask; PROC_UNLOCK(td->td_proc); @@ -114,7 +114,7 @@ swapcontext(struct thread *td, struct swapcontext_args *uap) if (uap->oucp == NULL || uap->ucp == NULL) ret = EINVAL; else { - get_mcontext(td, &uc.uc_mcontext, 1); + get_mcontext(td, &uc.uc_mcontext, GET_MC_CLEAR_RET); PROC_LOCK(td->td_proc); uc.uc_sigmask = td->td_sigmask; PROC_UNLOCK(td->td_proc); diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index 4987d41..d49ada9 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -2435,7 +2435,7 @@ set_fpregs(struct thread *td, struct fpreg *fpregs) * Get machine context. */ int -get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) +get_mcontext(struct thread *td, mcontext_t *mcp, int flags) { struct trapframe *tp; @@ -2453,7 +2453,7 @@ get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) mcp->mc_ebp = tp->tf_ebp; mcp->mc_isp = tp->tf_isp; mcp->mc_ebx = tp->tf_ebx; - if (clear_ret != 0) { + if (flags & GET_MC_CLEAR_RET) { mcp->mc_eax = 0; mcp->mc_edx = 0; } else { diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 4987d41..d49ada9 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -2435,7 +2435,7 @@ set_fpregs(struct thread *td, struct fpreg *fpregs) * Get machine context. */ int -get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) +get_mcontext(struct thread *td, mcontext_t *mcp, int flags) { struct trapframe *tp; @@ -2453,7 +2453,7 @@ get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) mcp->mc_ebp = tp->tf_ebp; mcp->mc_isp = tp->tf_isp; mcp->mc_ebx = tp->tf_ebx; - if (clear_ret != 0) { + if (flags & GET_MC_CLEAR_RET) { mcp->mc_eax = 0; mcp->mc_edx = 0; } else { diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c index 325da09..5dbb5ee 100644 --- a/sys/powerpc/aim/machdep.c +++ b/sys/powerpc/aim/machdep.c @@ -581,7 +581,7 @@ freebsd4_sigreturn(struct thread *td, struct freebsd4_sigreturn_args *uap) #endif int -get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) +get_mcontext(struct thread *td, mcontext_t *mcp, int flags) { return (ENOSYS); diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c index 325da09..5dbb5ee 100644 --- a/sys/powerpc/powerpc/machdep.c +++ b/sys/powerpc/powerpc/machdep.c @@ -581,7 +581,7 @@ freebsd4_sigreturn(struct thread *td, struct freebsd4_sigreturn_args *uap) #endif int -get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) +get_mcontext(struct thread *td, mcontext_t *mcp, int flags) { return (ENOSYS); diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c index 3621fef..a099638 100644 --- a/sys/sparc64/sparc64/machdep.c +++ b/sys/sparc64/sparc64/machdep.c @@ -564,7 +564,7 @@ freebsd4_sigreturn(struct thread *td, struct freebsd4_sigreturn_args *uap) #endif int -get_mcontext(struct thread *td, mcontext_t *mc, int clear_ret) +get_mcontext(struct thread *td, mcontext_t *mc, int flags) { struct trapframe *tf; struct pcb *pcb; @@ -572,7 +572,7 @@ get_mcontext(struct thread *td, mcontext_t *mc, int clear_ret) tf = td->td_frame; pcb = td->td_pcb; bcopy(tf, mc, sizeof(*tf)); - if (clear_ret != 0) { + if (flags & GET_MC_CLEAR_RET) { mc->mc_out[0] = 0; mc->mc_out[1] = 0; } diff --git a/sys/sys/ucontext.h b/sys/sys/ucontext.h index 70402ff..85a5fd6 100644 --- a/sys/sys/ucontext.h +++ b/sys/sys/ucontext.h @@ -83,9 +83,16 @@ __END_DECLS struct thread; +/* + * Flags for get_mcontext(). The low order 4 bits (i.e a mask of 0x0f) are + * reserved for use by machine independent code. All other bits are for use + * by machine dependent code. + */ +#define GET_MC_CLEAR_RET 1 + /* Machine-dependent functions: */ -int get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret); -int set_mcontext(struct thread *td, const mcontext_t *mcp); +int get_mcontext(struct thread *, mcontext_t *, int); +int set_mcontext(struct thread *, const mcontext_t *); #endif /* !_KERNEL */ |