Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __ASM_EXTABLE_H
0003 #define __ASM_EXTABLE_H
0004 
0005 /*
0006  * The exception table consists of pairs of relative offsets: the first
0007  * is the relative offset to an instruction that is allowed to fault,
0008  * and the second is the relative offset at which the program should
0009  * continue. No registers are modified, so it is entirely up to the
0010  * continuation code to figure out what to do.
0011  *
0012  * All the routines below use bits of fixup code that are out of line
0013  * with the main instruction path.  This means when everything is well,
0014  * we don't even have to jump over them.  Further, they do not intrude
0015  * on our cache or tlb entries.
0016  */
0017 
0018 struct exception_table_entry
0019 {
0020     int insn, fixup;
0021     short type, data;
0022 };
0023 
0024 #define ARCH_HAS_RELATIVE_EXTABLE
0025 
0026 #define swap_ex_entry_fixup(a, b, tmp, delta)       \
0027 do {                            \
0028     (a)->fixup = (b)->fixup + (delta);      \
0029     (b)->fixup = (tmp).fixup - (delta);     \
0030     (a)->type = (b)->type;              \
0031     (b)->type = (tmp).type;             \
0032     (a)->data = (b)->data;              \
0033     (b)->data = (tmp).data;             \
0034 } while (0)
0035 
0036 #ifdef CONFIG_BPF_JIT
0037 bool ex_handler_bpf(const struct exception_table_entry *ex,
0038             struct pt_regs *regs);
0039 #else /* !CONFIG_BPF_JIT */
0040 static inline
0041 bool ex_handler_bpf(const struct exception_table_entry *ex,
0042             struct pt_regs *regs)
0043 {
0044     return false;
0045 }
0046 #endif /* !CONFIG_BPF_JIT */
0047 
0048 bool fixup_exception(struct pt_regs *regs);
0049 #endif