1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _ASM_X86_TRAPS_H 3#define _ASM_X86_TRAPS_H 4 5#include <linux/context_tracking_state.h> 6#include <linux/kprobes.h> 7 8#include <asm/debugreg.h> 9#include <asm/idtentry.h> 10#include <asm/siginfo.h> /* TRAP_TRACE, ... */ 11#include <asm/trap_pf.h> 12 13#ifdef CONFIG_X86_64 14asmlinkage __visible notrace struct pt_regs *sync_regs(struct pt_regs *eregs); 15asmlinkage __visible notrace 16struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s); 17void __init trap_init(void); 18asmlinkage __visible noinstr struct pt_regs *vc_switch_off_ist(struct pt_regs *eregs); 19#endif 20 21#ifdef CONFIG_X86_F00F_BUG 22/* For handling the FOOF bug */ 23void handle_invalid_op(struct pt_regs *regs); 24#endif 25 26static inline int get_si_code(unsigned long condition) 27{ 28 if (condition & DR_STEP) 29 return TRAP_TRACE; 30 else if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) 31 return TRAP_HWBKPT; 32 else 33 return TRAP_BRKPT; 34} 35 36extern int panic_on_unrecovered_nmi; 37 38void math_emulate(struct math_emu_info *); 39 40bool fault_in_kernel_space(unsigned long address); 41 42#ifdef CONFIG_VMAP_STACK 43void __noreturn handle_stack_overflow(const char *message, 44 struct pt_regs *regs, 45 unsigned long fault_address); 46#endif 47 48#endif /* _ASM_X86_TRAPS_H */ 49