diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2022-02-28 14:29:25 +0100 |
---|---|---|
committer | Vasily Gorbik <gor@linux.ibm.com> | 2022-03-08 00:33:00 +0100 |
commit | 46fee16f571250d6cef74af73ffd47512da981a2 (patch) | |
tree | 074b3194069d030927a944091daa36b63f4e8032 /arch/s390/mm | |
parent | cfa45c5e0d36b87f99e76f1060526eac032dd624 (diff) |
s390/extable: add and use fixup_exception helper function
Add and use fixup_exception helper function in order to remove the
duplicated exception handler fixup code at several places.
Reviewed-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/mm')
-rw-r--r-- | arch/s390/mm/extable.c | 15 | ||||
-rw-r--r-- | arch/s390/mm/fault.c | 7 |
2 files changed, 16 insertions, 6 deletions
diff --git a/arch/s390/mm/extable.c b/arch/s390/mm/extable.c index a4eb3d8aae7b..d6ca75570dcf 100644 --- a/arch/s390/mm/extable.c +++ b/arch/s390/mm/extable.c @@ -14,3 +14,18 @@ const struct exception_table_entry *s390_search_extables(unsigned long addr) num = __stop_amode31_ex_table - __start_amode31_ex_table; return search_extable(__start_amode31_ex_table, num, addr); } + +bool fixup_exception(struct pt_regs *regs) +{ + const struct exception_table_entry *ex; + ex_handler_t handler; + + ex = s390_search_extables(instruction_pointer(regs)); + if (!ex) + return false; + handler = ex_fixup_handler(ex); + if (unlikely(handler)) + return handler(ex, regs); + regs->psw.addr = extable_fixup(ex); + return true; +} diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index caa4ab0ff80a..e173b6187ad5 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c @@ -230,13 +230,8 @@ static noinline void do_sigsegv(struct pt_regs *regs, int si_code) static noinline void do_no_context(struct pt_regs *regs) { - const struct exception_table_entry *fixup; - - /* Are we prepared to handle this kernel fault? */ - fixup = s390_search_extables(regs->psw.addr); - if (fixup && ex_handle(fixup, regs)) + if (fixup_exception(regs)) return; - /* * Oops. The kernel tried to access some bad page. We'll have to * terminate things with extreme prejudice. |