Blackfin: fill out the signal si_addr when sending a SIGBUS/SIGSEGV
authorBarry Song <barry.song@analog.com>
Tue, 19 Jan 2010 11:01:08 +0000 (11:01 +0000)
committerMike Frysinger <vapier@gentoo.org>
Tue, 9 Mar 2010 05:30:49 +0000 (00:30 -0500)
Some userspace applications use this member in diagnosing crashes.  It
also makes some LTP tests pass (i.e. the Blackfin arch behaves more like
everyone else).

Signed-off-by: Barry Song <barry.song@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
arch/blackfin/kernel/traps.c

index 8576680..4eaca2d 100644 (file)
@@ -260,9 +260,7 @@ asmlinkage notrace void trap_c(struct pt_regs *fp)
 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
        int j;
 #endif
-#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
        unsigned int cpu = raw_smp_processor_id();
-#endif
        const char *strerror = NULL;
        int sig = 0;
        siginfo_t info;
@@ -651,7 +649,17 @@ asmlinkage notrace void trap_c(struct pt_regs *fp)
        {
                info.si_signo = sig;
                info.si_errno = 0;
-               info.si_addr = (void __user *)fp->pc;
+               switch (trapnr) {
+               case VEC_CPLB_VL:
+               case VEC_MISALI_D:
+               case VEC_CPLB_M:
+               case VEC_CPLB_MHIT:
+                       info.si_addr = (void __user *)cpu_pda[cpu].dcplb_fault_addr;
+                       break;
+               default:
+                       info.si_addr = (void __user *)fp->pc;
+                       break;
+               }
                force_sig_info(sig, &info, current);
        }