Linux Audio

Check our new training course

Loading...
v4.6
 
  1#ifndef _ASM_X86_TRAPS_H
  2#define _ASM_X86_TRAPS_H
  3
  4#include <linux/context_tracking_state.h>
  5#include <linux/kprobes.h>
  6
  7#include <asm/debugreg.h>
 
  8#include <asm/siginfo.h>			/* TRAP_TRACE, ... */
 
  9
 10#define dotraplinkage __visible
 11
 12asmlinkage void divide_error(void);
 13asmlinkage void debug(void);
 14asmlinkage void nmi(void);
 15asmlinkage void int3(void);
 16asmlinkage void xen_debug(void);
 17asmlinkage void xen_int3(void);
 18asmlinkage void xen_stack_segment(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);
 31asmlinkage void page_fault(void);
 32asmlinkage void async_page_fault(void);
 33asmlinkage void spurious_interrupt_bug(void);
 34asmlinkage void coprocessor_error(void);
 35asmlinkage void alignment_check(void);
 36#ifdef CONFIG_X86_MCE
 37asmlinkage void machine_check(void);
 38#endif /* CONFIG_X86_MCE */
 39asmlinkage void simd_coprocessor_error(void);
 40
 41#ifdef CONFIG_TRACING
 42asmlinkage void trace_page_fault(void);
 43#define trace_stack_segment stack_segment
 44#define trace_divide_error divide_error
 45#define trace_bounds bounds
 46#define trace_invalid_op invalid_op
 47#define trace_device_not_available device_not_available
 48#define trace_coprocessor_segment_overrun coprocessor_segment_overrun
 49#define trace_invalid_TSS invalid_TSS
 50#define trace_segment_not_present segment_not_present
 51#define trace_general_protection general_protection
 52#define trace_spurious_interrupt_bug spurious_interrupt_bug
 53#define trace_coprocessor_error coprocessor_error
 54#define trace_alignment_check alignment_check
 55#define trace_simd_coprocessor_error simd_coprocessor_error
 56#define trace_async_page_fault async_page_fault
 57#endif
 58
 59dotraplinkage void do_divide_error(struct pt_regs *, long);
 60dotraplinkage void do_debug(struct pt_regs *, long);
 61dotraplinkage void do_nmi(struct pt_regs *, long);
 62dotraplinkage void do_int3(struct pt_regs *, long);
 63dotraplinkage void do_overflow(struct pt_regs *, long);
 64dotraplinkage void do_bounds(struct pt_regs *, long);
 65dotraplinkage void do_invalid_op(struct pt_regs *, long);
 66dotraplinkage void do_device_not_available(struct pt_regs *, long);
 67dotraplinkage void do_coprocessor_segment_overrun(struct pt_regs *, long);
 68dotraplinkage void do_invalid_TSS(struct pt_regs *, long);
 69dotraplinkage void do_segment_not_present(struct pt_regs *, long);
 70dotraplinkage void do_stack_segment(struct pt_regs *, long);
 71#ifdef CONFIG_X86_64
 72dotraplinkage void do_double_fault(struct pt_regs *, long);
 73asmlinkage struct pt_regs *sync_regs(struct pt_regs *);
 74#endif
 75dotraplinkage void do_general_protection(struct pt_regs *, long);
 76dotraplinkage void do_page_fault(struct pt_regs *, unsigned long);
 77#ifdef CONFIG_TRACING
 78dotraplinkage void trace_do_page_fault(struct pt_regs *, unsigned long);
 79#else
 80static inline void trace_do_page_fault(struct pt_regs *regs, unsigned long error)
 81{
 82	do_page_fault(regs, error);
 83}
 84#endif
 85dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *, long);
 86dotraplinkage void do_coprocessor_error(struct pt_regs *, long);
 87dotraplinkage void do_alignment_check(struct pt_regs *, long);
 88#ifdef CONFIG_X86_MCE
 89dotraplinkage void do_machine_check(struct pt_regs *, long);
 90#endif
 91dotraplinkage void do_simd_coprocessor_error(struct pt_regs *, long);
 92#ifdef CONFIG_X86_32
 93dotraplinkage void do_iret_error(struct pt_regs *, long);
 94#endif
 95
 96static inline int get_si_code(unsigned long condition)
 97{
 98	if (condition & DR_STEP)
 99		return TRAP_TRACE;
100	else if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3))
101		return TRAP_HWBKPT;
102	else
103		return TRAP_BRKPT;
104}
105
106extern int panic_on_unrecovered_nmi;
107
108void math_emulate(struct math_emu_info *);
109#ifndef CONFIG_X86_32
110asmlinkage void smp_thermal_interrupt(void);
111asmlinkage void smp_threshold_interrupt(void);
112asmlinkage void smp_deferred_error_interrupt(void);
 
 
 
113#endif
114
115extern void ist_enter(struct pt_regs *regs);
116extern void ist_exit(struct pt_regs *regs);
117extern void ist_begin_non_atomic(struct pt_regs *regs);
118extern void ist_end_non_atomic(void);
119
120/* Interrupts/Exceptions */
121enum {
122	X86_TRAP_DE = 0,	/*  0, Divide-by-zero */
123	X86_TRAP_DB,		/*  1, Debug */
124	X86_TRAP_NMI,		/*  2, Non-maskable Interrupt */
125	X86_TRAP_BP,		/*  3, Breakpoint */
126	X86_TRAP_OF,		/*  4, Overflow */
127	X86_TRAP_BR,		/*  5, Bound Range Exceeded */
128	X86_TRAP_UD,		/*  6, Invalid Opcode */
129	X86_TRAP_NM,		/*  7, Device Not Available */
130	X86_TRAP_DF,		/*  8, Double Fault */
131	X86_TRAP_OLD_MF,	/*  9, Coprocessor Segment Overrun */
132	X86_TRAP_TS,		/* 10, Invalid TSS */
133	X86_TRAP_NP,		/* 11, Segment Not Present */
134	X86_TRAP_SS,		/* 12, Stack Segment Fault */
135	X86_TRAP_GP,		/* 13, General Protection Fault */
136	X86_TRAP_PF,		/* 14, Page Fault */
137	X86_TRAP_SPURIOUS,	/* 15, Spurious Interrupt */
138	X86_TRAP_MF,		/* 16, x87 Floating-Point Exception */
139	X86_TRAP_AC,		/* 17, Alignment Check */
140	X86_TRAP_MC,		/* 18, Machine Check */
141	X86_TRAP_XF,		/* 19, SIMD Floating-Point Exception */
142	X86_TRAP_IRET = 32,	/* 32, IRET Exception */
143};
144
145#endif /* _ASM_X86_TRAPS_H */
v6.8
 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 pt_regs *fixup_bad_iret(struct pt_regs *bad_regs);
17asmlinkage __visible noinstr struct pt_regs *vc_switch_off_ist(struct pt_regs *eregs);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18#endif
19
20extern int ibt_selftest(void);
21extern int ibt_selftest_noendbr(void);
22
23#ifdef CONFIG_X86_F00F_BUG
24/* For handling the FOOF bug */
25void handle_invalid_op(struct pt_regs *regs);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26#endif
27
28static inline int get_si_code(unsigned long condition)
29{
30	if (condition & DR_STEP)
31		return TRAP_TRACE;
32	else if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3))
33		return TRAP_HWBKPT;
34	else
35		return TRAP_BRKPT;
36}
37
38extern int panic_on_unrecovered_nmi;
39
40void math_emulate(struct math_emu_info *);
41
42bool fault_in_kernel_space(unsigned long address);
43
44#ifdef CONFIG_VMAP_STACK
45void __noreturn handle_stack_overflow(struct pt_regs *regs,
46				      unsigned long fault_address,
47				      struct stack_info *info);
48#endif
49
50static inline void cond_local_irq_enable(struct pt_regs *regs)
51{
52	if (regs->flags & X86_EFLAGS_IF)
53		local_irq_enable();
54}
55
56static inline void cond_local_irq_disable(struct pt_regs *regs)
57{
58	if (regs->flags & X86_EFLAGS_IF)
59		local_irq_disable();
60}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
62#endif /* _ASM_X86_TRAPS_H */