linux/arch/x86/include/asm/traps.h
<<
>>
Prefs
   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/siginfo.h>                        /* TRAP_TRACE, ... */
  10#include <asm/trap_pf.h>
  11#include <asm/trapnr.h>
  12
  13#define dotraplinkage __visible
  14
  15asmlinkage void divide_error(void);
  16asmlinkage void debug(void);
  17asmlinkage void nmi(void);
  18asmlinkage void int3(void);
  19asmlinkage void overflow(void);
  20asmlinkage void bounds(void);
  21asmlinkage void invalid_op(void);
  22asmlinkage void device_not_available(void);
  23#ifdef CONFIG_X86_64
  24asmlinkage void double_fault(void);
  25#endif
  26asmlinkage void coprocessor_segment_overrun(void);
  27asmlinkage void invalid_TSS(void);
  28asmlinkage void segment_not_present(void);
  29asmlinkage void stack_segment(void);
  30asmlinkage void general_protection(void);
  31#if IS_ENABLED(CONFIG_KVM_INTEL)
  32asmlinkage void nmi_noist(void);
  33#endif
  34asmlinkage void page_fault(void);
  35asmlinkage void async_page_fault(void);
  36asmlinkage void spurious_interrupt_bug(void);
  37asmlinkage void coprocessor_error(void);
  38asmlinkage void alignment_check(void);
  39#ifdef CONFIG_X86_MCE
  40asmlinkage void machine_check(void);
  41#endif /* CONFIG_X86_MCE */
  42asmlinkage void simd_coprocessor_error(void);
  43#ifdef CONFIG_AMD_MEM_ENCRYPT
  44asmlinkage void vmm_communication(void);
  45#endif
  46
  47#if defined(CONFIG_X86_64) && defined(CONFIG_XEN_PV)
  48asmlinkage void xen_divide_error(void);
  49asmlinkage void xen_xennmi(void);
  50asmlinkage void xen_xendebug(void);
  51asmlinkage void xen_xenint3(void);
  52asmlinkage void xen_overflow(void);
  53asmlinkage void xen_bounds(void);
  54asmlinkage void xen_invalid_op(void);
  55asmlinkage void xen_device_not_available(void);
  56asmlinkage void xen_double_fault(void);
  57asmlinkage void xen_coprocessor_segment_overrun(void);
  58asmlinkage void xen_invalid_TSS(void);
  59asmlinkage void xen_segment_not_present(void);
  60asmlinkage void xen_stack_segment(void);
  61asmlinkage void xen_general_protection(void);
  62asmlinkage void xen_page_fault(void);
  63asmlinkage void xen_spurious_interrupt_bug(void);
  64asmlinkage void xen_coprocessor_error(void);
  65asmlinkage void xen_alignment_check(void);
  66#ifdef CONFIG_X86_MCE
  67asmlinkage void xen_machine_check(void);
  68#endif /* CONFIG_X86_MCE */
  69asmlinkage void xen_simd_coprocessor_error(void);
  70#endif
  71
  72dotraplinkage void do_divide_error(struct pt_regs *regs, long error_code);
  73dotraplinkage void do_debug(struct pt_regs *regs, long error_code);
  74dotraplinkage void do_nmi(struct pt_regs *regs, long error_code);
  75dotraplinkage void do_int3(struct pt_regs *regs, long error_code);
  76dotraplinkage void do_overflow(struct pt_regs *regs, long error_code);
  77dotraplinkage void do_bounds(struct pt_regs *regs, long error_code);
  78dotraplinkage void do_invalid_op(struct pt_regs *regs, long error_code);
  79dotraplinkage void do_device_not_available(struct pt_regs *regs, long error_code);
  80dotraplinkage void do_coprocessor_segment_overrun(struct pt_regs *regs, long error_code);
  81dotraplinkage void do_invalid_TSS(struct pt_regs *regs, long error_code);
  82dotraplinkage void do_segment_not_present(struct pt_regs *regs, long error_code);
  83dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code);
  84#ifdef CONFIG_X86_64
  85dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code);
  86asmlinkage __visible notrace struct pt_regs *sync_regs(struct pt_regs *eregs);
  87asmlinkage __visible notrace
  88struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s);
  89void __init trap_init(void);
  90asmlinkage __visible noinstr struct pt_regs *vc_switch_off_ist(struct pt_regs *eregs);
  91#endif
  92dotraplinkage void do_general_protection(struct pt_regs *regs, long error_code);
  93dotraplinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code);
  94dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *regs, long error_code);
  95dotraplinkage void do_coprocessor_error(struct pt_regs *regs, long error_code);
  96dotraplinkage void do_alignment_check(struct pt_regs *regs, long error_code);
  97#ifdef CONFIG_X86_MCE
  98dotraplinkage void do_machine_check(struct pt_regs *regs, long error_code);
  99#endif
 100dotraplinkage void do_simd_coprocessor_error(struct pt_regs *regs, long error_code);
 101#ifdef CONFIG_X86_32
 102dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code);
 103#endif
 104dotraplinkage void do_mce(struct pt_regs *regs, long error_code);
 105#ifdef CONFIG_AMD_MEM_ENCRYPT
 106dotraplinkage void do_vmm_communication(struct pt_regs *, long);
 107#endif
 108
 109static inline int get_si_code(unsigned long condition)
 110{
 111        if (condition & DR_STEP)
 112                return TRAP_TRACE;
 113        else if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3))
 114                return TRAP_HWBKPT;
 115        else
 116                return TRAP_BRKPT;
 117}
 118
 119extern int panic_on_unrecovered_nmi;
 120
 121void math_emulate(struct math_emu_info *);
 122#ifndef CONFIG_X86_32
 123asmlinkage void smp_thermal_interrupt(struct pt_regs *regs);
 124asmlinkage void smp_threshold_interrupt(struct pt_regs *regs);
 125asmlinkage void smp_deferred_error_interrupt(struct pt_regs *regs);
 126#endif
 127
 128#ifdef CONFIG_VMAP_STACK
 129void __noreturn handle_stack_overflow(const char *message,
 130                                      struct pt_regs *regs,
 131                                      unsigned long fault_address);
 132#endif
 133
 134#endif /* _ASM_X86_TRAPS_H */
 135