]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/powerpc/kernel/traps.c
Merge branch 'akpm-current/current'
[karo-tx-linux.git] / arch / powerpc / kernel / traps.c
index 33c47fcc455aed6df8819d60f0bb939750379fb1..9229ba63c37086a86af0a4b17dcde17012eff732 100644 (file)
@@ -1147,6 +1147,7 @@ void __kprobes program_check_exception(struct pt_regs *regs)
                goto bail;
        }
        if (reason & REASON_TRAP) {
+               unsigned long bugaddr;
                /* Debugger is first in line to stop recursive faults in
                 * rcu_lock, notify_die, or atomic_notifier_call_chain */
                if (debugger_bpt(regs))
@@ -1157,8 +1158,15 @@ void __kprobes program_check_exception(struct pt_regs *regs)
                                == NOTIFY_STOP)
                        goto bail;
 
+               bugaddr = regs->nip;
+               /*
+                * Fixup bugaddr for BUG_ON() in real mode
+                */
+               if (!is_kernel_addr(bugaddr) && !(regs->msr & MSR_IR))
+                       bugaddr += PAGE_OFFSET;
+
                if (!(regs->msr & MSR_PR) &&  /* not user-mode */
-                   report_bug(regs->nip, regs) == BUG_TRAP_TYPE_WARN) {
+                   report_bug(bugaddr, regs) == BUG_TRAP_TYPE_WARN) {
                        regs->nip += 4;
                        goto bail;
                }
@@ -1393,7 +1401,7 @@ void facility_unavailable_exception(struct pt_regs *regs)
                 * is a read DSCR attempt through a mfspr instruction, we
                 * just emulate the instruction instead. This code path will
                 * always emulate all the mfspr instructions till the user
-                * has attempted atleast one mtspr instruction. This way it
+                * has attempted at least one mtspr instruction. This way it
                 * preserves the same behaviour when the user is accessing
                 * the DSCR through privilege level only SPR number (0x11)
                 * which is emulated through illegal instruction exception.