summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2009-12-12 20:11:31 +0000
committerkib <kib@FreeBSD.org>2009-12-12 20:11:31 +0000
commit38d112ae45f1aa670ac8b218af4afa361d0af627 (patch)
tree5ae788bded8bd1f6a9d6918a5e5facd15cf794a3
parent6f2f9130ae5714e33ad56898dfeb3e346eabe1ac (diff)
downloadFreeBSD-src-38d112ae45f1aa670ac8b218af4afa361d0af627.zip
FreeBSD-src-38d112ae45f1aa670ac8b218af4afa361d0af627.tar.gz
For ia32 syscall(), call cpu_set_syscall_retval(). Update comment inside
cpu_set_syscall_retval() accordingly. MFC after: 1 week
-rw-r--r--sys/amd64/amd64/vm_machdep.c6
-rw-r--r--sys/amd64/ia32/ia32_syscall.c30
2 files changed, 6 insertions, 30 deletions
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index 6e56740..a99fdaa 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -330,10 +330,14 @@ cpu_set_syscall_retval(struct thread *td, int error)
case ERESTART:
/*
- * Reconstruct pc, we know that 'syscall' is 2 bytes.
+ * Reconstruct pc, we know that 'syscall' is 2 bytes,
+ * lcall $X,y is 7 bytes, int 0x80 is 2 bytes.
+ * We saved this in tf_err.
* We have to do a full context restore so that %r10
* (which was holding the value of %rcx) is restored
* for the next iteration.
+ * r10 restore is only required for freebsd/amd64 processes,
+ * but shall be innocent for any ia32 ABI.
*/
td->td_frame->tf_rip -= td->td_frame->tf_err;
td->td_frame->tf_r10 = td->td_frame->tf_rcx;
diff --git a/sys/amd64/ia32/ia32_syscall.c b/sys/amd64/ia32/ia32_syscall.c
index 4807248..5e20876 100644
--- a/sys/amd64/ia32/ia32_syscall.c
+++ b/sys/amd64/ia32/ia32_syscall.c
@@ -183,35 +183,7 @@ ia32_syscall(struct trapframe *frame)
AUDIT_SYSCALL_EXIT(error, td);
}
- switch (error) {
- case 0:
- frame->tf_rax = td->td_retval[0];
- frame->tf_rdx = td->td_retval[1];
- frame->tf_rflags &= ~PSL_C;
- break;
-
- case ERESTART:
- /*
- * Reconstruct pc, assuming lcall $X,y is 7 bytes,
- * int 0x80 is 2 bytes. We saved this in tf_err.
- */
- frame->tf_rip -= frame->tf_err;
- break;
-
- case EJUSTRETURN:
- break;
-
- default:
- if (p->p_sysent->sv_errsize) {
- if (error >= p->p_sysent->sv_errsize)
- error = -1; /* XXX */
- else
- error = p->p_sysent->sv_errtbl[error];
- }
- frame->tf_rax = error;
- frame->tf_rflags |= PSL_C;
- break;
- }
+ cpu_set_syscall_retval(td, error);
/*
* Traced syscall.
OpenPOWER on IntegriCloud