summaryrefslogtreecommitdiff
path: root/arch/s390/mm/extable.c
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2022-02-28 14:29:25 +0100
committerVasily Gorbik <gor@linux.ibm.com>2022-03-08 00:33:00 +0100
commit46fee16f571250d6cef74af73ffd47512da981a2 (patch)
tree074b3194069d030927a944091daa36b63f4e8032 /arch/s390/mm/extable.c
parentcfa45c5e0d36b87f99e76f1060526eac032dd624 (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/extable.c')
-rw-r--r--arch/s390/mm/extable.c15
1 files changed, 15 insertions, 0 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;
+}