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>
This commit is contained in:
Heiko Carstens
2022-02-28 14:29:25 +01:00
committed by Vasily Gorbik
parent cfa45c5e0d
commit 46fee16f57
6 changed files with 22 additions and 34 deletions

View File

@@ -151,12 +151,8 @@ static __init void setup_topology(void)
static void early_pgm_check_handler(struct pt_regs *regs)
{
const struct exception_table_entry *fixup;
fixup = s390_search_extables(regs->psw.addr);
if (!fixup)
if (!fixup_exception(regs))
disabled_wait();
regs->psw.addr = extable_fixup(fixup);
}
static noinline __init void setup_lowcore_early(void)

View File

@@ -465,7 +465,6 @@ static int kprobe_trap_handler(struct pt_regs *regs, int trapnr)
{
struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
struct kprobe *p = kprobe_running();
const struct exception_table_entry *entry;
switch(kcb->kprobe_status) {
case KPROBE_HIT_SS:
@@ -487,10 +486,8 @@ static int kprobe_trap_handler(struct pt_regs *regs, int trapnr)
* In case the user-specified fault handler returned
* zero, try to fix up.
*/
entry = s390_search_extables(regs->psw.addr);
if (entry && ex_handle(entry, regs))
if (fixup_exception(regs))
return 1;
/*
* fixup_exception() could not handle it,
* Let do_page_fault() fix it.

View File

@@ -54,9 +54,7 @@ void do_report_trap(struct pt_regs *regs, int si_signo, int si_code, char *str)
force_sig_fault(si_signo, si_code, get_trap_ip(regs));
report_user_fault(regs, si_signo, 0);
} else {
const struct exception_table_entry *fixup;
fixup = s390_search_extables(regs->psw.addr);
if (!fixup || !ex_handle(fixup, regs))
if (!fixup_exception(regs))
die(regs, str);
}
}
@@ -245,16 +243,12 @@ static void space_switch_exception(struct pt_regs *regs)
static void monitor_event_exception(struct pt_regs *regs)
{
const struct exception_table_entry *fixup;
if (user_mode(regs))
return;
switch (report_bug(regs->psw.addr - (regs->int_code >> 16), regs)) {
case BUG_TRAP_TYPE_NONE:
fixup = s390_search_extables(regs->psw.addr);
if (fixup)
ex_handle(fixup, regs);
fixup_exception(regs);
break;
case BUG_TRAP_TYPE_WARN:
break;