sh: nmi_debug support.
[safe/jmp/linux-2.6] / arch / sh / kernel / traps.c
index f69bd96..a8396f3 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/signal.h>
 #include <linux/sched.h>
 #include <linux/uaccess.h>
+#include <linux/hardirq.h>
 #include <asm/unwinder.h>
 #include <asm/system.h>
 
@@ -91,3 +92,23 @@ BUILD_TRAP_HANDLER(bug)
 
        force_sig(SIGTRAP, current);
 }
+
+BUILD_TRAP_HANDLER(nmi)
+{
+       TRAP_HANDLER_DECL;
+
+       nmi_enter();
+
+       switch (notify_die(DIE_NMI, "NMI", regs, 0, vec & 0xff, SIGINT)) {
+       case NOTIFY_OK:
+       case NOTIFY_STOP:
+               break;
+       case NOTIFY_BAD:
+               die("Fatal Non-Maskable Interrupt", regs, SIGINT);
+       default:
+               printk(KERN_ALERT "Got NMI, but nobody cared. Ignoring...\n");
+               break;
+       }
+
+       nmi_exit();
+}