4 * Copyright (C) 1991, 1992 Linus Torvalds
8 * This function is used through-out the kernel (including mm and fs)
9 * to indicate a major problem.
11 #include <linux/sched.h>
12 #include <linux/delay.h>
13 #include <linux/reboot.h>
14 #include <linux/init.h>
15 #include <linux/sysrq.h>
16 #include <linux/interrupt.h>
19 #include <asm/machvec.h>
22 asmlinkage
void sys_sync(void); /* it's really int */
23 extern void unblank_console(void);
26 int panic_timeout
= 0;
28 void __init
panic_setup(char *str
, int *ints
)
31 panic_timeout
= ints
[1];
34 NORET_TYPE
void panic(const char * fmt
, ...)
36 static char buf
[1024];
40 vsprintf(buf
, fmt
, args
);
42 printk(KERN_EMERG
"Kernel panic: %s\n",buf
);
43 if (current
== task
[0])
44 printk(KERN_EMERG
"In swapper task - not syncing\n");
45 else if (in_interrupt())
46 printk(KERN_EMERG
"In interrupt handler - not syncing\n");
55 if (panic_timeout
> 0)
58 * Delay timeout seconds before rebooting the machine.
59 * We can't use the "normal" timers since we just panicked..
61 printk(KERN_EMERG
"Rebooting in %d seconds..",panic_timeout
);
62 mdelay(panic_timeout
*1000);
64 * Should we run the reboot notifier. For the moment Im
65 * choosing not too. It might crash, be corrupt or do
66 * more harm than good for other reasons.
68 machine_restart(NULL
);
71 printk("Press L1-A to return to the boot prom\n");