blob: 0012d0902c5f1c38dca380413b1f79becb9ad204 [file] [log] [blame]
H. Peter Anvin1965aae2008-10-22 22:26:29 -07001#ifndef _ASM_X86_TRAPS_H
2#define _ASM_X86_TRAPS_H
Jaswinder Singh6ac8d512008-07-15 21:09:13 +05303
Andy Lutomirski5cec93c2011-06-05 13:50:24 -04004#include <linux/kprobes.h>
5
Srinivasa Dse8d3f452008-09-23 15:23:52 +05306#include <asm/debugreg.h>
Ingo Molnara2bcd472009-03-29 23:47:48 +02007#include <asm/siginfo.h> /* TRAP_TRACE, ... */
Srinivasa Dse8d3f452008-09-23 15:23:52 +05308
Alexander van Heukelume407d6202008-09-30 18:41:36 +02009#ifdef CONFIG_X86_32
10#define dotraplinkage
11#else
12#define dotraplinkage asmlinkage
13#endif
14
Jaswinder Singh6ac8d512008-07-15 21:09:13 +053015asmlinkage void divide_error(void);
16asmlinkage void debug(void);
17asmlinkage void nmi(void);
18asmlinkage void int3(void);
Jeremy Fitzhardinge6cac5a92009-03-29 19:56:29 -070019asmlinkage void xen_debug(void);
20asmlinkage void xen_int3(void);
21asmlinkage void xen_stack_segment(void);
Jaswinder Singh6ac8d512008-07-15 21:09:13 +053022asmlinkage void overflow(void);
23asmlinkage void bounds(void);
24asmlinkage void invalid_op(void);
25asmlinkage void device_not_available(void);
Alexander van Heukelume407d6202008-09-30 18:41:36 +020026#ifdef CONFIG_X86_64
27asmlinkage void double_fault(void);
28#endif
Jaswinder Singh6ac8d512008-07-15 21:09:13 +053029asmlinkage void coprocessor_segment_overrun(void);
30asmlinkage void invalid_TSS(void);
31asmlinkage void segment_not_present(void);
32asmlinkage void stack_segment(void);
33asmlinkage void general_protection(void);
34asmlinkage void page_fault(void);
Gleb Natapov631bc482010-10-14 11:22:52 +020035asmlinkage void async_page_fault(void);
Jaswinder Singh6ac8d512008-07-15 21:09:13 +053036asmlinkage void spurious_interrupt_bug(void);
Alexander van Heukelume407d6202008-09-30 18:41:36 +020037asmlinkage void coprocessor_error(void);
38asmlinkage void alignment_check(void);
Jaswinder Singh6ac8d512008-07-15 21:09:13 +053039#ifdef CONFIG_X86_MCE
40asmlinkage void machine_check(void);
41#endif /* CONFIG_X86_MCE */
Alexander van Heukelume407d6202008-09-30 18:41:36 +020042asmlinkage void simd_coprocessor_error(void);
Jaswinder Singh6ac8d512008-07-15 21:09:13 +053043
Alexander van Heukelume407d6202008-09-30 18:41:36 +020044dotraplinkage void do_divide_error(struct pt_regs *, long);
45dotraplinkage void do_debug(struct pt_regs *, long);
46dotraplinkage void do_nmi(struct pt_regs *, long);
47dotraplinkage void do_int3(struct pt_regs *, long);
48dotraplinkage void do_overflow(struct pt_regs *, long);
49dotraplinkage void do_bounds(struct pt_regs *, long);
50dotraplinkage void do_invalid_op(struct pt_regs *, long);
Brian Gerstaa78bcf2009-02-10 09:51:45 -050051dotraplinkage void do_device_not_available(struct pt_regs *, long);
Alexander van Heukelume407d6202008-09-30 18:41:36 +020052dotraplinkage void do_coprocessor_segment_overrun(struct pt_regs *, long);
53dotraplinkage void do_invalid_TSS(struct pt_regs *, long);
54dotraplinkage void do_segment_not_present(struct pt_regs *, long);
55dotraplinkage void do_stack_segment(struct pt_regs *, long);
Jaswinder Singhd1769d52008-12-19 00:03:56 +053056#ifdef CONFIG_X86_64
57dotraplinkage void do_double_fault(struct pt_regs *, long);
58asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *);
59#endif
Alexander van Heukelume407d6202008-09-30 18:41:36 +020060dotraplinkage void do_general_protection(struct pt_regs *, long);
61dotraplinkage void do_page_fault(struct pt_regs *, unsigned long);
62dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *, long);
63dotraplinkage void do_coprocessor_error(struct pt_regs *, long);
64dotraplinkage void do_alignment_check(struct pt_regs *, long);
65#ifdef CONFIG_X86_MCE
66dotraplinkage void do_machine_check(struct pt_regs *, long);
67#endif
68dotraplinkage void do_simd_coprocessor_error(struct pt_regs *, long);
69#ifdef CONFIG_X86_32
70dotraplinkage void do_iret_error(struct pt_regs *, long);
71#endif
Jaswinder Singh6ac8d512008-07-15 21:09:13 +053072
Srinivasa Dsda654b72008-09-23 15:23:52 +053073static inline int get_si_code(unsigned long condition)
74{
75 if (condition & DR_STEP)
76 return TRAP_TRACE;
77 else if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3))
78 return TRAP_HWBKPT;
79 else
80 return TRAP_BRKPT;
81}
82
Jaswinder Singh6ac8d512008-07-15 21:09:13 +053083extern int panic_on_unrecovered_nmi;
Jaswinder Singh6ac8d512008-07-15 21:09:13 +053084
Brian Gerst9b6dba92010-03-21 09:00:44 -040085void math_error(struct pt_regs *, int, int);
Tejun Heod3157602009-02-09 22:17:39 +090086void math_emulate(struct math_emu_info *);
Akinobu Mitafde03122009-07-19 00:09:56 +090087#ifndef CONFIG_X86_32
Jaswinder Singhd1769d52008-12-19 00:03:56 +053088asmlinkage void smp_thermal_interrupt(void);
89asmlinkage void mce_threshold_interrupt(void);
Alexander van Heukelume407d6202008-09-30 18:41:36 +020090#endif
Jaswinder Singh6ac8d512008-07-15 21:09:13 +053091
H. Peter Anvin1965aae2008-10-22 22:26:29 -070092#endif /* _ASM_X86_TRAPS_H */