On Thu, 7 May 2020 at 21:25, Amanieu d'Antras <aman...@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 <aman...@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
The #ifdef isn't incorrect, but I don't think we need it -- if we're emulating a little-endian binary then SCTLR_E0E will be 0 and we won't set CPSR.E. So we can drop the #ifdef and the code is a little cleaner to read. Otherwise Reviewed-by: Peter Maydell <peter.mayd...@linaro.org> thanks -- PMM