On 29 April 2015 at 13:29, Thomas Pornin <por...@bolet.org> wrote:
> On Tue, Apr 28, 2015 at 10:47:42PM +0000, Matthew Fortune wrote:
>> For non-performance testing I am keen to make as much use of qemu as
>> possible in test environments. That includes all of bare metal testing
>> using qemu system emulator, Linux tools via the user-mode emulator. I
>> haven't ever looked at the performance of building GCC inside a QEMU
>> emulated full system emulator with Linux but I suspect it may be
>> prohibitively slow.
>
> Last I tried, QEMU was reasonably good at emulating ARM opcodes, but it
> was also gleefully accepting unaligned accesses that would have trapped
> on the genuine hardware. Thus, QEMU is not good for testing unaligned
> accesses.

Correct. QEMU mostly aims to run correct code quickly rather than to
trap or fail all the corner cases that broken code might fail on
on real hardware. (That doesn't mean we don't care about correctness;
it's more of a philosophical statement about priorities and likely
future directions.)

> From the 486SX onwards, x86 CPU have an "alignment check" flag in the
> flags register (bit 18). If set, then unaligned accesses trigger CPU
> exceptions (converted by the Linux kernel into SIGBUS). I don't know
> what would happen if that flag was enabled within a QEMU instance
> emulating an ARM CPU on an x86 system, but it is at least conceivable
> that it _could_ turn it into a functioning ARM emulation that traps on
> unaligned accesses. This is worth a try.

The trouble with this idea is that QEMU expects unaligned accesses
on x86 hosts not to trap -- we rely on this in lots of places that
are just QEMU's internals, not places where we're emulating a
guest load. Also the ARM architectural rules for unaligned accesses
are not as simple as "all unaligned accesses fault" -- it depends
on the ARM instruction involved and on system register settings.

(Personally I use the compile farm to test QEMU...)

thanks
-- PMM

_______________________________________________
Gcc-cfarm-users mailing list
Gcc-cfarm-users@gna.org
https://mail.gna.org/listinfo/gcc-cfarm-users

Reply via email to