summaryrefslogtreecommitdiff
path: root/sys/compat/linux
diff options
context:
space:
mode:
authornjoly <njoly@NetBSD.org>2007-05-24 11:21:52 +0000
committernjoly <njoly@NetBSD.org>2007-05-24 11:21:52 +0000
commitf70cd378048c38136c5ae62b58664160910eb4dd (patch)
tree5d4c5cae3e795c941a4f6006c8f2543d9a9d75b8 /sys/compat/linux
parent905b715a4b2c3463d216ae4a1ea52b0643c79775 (diff)
Fix restart of interrupted system calls.
- Make linux_sys_rt_sigreturn() return EJUSTRETURN on success. - Add missing rax to linux_sigcontext structure; and save/restore its value like other members in linux_sendsig()/linux_sys_rt_sigreturn(). With valuable help from manu.
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/arch/amd64/linux_machdep.c11
-rw-r--r--sys/compat/linux/arch/amd64/linux_machdep.h3
2 files changed, 9 insertions, 5 deletions
diff --git a/sys/compat/linux/arch/amd64/linux_machdep.c b/sys/compat/linux/arch/amd64/linux_machdep.c
index d885d11a26e..15064811a1f 100644
--- a/sys/compat/linux/arch/amd64/linux_machdep.c
+++ b/sys/compat/linux/arch/amd64/linux_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_machdep.c,v 1.22 2007/05/21 15:35:47 christos Exp $ */
+/* $NetBSD: linux_machdep.c,v 1.23 2007/05/24 11:21:52 njoly Exp $ */
/*-
* Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.22 2007/05/21 15:35:47 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.23 2007/05/24 11:21:52 njoly Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -211,6 +211,7 @@ linux_sendsig(ksi, mask)
sigframe.uc.luc_mcontext.rbp = tf->tf_rbp;
sigframe.uc.luc_mcontext.rbx = tf->tf_rbx;
sigframe.uc.luc_mcontext.rdx = tf->tf_rdx;
+ sigframe.uc.luc_mcontext.rax = tf->tf_rax;
sigframe.uc.luc_mcontext.rcx = tf->tf_rcx;
sigframe.uc.luc_mcontext.rsp = tf->tf_rsp;
sigframe.uc.luc_mcontext.rip = tf->tf_rip;
@@ -447,7 +448,7 @@ linux_sys_rt_sigreturn(l, v, retval)
mctx->__gregs[_REG_RSI] = lsigctx->rsi;
mctx->__gregs[_REG_RBP] = lsigctx->rbp;
mctx->__gregs[_REG_RBX] = lsigctx->rbx;
- mctx->__gregs[_REG_RAX] = tf->tf_rax;
+ mctx->__gregs[_REG_RAX] = lsigctx->rax;
mctx->__gregs[_REG_RDX] = lsigctx->rdx;
mctx->__gregs[_REG_RCX] = lsigctx->rcx;
mctx->__gregs[_REG_RIP] = lsigctx->rip;
@@ -506,8 +507,10 @@ linux_sys_rt_sigreturn(l, v, retval)
mutex_enter(&l->l_proc->p_smutex);
error = setucontext(l, &uctx);
mutex_exit(&l->l_proc->p_smutex);
+ if (error)
+ return error;
- return error;
+ return EJUSTRETURN;
}
int
diff --git a/sys/compat/linux/arch/amd64/linux_machdep.h b/sys/compat/linux/arch/amd64/linux_machdep.h
index a81f499e6c5..e6e0764b1c6 100644
--- a/sys/compat/linux/arch/amd64/linux_machdep.h
+++ b/sys/compat/linux/arch/amd64/linux_machdep.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_machdep.h,v 1.8 2007/04/23 12:45:42 manu Exp $ */
+/* $NetBSD: linux_machdep.h,v 1.9 2007/05/24 11:21:52 njoly Exp $ */
/*-
* Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
@@ -70,6 +70,7 @@ struct linux_sigcontext {
u_int64_t rbp;
u_int64_t rbx;
u_int64_t rdx;
+ u_int64_t rax;
u_int64_t rcx;
u_int64_t rsp;
u_int64_t rip;