From 22e38f29328296d9d4cc33e46fd32a63e807abaf Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Mon, 4 Jun 2007 15:15:49 +1000 Subject: [POWERPC] Make syscall restart code more common This patch moves the code in signal_32.c and signal_64.c for handling syscall restart into a common signal.c file and converge around a single implementation that is based on the 32 bits one, using trap, ccr and r3 rather than the special "result" field for deciding what to do. The "result" field is now pretty much deprecated. We still set it for the sake of whatever might rely on it in userland but we no longer use it's content. This, along with a previous patch that enables ptracers to write to "trap" and "orig_r3" should allow gdb to properly handle syscall restarting. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras --- arch/powerpc/kernel/signal_32.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) (limited to 'arch/powerpc/kernel/signal_32.c') diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index dd1dca5bfa81..e5cc803476a1 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c @@ -51,6 +51,8 @@ #include #endif +#include "signal.h" + #undef DEBUG_SIG #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) @@ -1156,30 +1158,8 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) #ifdef CONFIG_PPC32 no_signal: #endif - if (TRAP(regs) == 0x0C00 /* System Call! */ - && regs->ccr & 0x10000000 /* error signalled */ - && ((ret = regs->gpr[3]) == ERESTARTSYS - || ret == ERESTARTNOHAND || ret == ERESTARTNOINTR - || ret == ERESTART_RESTARTBLOCK)) { - - if (signr > 0 - && (ret == ERESTARTNOHAND || ret == ERESTART_RESTARTBLOCK - || (ret == ERESTARTSYS - && !(ka.sa.sa_flags & SA_RESTART)))) { - /* make the system call return an EINTR error */ - regs->result = -EINTR; - regs->gpr[3] = EINTR; - /* note that the cr0.SO bit is already set */ - } else { - regs->nip -= 4; /* Back up & retry system call */ - regs->result = 0; - regs->trap = 0; - if (ret == ERESTART_RESTARTBLOCK) - regs->gpr[0] = __NR_restart_syscall; - else - regs->gpr[3] = regs->orig_gpr3; - } - } + /* Is there any syscall restart business here ? */ + check_syscall_restart(regs, &ka, signr > 0); if (signr == 0) { /* No signal to deliver -- put the saved sigmask back */ -- cgit v1.2.3