debuggers.hg

view unmodified_drivers/linux-2.6/platform-pci/panic-handler.c @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children 5c0bf00e371d
line source
1 #include <linux/module.h>
2 #include <linux/init.h>
3 #include <linux/notifier.h>
4 #include <asm/hypervisor.h>
6 MODULE_LICENSE("GPL");
8 #ifdef __ia64__
9 static void
10 xen_panic_hypercall(struct unw_frame_info *info, void *arg)
11 {
12 current->thread.ksp = (__u64)info->sw - 16;
13 HYPERVISOR_shutdown(SHUTDOWN_crash);
14 /* we're never actually going to get here... */
15 }
16 #endif
18 static int
19 xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
20 {
21 #ifdef __ia64__
22 unw_init_running(xen_panic_hypercall, NULL);
23 #else /* !__ia64__ */
24 HYPERVISOR_shutdown(SHUTDOWN_crash);
25 #endif
26 /* we're never actually going to get here... */
27 return NOTIFY_DONE;
28 }
29 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
30 static struct notifier_block xen_panic_block = {
31 xen_panic_event, NULL, 0 /* try to go last */
32 };
33 #else
34 static struct notifier_block xen_panic_block = {
35 .notifier_call= xen_panic_event,
36 .next= NULL,
37 .priority= 0/* try to go last */
38 };
39 #endif /*LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)*/
41 static int __init setup_panic_event(void)
42 {
43 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
44 notifier_chain_register(&panic_notifier_list, &xen_panic_block);
45 #else
46 atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block);
47 #endif /*LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)*/
48 return 0;
49 }
51 int xen_panic_handler_init(void)
52 {
53 return setup_panic_event();
54 }