0001
0002 #ifndef _ASM_X86_TRAPS_H
0003 #define _ASM_X86_TRAPS_H
0004
0005 #include <linux/context_tracking_state.h>
0006 #include <linux/kprobes.h>
0007
0008 #include <asm/debugreg.h>
0009 #include <asm/idtentry.h>
0010 #include <asm/siginfo.h> /* TRAP_TRACE, ... */
0011 #include <asm/trap_pf.h>
0012
0013 #ifdef CONFIG_X86_64
0014 asmlinkage __visible notrace struct pt_regs *sync_regs(struct pt_regs *eregs);
0015 asmlinkage __visible notrace
0016 struct pt_regs *fixup_bad_iret(struct pt_regs *bad_regs);
0017 void __init trap_init(void);
0018 asmlinkage __visible noinstr struct pt_regs *vc_switch_off_ist(struct pt_regs *eregs);
0019 #endif
0020
0021 extern bool ibt_selftest(void);
0022
0023 #ifdef CONFIG_X86_F00F_BUG
0024
0025 void handle_invalid_op(struct pt_regs *regs);
0026 #endif
0027
0028 static inline int get_si_code(unsigned long condition)
0029 {
0030 if (condition & DR_STEP)
0031 return TRAP_TRACE;
0032 else if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3))
0033 return TRAP_HWBKPT;
0034 else
0035 return TRAP_BRKPT;
0036 }
0037
0038 extern int panic_on_unrecovered_nmi;
0039
0040 void math_emulate(struct math_emu_info *);
0041
0042 bool fault_in_kernel_space(unsigned long address);
0043
0044 #ifdef CONFIG_VMAP_STACK
0045 void __noreturn handle_stack_overflow(struct pt_regs *regs,
0046 unsigned long fault_address,
0047 struct stack_info *info);
0048 #endif
0049
0050 #endif