qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] linux-user/arm: Reset CPSR_E when entering a signal handler
@ 2020-05-07 20:24 Amanieu d'Antras
  2020-05-11 11:13 ` Peter Maydell
  2020-05-15 18:33 ` Peter Maydell
  0 siblings, 2 replies; 8+ messages in thread
From: Amanieu d'Antras @ 2020-05-07 20:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Riku Voipio, qemu-arm, Amanieu d'Antras

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>
---
 linux-user/arm/signal.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c
index d96fc27ce1..8aca5f61b7 100644
--- a/linux-user/arm/signal.c
+++ b/linux-user/arm/signal.c
@@ -244,6 +244,12 @@ setup_return(CPUARMState *env, struct target_sigaction *ka,
     } else {
         cpsr &= ~CPSR_T;
     }
+    cpsr &= ~CPSR_E;
+#ifdef TARGET_WORDS_BIGENDIAN
+    if (env->cp15.sctlr_el[1] & SCTLR_E0E) {
+        cpsr |= CPSR_E;
+    }
+#endif
 
     if (ka->sa_flags & TARGET_SA_RESTORER) {
         if (is_fdpic) {
@@ -287,7 +293,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;
 }
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-05-16 17:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-07 20:24 [PATCH] linux-user/arm: Reset CPSR_E when entering a signal handler Amanieu d'Antras
2020-05-11 11:13 ` Peter Maydell
2020-05-15 18:33 ` Peter Maydell
2020-05-15 20:41   ` Amanieu d'Antras
2020-05-15 21:25     ` Peter Maydell
2020-05-16  4:12       ` Richard Henderson
2020-05-16 12:58         ` Peter Maydell
2020-05-16 17:25           ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).