diff options
author | Daniel Eischen <deischen@FreeBSD.org> | 2003-04-25 01:50:30 +0000 |
---|---|---|
committer | Daniel Eischen <deischen@FreeBSD.org> | 2003-04-25 01:50:30 +0000 |
commit | 1328e1c4beb0c88b4291ca7849ce66cc2078ee8d (patch) | |
tree | bb8eb253f377c8996df874bb13ce8f388ab880c7 /sys/pc98 | |
parent | c20264770f974b24a7464fd927b2980ce0b1619d (diff) | |
download | src-1328e1c4beb0c88b4291ca7849ce66cc2078ee8d.tar.gz src-1328e1c4beb0c88b4291ca7849ce66cc2078ee8d.zip |
Add an argument to get_mcontext() which specified whether the
syscall return values should be cleared. The system calls
getcontext() and swapcontext() want to return 0 on success
but these contexts can be switched to at a later time so
the return values need to be cleared in the saved register
sets. Other callers of get_mcontext() would normally want
the context without clearing the return values.
Remove the i386-specific context saving from the KSE code.
get_mcontext() is not i386-specific any more.
Fix a bad pointer in the alpha get_mcontext() code. The
context was being bcopy()'d from &td->tf_frame, but tf_frame
is itself a pointer, so the thread was being copied instead.
Spotted by jake.
Glanced at by: jake
Reviewed by: bde (months ago)
Notes
Notes:
svn path=/head/; revision=113998
Diffstat (limited to 'sys/pc98')
-rw-r--r-- | sys/pc98/i386/machdep.c | 11 | ||||
-rw-r--r-- | sys/pc98/pc98/machdep.c | 11 |
2 files changed, 16 insertions, 6 deletions
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index 707b8fc7d3aa..b9013a22da35 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -2428,7 +2428,7 @@ set_fpregs(struct thread *td, struct fpreg *fpregs) * Get machine context. */ int -get_mcontext(struct thread *td, mcontext_t *mcp) +get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) { struct trapframe *tp; @@ -2446,9 +2446,14 @@ get_mcontext(struct thread *td, mcontext_t *mcp) mcp->mc_ebp = tp->tf_ebp; mcp->mc_isp = tp->tf_isp; mcp->mc_ebx = tp->tf_ebx; - mcp->mc_edx = tp->tf_edx; + if (clear_ret != 0) { + mcp->mc_eax = 0; + mcp->mc_edx = 0; + } else { + mcp->mc_eax = tp->tf_eax; + mcp->mc_edx = tp->tf_edx; + } mcp->mc_ecx = tp->tf_ecx; - mcp->mc_eax = tp->tf_eax; mcp->mc_eip = tp->tf_eip; mcp->mc_cs = tp->tf_cs; mcp->mc_eflags = tp->tf_eflags; diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 707b8fc7d3aa..b9013a22da35 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -2428,7 +2428,7 @@ set_fpregs(struct thread *td, struct fpreg *fpregs) * Get machine context. */ int -get_mcontext(struct thread *td, mcontext_t *mcp) +get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) { struct trapframe *tp; @@ -2446,9 +2446,14 @@ get_mcontext(struct thread *td, mcontext_t *mcp) mcp->mc_ebp = tp->tf_ebp; mcp->mc_isp = tp->tf_isp; mcp->mc_ebx = tp->tf_ebx; - mcp->mc_edx = tp->tf_edx; + if (clear_ret != 0) { + mcp->mc_eax = 0; + mcp->mc_edx = 0; + } else { + mcp->mc_eax = tp->tf_eax; + mcp->mc_edx = tp->tf_edx; + } mcp->mc_ecx = tp->tf_ecx; - mcp->mc_eax = tp->tf_eax; mcp->mc_eip = tp->tf_eip; mcp->mc_cs = tp->tf_cs; mcp->mc_eflags = tp->tf_eflags; |