1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 21965aae3SH. Peter Anvin #ifndef _ASM_X86_TRAPS_H 31965aae3SH. Peter Anvin #define _ASM_X86_TRAPS_H 4bb898558SAl Viro 595927475SAndy Lutomirski #include <linux/context_tracking_state.h> 65cec93c2SAndy Lutomirski #include <linux/kprobes.h> 75cec93c2SAndy Lutomirski 8bb898558SAl Viro #include <asm/debugreg.h> 953aaf262SThomas Gleixner #include <asm/idtentry.h> 10a2bcd473SIngo Molnar #include <asm/siginfo.h> /* TRAP_TRACE, ... */ 1105a2fdf3SJoerg Roedel #include <asm/trap_pf.h> 12bb898558SAl Viro 133ba4f0a6SThomas Gleixner #ifdef CONFIG_X86_64 143ba4f0a6SThomas Gleixner asmlinkage __visible notrace struct pt_regs *sync_regs(struct pt_regs *eregs); 153ba4f0a6SThomas Gleixner asmlinkage __visible notrace 163ba4f0a6SThomas Gleixner struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s); 173ba4f0a6SThomas Gleixner void __init trap_init(void); 18a13644f3SJoerg Roedel asmlinkage __visible noinstr struct pt_regs *vc_switch_off_ist(struct pt_regs *eregs); 193ba4f0a6SThomas Gleixner #endif 203ba4f0a6SThomas Gleixner 2149893c5cSThomas Gleixner #ifdef CONFIG_X86_F00F_BUG 2249893c5cSThomas Gleixner /* For handling the FOOF bug */ 2349893c5cSThomas Gleixner void handle_invalid_op(struct pt_regs *regs); 2449893c5cSThomas Gleixner #endif 2549893c5cSThomas Gleixner 26bb898558SAl Viro static inline int get_si_code(unsigned long condition) 27bb898558SAl Viro { 28bb898558SAl Viro if (condition & DR_STEP) 29bb898558SAl Viro return TRAP_TRACE; 30bb898558SAl Viro else if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) 31bb898558SAl Viro return TRAP_HWBKPT; 32bb898558SAl Viro else 33bb898558SAl Viro return TRAP_BRKPT; 34bb898558SAl Viro } 35bb898558SAl Viro 36bb898558SAl Viro extern int panic_on_unrecovered_nmi; 37bb898558SAl Viro 38d315760fSTejun Heo void math_emulate(struct math_emu_info *); 39bb898558SAl Viro 406271cfdfSAndy Lutomirski #ifdef CONFIG_VMAP_STACK 416271cfdfSAndy Lutomirski void __noreturn handle_stack_overflow(const char *message, 426271cfdfSAndy Lutomirski struct pt_regs *regs, 436271cfdfSAndy Lutomirski unsigned long fault_address); 446271cfdfSAndy Lutomirski #endif 456271cfdfSAndy Lutomirski 461965aae3SH. Peter Anvin #endif /* _ASM_X86_TRAPS_H */ 47