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