/* SPDX-License-Identifier: GPL-2.0 */1#ifndef _ASM_LOONGARCH_EXTABLE_H2#define _ASM_LOONGARCH_EXTABLE_H34/*5* The exception table consists of pairs of relative offsets: the first6* is the relative offset to an instruction that is allowed to fault,7* and the second is the relative offset at which the program should8* continue. No registers are modified, so it is entirely up to the9* continuation code to figure out what to do.10*11* All the routines below use bits of fixup code that are out of line12* with the main instruction path. This means when everything is well,13* we don't even have to jump over them. Further, they do not intrude14* on our cache or tlb entries.15*/1617struct exception_table_entry {18int insn, fixup;19short type, data;20};2122#define ARCH_HAS_RELATIVE_EXTABLE2324#define swap_ex_entry_fixup(a, b, tmp, delta) \25do { \26(a)->fixup = (b)->fixup + (delta); \27(b)->fixup = (tmp).fixup - (delta); \28(a)->type = (b)->type; \29(b)->type = (tmp).type; \30(a)->data = (b)->data; \31(b)->data = (tmp).data; \32} while (0)3334#ifdef CONFIG_BPF_JIT35bool ex_handler_bpf(const struct exception_table_entry *ex, struct pt_regs *regs);36#else37static inline38bool ex_handler_bpf(const struct exception_table_entry *ex, struct pt_regs *regs)39{40return false;41}42#endif /* !CONFIG_BPF_JIT */4344bool fixup_exception(struct pt_regs *regs);4546#endif474849