From: Amanieu d'Antras <amanieu@gmail.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Riku Voipio <riku.voipio@iki.fi>,
qemu-arm@nongnu.org, Amanieu d'Antras <amanieu@gmail.com>
Subject: [PATCH] linux-user/arm: Reset CPSR_E when entering a signal handler
Date: Thu, 7 May 2020 21:24:29 +0100 [thread overview]
Message-ID: <20200507202429.1643202-1-amanieu@gmail.com> (raw)
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
next reply other threads:[~2020-05-07 20:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-07 20:24 Amanieu d'Antras [this message]
2020-05-11 11:13 ` [PATCH] linux-user/arm: Reset CPSR_E when entering a signal handler 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200507202429.1643202-1-amanieu@gmail.com \
--to=amanieu@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).