projects/linux·blob master · refs

61 lines · 1.5 KiB

1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __S390_EXTABLE_H
3#define __S390_EXTABLE_H
4
5#include <asm/ptrace.h>
6#include <linux/compiler.h>
7
8/**
9 * struct exception_table_entry - entry in exception table
10 * @insn: Relative pointer to faulting instruction
11 * @fixup: Relative pointer to instruction where execution resumes
12 * @type: Exception type
13 * @data: handler-specific data
14 */
15struct exception_table_entry {
16 int insn, fixup;
17 short type, data;
18};
19
20extern struct exception_table_entry *__start_amode31_ex_table;
21extern struct exception_table_entry *__stop_amode31_ex_table;
22
23const struct exception_table_entry *s390_search_extables(unsigned long addr);
24
25static inline unsigned long extable_fixup(const struct exception_table_entry *x)
26{
27 return (unsigned long)&x->fixup + x->fixup;
28}
29
30#define ARCH_HAS_RELATIVE_EXTABLE
31
32static inline void swap_ex_entry_fixup(struct exception_table_entry *a,
33 struct exception_table_entry *b,
34 struct exception_table_entry tmp,
35 int delta)
36{
37 a->fixup = b->fixup + delta;
38 b->fixup = tmp.fixup - delta;
39 a->type = b->type;
40 b->type = tmp.type;
41 a->data = b->data;
42 b->data = tmp.data;
43}
44#define swap_ex_entry_fixup swap_ex_entry_fixup
45
46#ifdef CONFIG_BPF_JIT
47
48bool ex_handler_bpf(const struct exception_table_entry *ex, struct pt_regs *regs);
49
50#else /* !CONFIG_BPF_JIT */
51
52static inline bool ex_handler_bpf(const struct exception_table_entry *ex, struct pt_regs *regs)
53{
54 return false;
55}
56
57#endif /* CONFIG_BPF_JIT */
58
59bool fixup_exception(struct pt_regs *regs);
60
61#endif