Il 08/04/2014 10:37, Peter Maydell ha scritto:
I think it's actually worse than that. address_space_read/write have an API which requires you to pass them a buffer which is in guest CPU endianness. This means they cannot be used from target-independent source files (like hw/pci-host/prep.c) because there's no way to say "write this 32 bit value to the buffer in target endianness". ioport.c which has pretty much identical code works OK because it is built per target.
So the fix could be to compile prep.c per-target (and change to DEVICE_NATIVE_ENDIAN too).
Worse, we have two versions of the ldl_p()/stl_p() &c functions with conflicting semantics! cpu-all.h defines these to be "target CPU endianness". bswap.h defines these to be "host CPU endianness".
Ouch! I have some cleanups for CPU ld/st ready for 2.1, I'll add a patch to rename bswap.h's definition to ldl_host_p/stl_host_p.
Paolo