]> err.no Git - linux-2.6/commitdiff
[SPARC64]: Use trap type stored in pt_regs to handle syscall restart.
authorDavid S. Miller <davem@davemloft.net>
Thu, 24 Apr 2008 10:01:48 +0000 (03:01 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Apr 2008 10:01:48 +0000 (03:01 -0700)
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>
arch/sparc64/kernel/signal.c
arch/sparc64/kernel/signal32.c

index 1c47009eb5ec09068e7417d4c158c97c841c230d..b959597201ede40f6079677104d1ab553c40b1d4 100644 (file)
@@ -510,15 +510,20 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
  * want to handle. Thus you cannot kill init even with a SIGKILL even by
  * mistake.
  */
-static void do_signal(struct pt_regs *regs, unsigned long orig_i0, int restart_syscall)
+static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
 {
-       siginfo_t info;
        struct signal_deliver_cookie cookie;
        struct k_sigaction ka;
-       int signr;
        sigset_t *oldset;
+       siginfo_t info;
+       int signr, tt;
        
-       cookie.restart_syscall = restart_syscall;
+       tt = regs->magic & 0x1ff;
+       if (tt == 0x110 || tt == 0x111 || tt == 0x16d) {
+               regs->magic &= ~0x1ff;
+               cookie.restart_syscall = 1;
+       } else
+               cookie.restart_syscall = 0;
        cookie.orig_i0 = orig_i0;
 
        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
 #ifdef CONFIG_SPARC32_COMPAT
        if (test_thread_flag(TIF_32BIT)) {
                extern void do_signal32(sigset_t *, struct pt_regs *,
-                                       unsigned long, int);
-               do_signal32(oldset, regs, orig_i0,
-                           cookie.restart_syscall);
+                                       struct signal_deliver_cookie *);
+               do_signal32(oldset, regs, &cookie);
                return;
        }
 #endif 
@@ -539,7 +543,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0, int restart_s
        signr = get_signal_to_deliver(&info, &ka, regs, &cookie);
        if (signr > 0) {
                if (cookie.restart_syscall)
-                       syscall_restart(orig_i0, regs, &ka.sa);
+                       syscall_restart(cookie.orig_i0, regs, &ka.sa);
                handle_signal(signr, &ka, &info, oldset, regs);
 
                /* 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
                      unsigned long thread_info_flags)
 {
        if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
-               do_signal(regs, orig_i0, restart_syscall);
+               do_signal(regs, orig_i0);
 }
 
 void ptrace_signal_deliver(struct pt_regs *regs, void *cookie)
index 74e0512f135c9380d35f06f98aed5a5949406b98..43cdec64d9c9014c9b53380cc69632702e0639ca 100644 (file)
@@ -982,20 +982,16 @@ static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs
  * mistake.
  */
 void do_signal32(sigset_t *oldset, struct pt_regs * regs,
-                unsigned long orig_i0, int restart_syscall)
+                struct signal_deliver_cookie *cookie)
 {
-       siginfo_t info;
-       struct signal_deliver_cookie cookie;
        struct k_sigaction ka;
+       siginfo_t info;
        int signr;
        
-       cookie.restart_syscall = restart_syscall;
-       cookie.orig_i0 = orig_i0;
-
-       signr = get_signal_to_deliver(&info, &ka, regs, &cookie);
+       signr = get_signal_to_deliver(&info, &ka, regs, cookie);
        if (signr > 0) {
-               if (cookie.restart_syscall)
-                       syscall_restart32(orig_i0, regs, &ka.sa);
+               if (cookie->restart_syscall)
+                       syscall_restart32(cookie->orig_i0, regs, &ka.sa);
                handle_signal32(signr, &ka, &info, oldset, regs);
 
                /* a signal was successfully delivered; the saved
@@ -1007,16 +1003,16 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs,
                        clear_thread_flag(TIF_RESTORE_SIGMASK);
                return;
        }
-       if (cookie.restart_syscall &&
+       if (cookie->restart_syscall &&
            (regs->u_regs[UREG_I0] == ERESTARTNOHAND ||
             regs->u_regs[UREG_I0] == ERESTARTSYS ||
             regs->u_regs[UREG_I0] == ERESTARTNOINTR)) {
                /* replay the system call when we are done */
-               regs->u_regs[UREG_I0] = cookie.orig_i0;
+               regs->u_regs[UREG_I0] = cookie->orig_i0;
                regs->tpc -= 4;
                regs->tnpc -= 4;
        }
-       if (cookie.restart_syscall &&
+       if (cookie->restart_syscall &&
            regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) {
                regs->u_regs[UREG_G1] = __NR_restart_syscall;
                regs->tpc -= 4;