]> git.proxmox.com Git - mirror_qemu.git/commitdiff
softmmu: Make qtest.c target independent
authorThomas Huth <thuth@redhat.com>
Tue, 11 Apr 2023 18:34:18 +0000 (20:34 +0200)
committerThomas Huth <thuth@redhat.com>
Thu, 20 Apr 2023 09:25:32 +0000 (11:25 +0200)
The code in this file is not performance critical, so we can use
the target independent endianess functions to only compile this
file once for all targets.

Message-Id: <20230411183418.1640500-4-thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
softmmu/meson.build
softmmu/qtest.c

index 1a7c7ac089b0c5386a4f22c4b5d025d6bd96091b..b392f0bd357502b441a5d576b1bd9bb0470c1be8 100644 (file)
@@ -3,7 +3,6 @@ specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: [files(
   'ioport.c',
   'memory.c',
   'physmem.c',
-  'qtest.c',
   'dirtylimit.c',
   'watchpoint.c',
 )])
@@ -23,6 +22,7 @@ softmmu_ss.add(files(
   'globals.c',
   'memory_mapping.c',
   'qdev-monitor.c',
+  'qtest.c',
   'rtc.c',
   'runstate-action.c',
   'runstate-hmp-cmds.c',
index 09126df38a5859d3e40071a1b052bc3048826c54..f8d764b7190f9eff2beec102a500d0827addf250 100644 (file)
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "cpu.h"
 #include "sysemu/qtest.h"
 #include "sysemu/runstate.h"
 #include "chardev/char-fe.h"
 #include "exec/ioport.h"
 #include "exec/memory.h"
+#include "exec/tswap.h"
 #include "hw/qdev-core.h"
 #include "hw/irq.h"
 #include "qemu/accel.h"
@@ -717,11 +717,11 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
         qtest_send(chr, "OK\n");
     } else if (strcmp(words[0], "endianness") == 0) {
         qtest_send_prefix(chr);
-#if TARGET_BIG_ENDIAN
-        qtest_sendf(chr, "OK big\n");
-#else
-        qtest_sendf(chr, "OK little\n");
-#endif
+        if (target_words_bigendian()) {
+            qtest_sendf(chr, "OK big\n");
+        } else {
+            qtest_sendf(chr, "OK little\n");
+        }
     } else if (qtest_enabled() && strcmp(words[0], "clock_step") == 0) {
         int64_t ns;