All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] linux-user/arm: Reset CPSR_E when entering a signal handler
@ 2020-05-11 13:11 Amanieu d'Antras
  2020-05-11 13:23 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Amanieu d'Antras @ 2020-05-11 13:11 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 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c
index d96fc27ce1..a475a103e9 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;
 }
-- 
2.26.2



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

* Re: [PATCH v2] linux-user/arm: Reset CPSR_E when entering a signal handler
  2020-05-11 13:11 [PATCH v2] linux-user/arm: Reset CPSR_E when entering a signal handler Amanieu d'Antras
@ 2020-05-11 13:23 ` Peter Maydell
  2020-05-21 17:03   ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2020-05-11 13:23 UTC (permalink / raw)
  To: Amanieu d'Antras; +Cc: Riku Voipio, qemu-arm, QEMU Developers

On Mon, 11 May 2020 at 14:11, Amanieu d'Antras <amanieu@gmail.com> wrote:
>
> 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 | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [PATCH v2] linux-user/arm: Reset CPSR_E when entering a signal handler
  2020-05-11 13:23 ` Peter Maydell
@ 2020-05-21 17:03   ` Peter Maydell
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2020-05-21 17:03 UTC (permalink / raw)
  To: Amanieu d'Antras; +Cc: Riku Voipio, qemu-arm, QEMU Developers

On Mon, 11 May 2020 at 14:23, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Mon, 11 May 2020 at 14:11, Amanieu d'Antras <amanieu@gmail.com> wrote:
> >
> > 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 | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>



Applied to target-arm.next, thanks.

-- PMM


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11 13:11 [PATCH v2] linux-user/arm: Reset CPSR_E when entering a signal handler Amanieu d'Antras
2020-05-11 13:23 ` Peter Maydell
2020-05-21 17:03   ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.