diff options
author | Amanieu d'Antras | 2020-05-11 15:11:17 +0200 |
---|---|---|
committer | Peter Maydell | 2020-05-21 23:05:27 +0200 |
commit | 45e2813964b135a11e0fb6371d2c5f48d901929e (patch) | |
tree | fd7eadade9a30a5e7a43b896b3effade58674dca /linux-user/arm | |
parent | target/arm: Allow user-mode code to write CPSR.E via MSR (diff) | |
download | qemu-45e2813964b135a11e0fb6371d2c5f48d901929e.tar.gz qemu-45e2813964b135a11e0fb6371d2c5f48d901929e.tar.xz qemu-45e2813964b135a11e0fb6371d2c5f48d901929e.zip |
linux-user/arm: Reset CPSR_E when entering a signal handler
This fixes signal handlers running with the wrong endianness if the
interrupted code used SETEND to dynamically switch endianness.
Signed-off-by: Amanieu d'Antras <amanieu@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20200511131117.2486486-1-amanieu@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'linux-user/arm')
-rw-r--r-- | linux-user/arm/signal.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c index 8020c80acb..698985a647 100644 --- a/linux-user/arm/signal.c +++ b/linux-user/arm/signal.c @@ -244,6 +244,11 @@ setup_return(CPUARMState *env, struct target_sigaction *ka, } else { cpsr &= ~CPSR_T; } + if (env->cp15.sctlr_el[1] & SCTLR_E0E) { + cpsr |= CPSR_E; + } else { + cpsr &= ~CPSR_E; + } if (ka->sa_flags & TARGET_SA_RESTORER) { if (is_fdpic) { @@ -287,7 +292,8 @@ setup_return(CPUARMState *env, struct target_sigaction *ka, env->regs[13] = frame_addr; env->regs[14] = retcode; env->regs[15] = handler & (thumb ? ~1 : ~3); - cpsr_write(env, cpsr, CPSR_IT | CPSR_T, CPSRWriteByInstr); + cpsr_write(env, cpsr, CPSR_IT | CPSR_T | CPSR_E, CPSRWriteByInstr); + arm_rebuild_hflags(env); return 0; } |