Blackfin arch: fix bug when sending signals with the wrong PC, cause gdb get confused
authorRobin Getz <robin.getz@analog.com>
Wed, 21 Nov 2007 08:38:05 +0000 (16:38 +0800)
committerBryan Wu <bryan.wu@analog.com>
Wed, 21 Nov 2007 08:38:05 +0000 (16:38 +0800)
We need to send signals with the proper PC, or gdb gets
confused, and lots of tests fail. This should fix that.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
arch/blackfin/kernel/traps.c

index d88098c58bfa053ff2c2405c11f0a5d4e1bde5d9..910cdd43fe60e6eca52bc135a2ea85a0d3ca8ede 100644 (file)
@@ -463,18 +463,20 @@ asmlinkage void trap_c(struct pt_regs *fp)
 #endif
                        panic("Kernel exception");
                }
-
-               /* Ensure that bad return addresses don't end up in an infinite
-                * loop, due to speculative loads/reads
-                */
-               if (trapnr == VEC_CPLB_I_M)
-                       fp->pc = SAFE_USER_INSTRUCTION;
        }
+
        info.si_signo = sig;
        info.si_errno = 0;
        info.si_addr = (void *)fp->pc;
        force_sig_info(sig, &info, current);
 
+       /* Ensure that bad return addresses don't end up in an infinite
+        * loop, due to speculative loads/reads. This needs to be done after
+        * the signal has been sent.
+        */
+       if (trapnr == VEC_CPLB_I_M && sig != SIGTRAP)
+               fp->pc = SAFE_USER_INSTRUCTION;
+
        trace_buffer_restore(j);
        return;
 }