diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2022-05-13 17:11:14 +0200 |
---|---|---|
committer | Max Filippov <jcmvbkbc@gmail.com> | 2022-05-17 12:35:43 +0200 |
commit | 5cc5f19f884a75f0bf96b95b4292fcc81effd755 (patch) | |
tree | a751a2cec798c43780f333a1bd2d4d2583833c07 /arch/xtensa/kernel/traps.c | |
parent | xtensa: support artificial division by 0 exception (diff) | |
download | linux-5cc5f19f884a75f0bf96b95b4292fcc81effd755.tar.xz linux-5cc5f19f884a75f0bf96b95b4292fcc81effd755.zip |
xtensa: improve call0 ABI probing
When call0 userspace ABI support by probing is enabled instructions that
cause illegal instruction exception when PS.WOE is clear are retried
with PS.WOE set before calling c-level exception handler. Record user pc
at which PS.WOE was set in the fast exception handler and clear PS.WOE
in the c-level exception handler if we get there from the same address.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'arch/xtensa/kernel/traps.c')
-rw-r--r-- | arch/xtensa/kernel/traps.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c index 2b75b252b626..f97d43a8d13d 100644 --- a/arch/xtensa/kernel/traps.c +++ b/arch/xtensa/kernel/traps.c @@ -317,6 +317,18 @@ static bool check_div0(struct pt_regs *regs) static void do_illegal_instruction(struct pt_regs *regs) { +#ifdef CONFIG_USER_ABI_CALL0_PROBE + /* + * When call0 application encounters an illegal instruction fast + * exception handler will attempt to set PS.WOE and retry failing + * instruction. + * If we get here we know that that instruction is also illegal + * with PS.WOE set, so it's not related to the windowed option + * hence PS.WOE may be cleared. + */ + if (regs->pc == current_thread_info()->ps_woe_fix_addr) + regs->ps &= ~PS_WOE_MASK; +#endif if (check_div0(regs)) { do_div0(regs); return; |