aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-04-24 06:01:48 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-24 06:01:48 -0400
commit238468b2ac76020c192a7402c92df5097916bf4a (patch)
treea951be34bc3a1d2d3a7d6de98c2100e4296e7bd9 /arch/sparc64
parent8243e40acb087fcd9e7609333f0b0551391f49fc (diff)
[SPARC64]: Use trap type stored in pt_regs to handle syscall restart.
Now that we can check the trap type directly, we don't need the funny restart_syscall indication from the trap return paths. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64')
-rw-r--r--arch/sparc64/kernel/signal.c22
-rw-r--r--arch/sparc64/kernel/signal32.c20
2 files changed, 21 insertions, 21 deletions
diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c
index 1c47009eb5ec..b959597201ed 100644
--- a/arch/sparc64/kernel/signal.c
+++ b/arch/sparc64/kernel/signal.c
@@ -510,15 +510,20 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
510 * want to handle. Thus you cannot kill init even with a SIGKILL even by 510 * want to handle. Thus you cannot kill init even with a SIGKILL even by
511 * mistake. 511 * mistake.
512 */ 512 */
513static void do_signal(struct pt_regs *regs, unsigned long orig_i0, int restart_syscall) 513static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
514{ 514{
515 siginfo_t info;
516 struct signal_deliver_cookie cookie; 515 struct signal_deliver_cookie cookie;
517 struct k_sigaction ka; 516 struct k_sigaction ka;
518 int signr;
519 sigset_t *oldset; 517 sigset_t *oldset;
518 siginfo_t info;
519 int signr, tt;
520 520
521 cookie.restart_syscall = restart_syscall; 521 tt = regs->magic & 0x1ff;
522 if (tt == 0x110 || tt == 0x111 || tt == 0x16d) {
523 regs->magic &= ~0x1ff;
524 cookie.restart_syscall = 1;
525 } else
526 cookie.restart_syscall = 0;
522 cookie.orig_i0 = orig_i0; 527 cookie.orig_i0 = orig_i0;
523 528
524 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 529 if (test_thread_flag(TIF_RESTORE_SIGMASK))
@@ -529,9 +534,8 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0, int restart_s
529#ifdef CONFIG_SPARC32_COMPAT 534#ifdef CONFIG_SPARC32_COMPAT
530 if (test_thread_flag(TIF_32BIT)) { 535 if (test_thread_flag(TIF_32BIT)) {
531 extern void do_signal32(sigset_t *, struct pt_regs *, 536 extern void do_signal32(sigset_t *, struct pt_regs *,
532 unsigned long, int); 537 struct signal_deliver_cookie *);
533 do_signal32(oldset, regs, orig_i0, 538 do_signal32(oldset, regs, &cookie);
534 cookie.restart_syscall);
535 return; 539 return;
536 } 540 }
537#endif 541#endif
@@ -539,7 +543,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0, int restart_s
539 signr = get_signal_to_deliver(&info, &ka, regs, &cookie); 543 signr = get_signal_to_deliver(&info, &ka, regs, &cookie);
540 if (signr > 0) { 544 if (signr > 0) {
541 if (cookie.restart_syscall) 545 if (cookie.restart_syscall)
542 syscall_restart(orig_i0, regs, &ka.sa); 546 syscall_restart(cookie.orig_i0, regs, &ka.sa);
543 handle_signal(signr, &ka, &info, oldset, regs); 547 handle_signal(signr, &ka, &info, oldset, regs);
544 548
545 /* a signal was successfully delivered; the saved 549 /* a signal was successfully delivered; the saved
@@ -580,7 +584,7 @@ void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, int restart_s
580 unsigned long thread_info_flags) 584 unsigned long thread_info_flags)
581{ 585{
582 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) 586 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
583 do_signal(regs, orig_i0, restart_syscall); 587 do_signal(regs, orig_i0);
584} 588}
585 589
586void ptrace_signal_deliver(struct pt_regs *regs, void *cookie) 590void ptrace_signal_deliver(struct pt_regs *regs, void *cookie)
diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c
index 74e0512f135c..43cdec64d9c9 100644
--- a/arch/sparc64/kernel/signal32.c
+++ b/arch/sparc64/kernel/signal32.c
@@ -982,20 +982,16 @@ static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs
982 * mistake. 982 * mistake.
983 */ 983 */
984void do_signal32(sigset_t *oldset, struct pt_regs * regs, 984void do_signal32(sigset_t *oldset, struct pt_regs * regs,
985 unsigned long orig_i0, int restart_syscall) 985 struct signal_deliver_cookie *cookie)
986{ 986{
987 siginfo_t info;
988 struct signal_deliver_cookie cookie;
989 struct k_sigaction ka; 987 struct k_sigaction ka;
988 siginfo_t info;
990 int signr; 989 int signr;
991 990
992 cookie.restart_syscall = restart_syscall; 991 signr = get_signal_to_deliver(&info, &ka, regs, cookie);
993 cookie.orig_i0 = orig_i0;
994
995 signr = get_signal_to_deliver(&info, &ka, regs, &cookie);
996 if (signr > 0) { 992 if (signr > 0) {
997 if (cookie.restart_syscall) 993 if (cookie->restart_syscall)
998 syscall_restart32(orig_i0, regs, &ka.sa); 994 syscall_restart32(cookie->orig_i0, regs, &ka.sa);
999 handle_signal32(signr, &ka, &info, oldset, regs); 995 handle_signal32(signr, &ka, &info, oldset, regs);
1000 996
1001 /* a signal was successfully delivered; the saved 997 /* a signal was successfully delivered; the saved
@@ -1007,16 +1003,16 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs,
1007 clear_thread_flag(TIF_RESTORE_SIGMASK); 1003 clear_thread_flag(TIF_RESTORE_SIGMASK);
1008 return; 1004 return;
1009 } 1005 }
1010 if (cookie.restart_syscall && 1006 if (cookie->restart_syscall &&
1011 (regs->u_regs[UREG_I0] == ERESTARTNOHAND || 1007 (regs->u_regs[UREG_I0] == ERESTARTNOHAND ||
1012 regs->u_regs[UREG_I0] == ERESTARTSYS || 1008 regs->u_regs[UREG_I0] == ERESTARTSYS ||
1013 regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { 1009 regs->u_regs[UREG_I0] == ERESTARTNOINTR)) {
1014 /* replay the system call when we are done */ 1010 /* replay the system call when we are done */
1015 regs->u_regs[UREG_I0] = cookie.orig_i0; 1011 regs->u_regs[UREG_I0] = cookie->orig_i0;
1016 regs->tpc -= 4; 1012 regs->tpc -= 4;
1017 regs->tnpc -= 4; 1013 regs->tnpc -= 4;
1018 } 1014 }
1019 if (cookie.restart_syscall && 1015 if (cookie->restart_syscall &&
1020 regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { 1016 regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) {
1021 regs->u_regs[UREG_G1] = __NR_restart_syscall; 1017 regs->u_regs[UREG_G1] = __NR_restart_syscall;
1022 regs->tpc -= 4; 1018 regs->tpc -= 4;