diff mbox series

[Bug,1724570] Re: qemu-system-x86_64 generates ACPI tables with broken endianess when run on big-endian hosts

Message ID 151076001835.28762.7049356161441112067.malone@gac.canonical.com
State New
Headers show
Series [Bug,1724570] Re: qemu-system-x86_64 generates ACPI tables with broken endianess when run on big-endian hosts | expand

Commit Message

Thomas Huth Nov. 15, 2017, 3:33 p.m. UTC
I think something like this should fix this issue:
diff mbox series

Patch

diff a/tests/bios-tables-test.c b/tests/bios-tables-test.c
--- a/tests/bios-tables-test.c
+++ b/tests/bios-tables-test.c
@@ -279,8 +279,19 @@  static void dump_aml_files(test_data *data, bool rebuild)
         }
         g_assert(fd >= 0);
 
+        sdt->header.signature = cpu_to_le32(sdt->header.signature);
+        sdt->header.length = cpu_to_le32(sdt->header.length);
+        sdt->header.oem_revision = cpu_to_le32(sdt->header.oem_revision);
+        sdt->header.asl_compiler_revision = cpu_to_le32(sdt->header.asl_compiler_revision);
+
         ret = qemu_write_full(fd, sdt, sizeof(AcpiTableHeader));
         g_assert(ret == sizeof(AcpiTableHeader));
+
+        sdt->header.signature = le32_to_cpu(sdt->header.signature);
+        sdt->header.length = le32_to_cpu(sdt->header.length);
+        sdt->header.oem_revision = le32_to_cpu(sdt->header.oem_revision);
+        sdt->header.asl_compiler_revision = le32_to_cpu(sdt->header.asl_compiler_revision);
+
         ret = qemu_write_full(fd, sdt->aml, sdt->aml_len);
         g_assert(ret == sdt->aml_len);