aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/signal_32.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-06-04 01:15:49 -0400
committerPaul Mackerras <paulus@samba.org>2007-06-14 08:29:57 -0400
commit22e38f29328296d9d4cc33e46fd32a63e807abaf (patch)
tree4cfea90671815ce87d5d0e896bb9f818565132c8 /arch/powerpc/kernel/signal_32.c
parent791cc501d422be96d6e3098faf6471ba29f4dd33 (diff)
[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 <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/signal_32.c')
-rw-r--r--arch/powerpc/kernel/signal_32.c28
1 files changed, 4 insertions, 24 deletions
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 @@
51#include <asm/pgtable.h> 51#include <asm/pgtable.h>
52#endif 52#endif
53 53
54#include "signal.h"
55
54#undef DEBUG_SIG 56#undef DEBUG_SIG
55 57
56#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 58#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
@@ -1156,30 +1158,8 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
1156#ifdef CONFIG_PPC32 1158#ifdef CONFIG_PPC32
1157no_signal: 1159no_signal:
1158#endif 1160#endif
1159 if (TRAP(regs) == 0x0C00 /* System Call! */ 1161 /* Is there any syscall restart business here ? */
1160 && regs->ccr & 0x10000000 /* error signalled */ 1162 check_syscall_restart(regs, &ka, signr > 0);
1161 && ((ret = regs->gpr[3]) == ERESTARTSYS
1162 || ret == ERESTARTNOHAND || ret == ERESTARTNOINTR
1163 || ret == ERESTART_RESTARTBLOCK)) {
1164
1165 if (signr > 0
1166 && (ret == ERESTARTNOHAND || ret == ERESTART_RESTARTBLOCK
1167 || (ret == ERESTARTSYS
1168 && !(ka.sa.sa_flags & SA_RESTART)))) {
1169 /* make the system call return an EINTR error */
1170 regs->result = -EINTR;
1171 regs->gpr[3] = EINTR;
1172 /* note that the cr0.SO bit is already set */
1173 } else {
1174 regs->nip -= 4; /* Back up & retry system call */
1175 regs->result = 0;
1176 regs->trap = 0;
1177 if (ret == ERESTART_RESTARTBLOCK)
1178 regs->gpr[0] = __NR_restart_syscall;
1179 else
1180 regs->gpr[3] = regs->orig_gpr3;
1181 }
1182 }
1183 1163
1184 if (signr == 0) { 1164 if (signr == 0) {
1185 /* No signal to deliver -- put the saved sigmask back */ 1165 /* No signal to deliver -- put the saved sigmask back */