This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / kernel / panic.c
index 3c1581e..290bf0d 100644 (file)
 #include <linux/syscalls.h>
 #include <linux/interrupt.h>
 #include <linux/nmi.h>
+#ifdef CONFIG_KEXEC
+#include <linux/kexec.h>
+#endif
 
 int panic_timeout;
 int panic_on_oops;
 int tainted;
+void (*dump_function_ptr)(const char *, const struct pt_regs *) = 0;
 
 EXPORT_SYMBOL(panic_timeout);
+EXPORT_SYMBOL(dump_function_ptr);
 
 struct notifier_block *panic_notifier_list;
 
@@ -37,6 +42,9 @@ static int __init panic_setup(char *str)
 }
 __setup("panic=", panic_setup);
 
+int netdump_mode = 0;
+EXPORT_SYMBOL_GPL(netdump_mode);
+
 /**
  *     panic - halt the system
  *     @fmt: The text string to print
@@ -59,7 +67,10 @@ NORET_TYPE void panic(const char * fmt, ...)
        va_start(args, fmt);
        vsnprintf(buf, sizeof(buf), fmt, args);
        va_end(args);
+
        printk(KERN_EMERG "Kernel panic: %s\n",buf);
+       if (netdump_func)
+               BUG();
        if (in_interrupt())
                printk(KERN_EMERG "In interrupt handler - not syncing\n");
        else if (!current->pid)
@@ -68,20 +79,30 @@ NORET_TYPE void panic(const char * fmt, ...)
                sys_sync();
        bust_spinlocks(0);
 
+        notifier_call_chain(&panic_notifier_list, 0, buf);
+       
 #ifdef CONFIG_SMP
        smp_send_stop();
 #endif
 
-       notifier_call_chain(&panic_notifier_list, 0, buf);
-
-       if (panic_timeout > 0)
-       {
+       if (panic_timeout > 0) {
                int i;
                /*
                 * Delay timeout seconds before rebooting the machine. 
                 * We can't use the "normal" timers since we just panicked..
                 */
                printk(KERN_EMERG "Rebooting in %d seconds..",panic_timeout);
+#ifdef CONFIG_KEXEC
+{              
+               struct kimage *image;
+               image = xchg(&kexec_image, 0);
+               if (image) {
+                       printk(KERN_EMERG "by starting a new kernel ..\n");
+                       mdelay(panic_timeout*1000);
+                       machine_kexec(image);
+               }
+ }
+#endif
                for (i = 0; i < panic_timeout; i++) {
                        touch_nmi_watchdog();
                        mdelay(1000);