On 24 April 2012 18:04, Rajat Goyal <rajat.goyal...@gmail.com> wrote: > The TCG translation for the ARM setend instruction for user level binaries > is empty. A binary which just prints "hello world" but inverts the > endianness to big endian at the beginning of main gives a segmentation fault > on native ARM but prints out hello world on qemu-arm.
Which version of QEMU are you using? We fixed a bug in the handling of the Thumb encoding of SETEND recently where it would accidentally behave as a CPS instruction... (commit d9e028c). > So does QEMU continue under the little endian setting even after > encountering a setend be instruction? And if so, isn't it incorrect? QEMU doesn't support dynamic endian switching. Our behaviour (assuming you have the bugfix I mention above) is that SETEND BE will always cause an UNDEF exception. (This is strictly speaking incorrect since in ARMv7 bigendian support isn't optional, but it seems the most useful thing to do given that QEMU doesn't have the functionality.) SETEND LE will do nothing, which is correct for everything except big-endian BE8 linux-user mode (a corner case I've only just thought of; for consistency, in BE8 linux-user we should make SETEND BE be a no-op and SETEND LE cause an UNDEF.) -- PMM