xref: /linux/arch/x86/include/asm/extable.h (revision e58e871becec2d3b04ed91c0c16fe8deac9c9dfa)
1 #ifndef _ASM_X86_EXTABLE_H
2 #define _ASM_X86_EXTABLE_H
3 /*
4  * The exception table consists of triples of addresses relative to the
5  * exception table entry itself. The first address is of an instruction
6  * that is allowed to fault, the second is the target at which the program
7  * should continue. The third is a handler function to deal with the fault
8  * caused by the instruction in the first field.
9  *
10  * All the routines below use bits of fixup code that are out of line
11  * with the main instruction path.  This means when everything is well,
12  * we don't even have to jump over them.  Further, they do not intrude
13  * on our cache or tlb entries.
14  */
15 
16 struct exception_table_entry {
17 	int insn, fixup, handler;
18 };
19 struct pt_regs;
20 
21 #define ARCH_HAS_RELATIVE_EXTABLE
22 
23 #define swap_ex_entry_fixup(a, b, tmp, delta)			\
24 	do {							\
25 		(a)->fixup = (b)->fixup + (delta);		\
26 		(b)->fixup = (tmp).fixup - (delta);		\
27 		(a)->handler = (b)->handler + (delta);		\
28 		(b)->handler = (tmp).handler - (delta);		\
29 	} while (0)
30 
31 extern int fixup_exception(struct pt_regs *regs, int trapnr);
32 extern bool ex_has_fault_handler(unsigned long ip);
33 extern void early_fixup_exception(struct pt_regs *regs, int trapnr);
34 
35 #endif
36