summaryrefslogtreecommitdiffstats
path: root/arch/s390/include
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2022-02-28 14:52:42 +0100
committerVasily Gorbik <gor@linux.ibm.com>2022-03-08 00:33:00 +0100
commit3d66718cd62d45f3210f047248eab9e76d227e47 (patch)
tree5f2aa9740d8a8dae078cade30935e59b94fb6497 /arch/s390/include
parents390/extable: add and use fixup_exception helper function (diff)
downloadlinux-3d66718cd62d45f3210f047248eab9e76d227e47.tar.xz
linux-3d66718cd62d45f3210f047248eab9e76d227e47.zip
s390/extable: convert to relative table with data
Follow arm64, riscv, and x86 and change extable layout to common "relative table with data". This allows to get rid of s390 specific code in sorttable.c. The main difference to before is that extable entries do not contain a relative function pointer anymore. Instead data and type fields are added. The type field is used to indicate which exception handler needs to be called, while the data field is currently unused. Acked-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/s390/include')
-rw-r--r--arch/s390/include/asm/asm-extable.h15
-rw-r--r--arch/s390/include/asm/extable.h36
2 files changed, 28 insertions, 23 deletions
diff --git a/arch/s390/include/asm/asm-extable.h b/arch/s390/include/asm/asm-extable.h
index 620390f17f0c..61484a5f1209 100644
--- a/arch/s390/include/asm/asm-extable.h
+++ b/arch/s390/include/asm/asm-extable.h
@@ -5,17 +5,22 @@
#include <linux/stringify.h>
#include <asm/asm-const.h>
-#define __EX_TABLE(_section, _fault, _target) \
+#define EX_TYPE_NONE 0
+#define EX_TYPE_FIXUP 1
+#define EX_TYPE_BPF 2
+
+#define __EX_TABLE(_section, _fault, _target, _type) \
stringify_in_c(.section _section,"a";) \
- stringify_in_c(.align 8;) \
+ stringify_in_c(.align 4;) \
stringify_in_c(.long (_fault) - .;) \
stringify_in_c(.long (_target) - .;) \
- stringify_in_c(.quad 0;) \
+ stringify_in_c(.short (_type);) \
+ stringify_in_c(.short 0;) \
stringify_in_c(.previous)
#define EX_TABLE(_fault, _target) \
- __EX_TABLE(__ex_table, _fault, _target)
+ __EX_TABLE(__ex_table, _fault, _target, EX_TYPE_FIXUP)
#define EX_TABLE_AMODE31(_fault, _target) \
- __EX_TABLE(.amode31.ex_table, _fault, _target)
+ __EX_TABLE(.amode31.ex_table, _fault, _target, EX_TYPE_FIXUP)
#endif /* __ASM_EXTABLE_H */
diff --git a/arch/s390/include/asm/extable.h b/arch/s390/include/asm/extable.h
index d39d7159832a..af6ba52743e9 100644
--- a/arch/s390/include/asm/extable.h
+++ b/arch/s390/include/asm/extable.h
@@ -25,7 +25,7 @@
struct exception_table_entry
{
int insn, fixup;
- long handler;
+ short type, data;
};
extern struct exception_table_entry *__start_amode31_ex_table;
@@ -38,17 +38,6 @@ static inline unsigned long extable_fixup(const struct exception_table_entry *x)
return (unsigned long)&x->fixup + x->fixup;
}
-typedef bool (*ex_handler_t)(const struct exception_table_entry *,
- struct pt_regs *);
-
-static inline ex_handler_t
-ex_fixup_handler(const struct exception_table_entry *x)
-{
- if (likely(!x->handler))
- return NULL;
- return (ex_handler_t)((unsigned long)&x->handler + x->handler);
-}
-
#define ARCH_HAS_RELATIVE_EXTABLE
static inline void swap_ex_entry_fixup(struct exception_table_entry *a,
@@ -58,15 +47,26 @@ static inline void swap_ex_entry_fixup(struct exception_table_entry *a,
{
a->fixup = b->fixup + delta;
b->fixup = tmp.fixup - delta;
- a->handler = b->handler;
- if (a->handler)
- a->handler += delta;
- b->handler = tmp.handler;
- if (b->handler)
- b->handler -= delta;
+ a->type = b->type;
+ b->type = tmp.type;
+ a->data = b->data;
+ b->data = tmp.data;
}
#define swap_ex_entry_fixup swap_ex_entry_fixup
+#ifdef CONFIG_BPF_JIT
+
+bool ex_handler_bpf(const struct exception_table_entry *ex, struct pt_regs *regs);
+
+#else /* !CONFIG_BPF_JIT */
+
+static inline bool ex_handler_bpf(const struct exception_table_entry *ex, struct pt_regs *regs)
+{
+ return false;
+}
+
+#endif /* CONFIG_BPF_JIT */
+
bool fixup_exception(struct pt_regs *regs);
#endif