ia64/xen-unstable

view xen/common/shutdown.c @ 11731:74855cdc4a1d

[XEN] Never crash machine on int3 traps.
Do not enter debugger on dom0 shutdown unless dom0 crashed.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Oct 04 09:10:17 2006 +0100 (2006-10-04)
parents 16aa4b417c6b
children 1c85fe14169f
line source
1 #include <xen/config.h>
2 #include <xen/init.h>
3 #include <xen/lib.h>
4 #include <xen/sched.h>
5 #include <xen/domain.h>
6 #include <xen/delay.h>
7 #include <xen/shutdown.h>
8 #include <asm/debugger.h>
9 #include <public/sched.h>
11 /* opt_noreboot: If true, machine will need manual reset on error. */
12 int opt_noreboot;
13 boolean_param("noreboot", opt_noreboot);
15 static void maybe_reboot(void)
16 {
17 if ( opt_noreboot )
18 {
19 printk("'noreboot' set - not rebooting.\n");
20 machine_halt();
21 }
22 else
23 {
24 printk("rebooting machine in 5 seconds.\n");
25 watchdog_disable();
26 mdelay(5000);
27 machine_restart(NULL);
28 }
29 }
31 void dom0_shutdown(u8 reason)
32 {
33 switch ( reason )
34 {
35 case SHUTDOWN_poweroff:
36 {
37 printk("Domain 0 halted: halting machine.\n");
38 machine_halt();
39 break; /* not reached */
40 }
42 case SHUTDOWN_crash:
43 {
44 debugger_trap_immediate();
45 printk("Domain 0 crashed: ");
46 maybe_reboot();
47 break; /* not reached */
48 }
50 case SHUTDOWN_reboot:
51 {
52 printk("Domain 0 shutdown: rebooting machine.\n");
53 machine_restart(NULL);
54 break; /* not reached */
55 }
57 default:
58 {
59 printk("Domain 0 shutdown (unknown reason %u): ", reason);
60 maybe_reboot();
61 break; /* not reached */
62 }
63 }
64 }