Merge git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-kgdb
[safe/jmp/linux-2.6] / arch / x86 / kernel / traps_64.c
index 4aa4520..79aa6fc 100644 (file)
@@ -33,6 +33,8 @@
 #include <linux/kdebug.h>
 #include <linux/utsname.h>
 
+#include <mach_traps.h>
+
 #if defined(CONFIG_EDAC)
 #include <linux/edac.h>
 #endif
@@ -84,7 +86,7 @@ static inline void conditional_sti(struct pt_regs *regs)
 
 static inline void preempt_conditional_sti(struct pt_regs *regs)
 {
-       preempt_disable();
+       inc_preempt_count();
        if (regs->flags & X86_EFLAGS_IF)
                local_irq_enable();
 }
@@ -95,20 +97,20 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
                local_irq_disable();
        /* Make sure to not schedule here because we could be running
           on an exception stack. */
-       preempt_enable_no_resched();
+       dec_preempt_count();
 }
 
 int kstack_depth_to_print = 12;
 
-#ifdef CONFIG_KALLSYMS
 void printk_address(unsigned long address, int reliable)
 {
+#ifdef CONFIG_KALLSYMS
        unsigned long offset = 0, symsize;
        const char *symname;
        char *modname;
        char *delim = ":";
-       char namebuf[128];
-       char reliab[4] = "";;
+       char namebuf[KSYM_NAME_LEN];
+       char reliab[4] = "";
 
        symname = kallsyms_lookup(address, &symsize, &offset,
                                        &modname, namebuf);
@@ -120,16 +122,13 @@ void printk_address(unsigned long address, int reliable)
                strcpy(reliab, "? ");
 
        if (!modname)
-               modname = delim = "";           
+               modname = delim = "";
        printk(" [<%016lx>] %s%s%s%s%s+0x%lx/0x%lx\n",
                address, reliab, delim, modname, delim, symname, offset, symsize);
-}
 #else
-void printk_address(unsigned long address, int reliable)
-{
        printk(" [<%016lx>]\n", address);
-}
 #endif
+}
 
 static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
                                        unsigned *usedp, char **idp)
@@ -603,8 +602,13 @@ void die(const char * str, struct pt_regs * regs, long err)
 
 void __kprobes die_nmi(char *str, struct pt_regs *regs, int do_panic)
 {
-       unsigned long flags = oops_begin();
+       unsigned long flags;
 
+       if (notify_die(DIE_NMIWATCHDOG, str, regs, 0, 2, SIGINT) ==
+           NOTIFY_STOP)
+               return;
+
+       flags = oops_begin();
        /*
         * We are in trouble anyway, lets at least try
         * to get a message out.
@@ -809,6 +813,8 @@ io_check_error(unsigned char reason, struct pt_regs * regs)
 static __kprobes void
 unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
 {
+       if (notify_die(DIE_NMIUNKNOWN, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP)
+               return;
        printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x.\n",
                reason);
        printk(KERN_EMERG "Do you have a strange power saving mode enabled?\n");