diff --git a/qemu/include/exec/cpu-common.h b/qemu/include/exec/cpu-common.h index 8424f11d..1b5d3c45 100644 --- a/qemu/include/exec/cpu-common.h +++ b/qemu/include/exec/cpu-common.h @@ -22,6 +22,12 @@ enum device_endian { DEVICE_LITTLE_ENDIAN, }; +#if defined(HOST_WORDS_BIGENDIAN) +#define DEVICE_HOST_ENDIAN DEVICE_BIG_ENDIAN +#else +#define DEVICE_HOST_ENDIAN DEVICE_LITTLE_ENDIAN +#endif + /* address in the RAM (different from a physical address) */ #if defined(CONFIG_XEN_BACKEND) typedef uint64_t ram_addr_t; diff --git a/qemu/memory.c b/qemu/memory.c index f0874a27..f7128f5b 100644 --- a/qemu/memory.c +++ b/qemu/memory.c @@ -1064,7 +1064,7 @@ static const MemoryRegionOps ram_device_mem_ops = { memory_region_ram_device_write, NULL, NULL, - DEVICE_NATIVE_ENDIAN, + DEVICE_HOST_ENDIAN, // valid { 1, 8,