Signed-off-by: Rusty Russell <ru...@rustcorp.com.au> --- configure | 1 + target-ppc/misc_helper.c | 8 ++++++++ 2 files changed, 9 insertions(+)
diff --git a/configure b/configure index ad32f87..cee32af 100755 --- a/configure +++ b/configure @@ -4217,6 +4217,7 @@ case "$target_name" in ppc64) TARGET_BASE_ARCH=ppc TARGET_ABI_DIR=ppc + echo "TARGET_VIRTIO_SWAPENDIAN=y" >> $config_target_mak gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" ;; ppc64abi32) diff --git a/target-ppc/misc_helper.c b/target-ppc/misc_helper.c index 616aab6..b031586 100644 --- a/target-ppc/misc_helper.c +++ b/target-ppc/misc_helper.c @@ -20,6 +20,7 @@ #include "helper.h" #include "helper_regs.h" +#include "hw/virtio/virtio-access.h" /*****************************************************************************/ /* SPR accesses */ @@ -116,3 +117,10 @@ void ppc_store_msr(CPUPPCState *env, target_ulong value) { hreg_store_msr(env, value, 0); } + +/* Our virtio accesses are LE if the first CPU is LE when they touch + * it. We assume endian doesn't change after that! */ +bool virtio_swap_endian(void) +{ + return first_cpu->hflags & (1 << MSR_LE); +} -- 1.8.1.2