traps.h 1.3 KB

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