]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Revert "arm: get rid of TIF_SYSCALL_RESTARTSYS"
authorStephen Rothwell <sfr@canb.auug.org.au>
Fri, 6 Jul 2012 00:32:57 +0000 (10:32 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 6 Jul 2012 00:32:57 +0000 (10:32 +1000)
This reverts commit 76c3f4da3ee47b68304dbe0f64e86562e7945bf3.

requested by Russell King.

arch/arm/include/asm/thread_info.h
arch/arm/kernel/entry-common.S
arch/arm/kernel/ptrace.c
arch/arm/kernel/signal.c

index b2d6b412172d1990cedd5d873a4fdae07bbade67..8564a6dcb0bc3b92a8037c2c115b95f61ef8b8c5 100644 (file)
@@ -148,6 +148,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
 #define TIF_NOTIFY_RESUME      2       /* callback before returning to user */
 #define TIF_SYSCALL_TRACE      8
 #define TIF_SYSCALL_AUDIT      9
+#define TIF_SYSCALL_RESTARTSYS 10
 #define TIF_USING_IWMMXT       17
 #define TIF_MEMDIE             18      /* is terminating due to OOM killer */
 #define TIF_RESTORE_SIGMASK    20
@@ -161,9 +162,11 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
 #define _TIF_SYSCALL_AUDIT     (1 << TIF_SYSCALL_AUDIT)
 #define _TIF_USING_IWMMXT      (1 << TIF_USING_IWMMXT)
 #define _TIF_SECCOMP           (1 << TIF_SECCOMP)
+#define _TIF_SYSCALL_RESTARTSYS        (1 << TIF_SYSCALL_RESTARTSYS)
 
 /* Checks for any syscall work in entry-common.S */
-#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT)
+#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
+                          _TIF_SYSCALL_RESTARTSYS)
 
 /*
  * Change these and you break ASM code in entry-common.S
index 45046b5506eb46374180e1b84dd7563e86795a45..0e647da6a7921bd6865951ce97c362695a2099b9 100644 (file)
@@ -54,10 +54,10 @@ work_pending:
        mov     r0, sp                          @ 'regs'
        mov     r2, why                         @ 'syscall'
        bl      do_work_pending
-       cmp     r0, #0
+       tst     r0, #1
        beq     no_work_pending
-       movlt   scno, #(__NR_restart_syscall - __NR_SYSCALL_BASE)
-       ldmia   sp, {r0 - r5}                   @ have to reload r0 - r5
+       mov     r0, sp                          @ pointer to regs
+       ldmia   r0, {r0 - r5}                   @ have to reload r0 - r5
        b       local_restart                   @ ... and off we go
 
 /*
index fc86b76537ee95158b3b6799c064e9e232be23a7..5700a7ae7f0bc1511ae048d7a3f025c401e5729c 100644 (file)
@@ -918,6 +918,8 @@ asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno)
                audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0,
                                    regs->ARM_r1, regs->ARM_r2, regs->ARM_r3);
 
+       if (why == 0 && test_and_clear_thread_flag(TIF_SYSCALL_RESTARTSYS))
+               scno = __NR_restart_syscall - __NR_SYSCALL_BASE;
        if (!test_thread_flag(TIF_SYSCALL_TRACE))
                return scno;
 
index 56f72d257ebdfcdfd8607fcc770eeecc61c24806..c4368c67b042ecb8416609784d1b28e7f8a9d3ba 100644 (file)
@@ -590,7 +590,7 @@ static int do_signal(struct pt_regs *regs, int syscall)
                 */
                switch (retval) {
                case -ERESTART_RESTARTBLOCK:
-                       restart -= 2;
+                       restart++;
                case -ERESTARTNOHAND:
                case -ERESTARTSYS:
                case -ERESTARTNOINTR:
@@ -628,9 +628,13 @@ static int do_signal(struct pt_regs *regs, int syscall)
                return 0;
        }
 
-       restore_saved_sigmask();
-       if (unlikely(restart))
+       if (unlikely(restart)) {
+               if (restart > 1)
+                       set_thread_flag(TIF_SYSCALL_RESTARTSYS);
                regs->ARM_pc = continue_addr;
+       }
+
+       restore_saved_sigmask();
        return restart;
 }
 
@@ -645,14 +649,13 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall)
                                return 0;
                        local_irq_enable();
                        if (thread_flags & _TIF_SIGPENDING) {
-                               int restart = do_signal(regs, syscall);
-                               if (unlikely(restart)) {
+                               if (unlikely(do_signal(regs, syscall))) {
                                        /*
                                         * Restart without handlers.
                                         * Deal with it without leaving
                                         * the kernel space.
                                         */
-                                       return restart;
+                                       return 1;
                                }
                                syscall = 0;
                        } else {