extable.h (e8c328d7de03bf4d7a18e38ff87a7c12fdf8afb1) extable.h (d6e2cc56477538255160ed02fdb11b0da60356cc)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_EXTABLE_H
3#define __ASM_EXTABLE_H
4
5/*
6 * The exception table consists of pairs of relative offsets: the first
7 * is the relative offset to an instruction that is allowed to fault,
8 * and the second is the relative offset at which the program should

--- 4 unchanged lines hidden (view full) ---

13 * with the main instruction path. This means when everything is well,
14 * we don't even have to jump over them. Further, they do not intrude
15 * on our cache or tlb entries.
16 */
17
18struct exception_table_entry
19{
20 int insn, fixup;
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_EXTABLE_H
3#define __ASM_EXTABLE_H
4
5/*
6 * The exception table consists of pairs of relative offsets: the first
7 * is the relative offset to an instruction that is allowed to fault,
8 * and the second is the relative offset at which the program should

--- 4 unchanged lines hidden (view full) ---

13 * with the main instruction path. This means when everything is well,
14 * we don't even have to jump over them. Further, they do not intrude
15 * on our cache or tlb entries.
16 */
17
18struct exception_table_entry
19{
20 int insn, fixup;
21 short type, data;
21};
22
23#define ARCH_HAS_RELATIVE_EXTABLE
24
22};
23
24#define ARCH_HAS_RELATIVE_EXTABLE
25
26#define swap_ex_entry_fixup(a, b, tmp, delta) \
27do { \
28 (a)->fixup = (b)->fixup + (delta); \
29 (b)->fixup = (tmp).fixup - (delta); \
30 (a)->type = (b)->type; \
31 (b)->type = (tmp).type; \
32 (a)->data = (b)->data; \
33 (b)->data = (tmp).data; \
34} while (0)
35
25static inline bool in_bpf_jit(struct pt_regs *regs)
26{
27 if (!IS_ENABLED(CONFIG_BPF_JIT))
28 return false;
29
30 return regs->pc >= BPF_JIT_REGION_START &&
31 regs->pc < BPF_JIT_REGION_END;
32}
33
34#ifdef CONFIG_BPF_JIT
36static inline bool in_bpf_jit(struct pt_regs *regs)
37{
38 if (!IS_ENABLED(CONFIG_BPF_JIT))
39 return false;
40
41 return regs->pc >= BPF_JIT_REGION_START &&
42 regs->pc < BPF_JIT_REGION_END;
43}
44
45#ifdef CONFIG_BPF_JIT
35bool arm64_bpf_fixup_exception(const struct exception_table_entry *ex,
36 struct pt_regs *regs);
46bool ex_handler_bpf(const struct exception_table_entry *ex,
47 struct pt_regs *regs);
37#else /* !CONFIG_BPF_JIT */
38static inline
48#else /* !CONFIG_BPF_JIT */
49static inline
39bool arm64_bpf_fixup_exception(const struct exception_table_entry *ex,
40 struct pt_regs *regs)
50bool ex_handler_bpf(const struct exception_table_entry *ex,
51 struct pt_regs *regs)
41{
42 return false;
43}
44#endif /* !CONFIG_BPF_JIT */
45
46bool fixup_exception(struct pt_regs *regs);
47#endif
52{
53 return false;
54}
55#endif /* !CONFIG_BPF_JIT */
56
57bool fixup_exception(struct pt_regs *regs);
58#endif