1 #ifndef _X86_64_KDEBUG_H
2 #define _X86_64_KDEBUG_H 1
3 
4 #include <linux/notifier.h>
5 
6 struct pt_regs;
7 
8 struct die_args {
9 	struct pt_regs *regs;
10 	const char *str;
11 	long err;
12 	int trapnr;
13 	int signr;
14 };
15 
16 /* Note - you should never unregister because that can race with NMIs.
17    If you really want to do it use RCU infrastructure. */
18 extern struct notifier_block *die_chain;
19 
20 /* Grossly misnamed. */
21 enum die_val {
22 	DIE_OOPS = 1,
23 	DIE_INT3,
24 	DIE_DEBUG,
25 	DIE_PANIC,
26 	DIE_NMI,
27 	DIE_DIE,
28 	DIE_NMIWATCHDOG,
29 	DIE_KERNELDEBUG,
30 	DIE_TRAP,
31 	DIE_GPF,
32 	DIE_CALL,
33 };
34 
notify_die(enum die_val val,char * str,struct pt_regs * regs,long err,int trap,int sig)35 static inline int notify_die(enum die_val val,char *str,struct pt_regs *regs,long err,int trap,int sig)
36 {
37 	struct die_args args = { regs: regs, str: str, err: err, trapnr: trap,
38 	signr: sig};
39 	return notifier_call_chain(&die_chain, val, &args);
40 }
41 
42 extern int printk_address(unsigned long address);
43 extern void die(const char *,struct pt_regs *,long);
44 extern void __die(const char *,struct pt_regs *,long);
45 extern void show_stack(unsigned long* esp);
46 extern void show_registers(struct pt_regs *regs);
47 extern void dump_pagetable(unsigned long);
48 extern void prepare_die(unsigned long *flags);
49 extern void exit_die(unsigned long flags);
50 
51 #endif
52