On 24 June 2015 at 11:09, Paolo Bonzini <pbonz...@redhat.com> wrote: > > > On 23/06/2015 22:30, Peter Crosthwaite wrote: >> > I'm confused. arm_cpu_is_big_endian() tells you whether the CPU >> > is *currently* big-endian or not. That doesn't help you with >> > answering the question "I'm about to run a signal handler; what >> > should I set the CPSR.E bit to?" in linux-user mode. That's >> > what signal_cpsr_e does. >> >> arm_cpu_is_bigendian is the consumer of this information. We still >> need some state for signal_cpsr_e, just the question is what state >> does that set. If we reuse arm_cpu_is_big_endian, then signal_cpsr_e >> (or its rename) needs to drive CPSR.E as well as SCTLR.E0E. > > I think signal_cpsr_e is exactly what you want for AArch32. It sets > CPSR.E in main and setup_return for AArch32. > > For AArch64 you don't need anything because, even though the kernel does > trap setend and tweak SCTLR.E0E in response to it, setup_return doesn't > try to restore the native endianness.
I didn't think SETEND existed at all in AArch64? It's a 32-bit only instruction. So the AArch64 setup is anyway much simpler because you don't have to worry about the userspace code being a different endianness to what you want to run the signal handler as. -- PMM