monitor: Do not check TARGET_I386 to build target/i386/ commands
These commands are filtered at build-time for i386/x86_64 binaries. By using the recently introduced HMPCommand::arch_bitmask flag we can filter them at runtime, making it possible to compile hmp-commands[-info].hx files once. Since these methods are used inconditionally within target/i386/, define them in the same stub file. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20260427080738.77138-15-philmd@linaro.org>
Philippe Mathieu-Daudé committed
Apr 10, 2026 at 19:57 UTC
7c8730243e68a8b85936917beb0082b68476cb71
5 files changed
+17
-7
MAINTAINERS
+1
@@ -149,6 +149,7 @@ F: configs/targets/i386-softmmu.mak
149
F: configs/targets/x86_64-softmmu.mak
150
F: docs/system/i386/
151
F: docs/system/target-i386*
152
+F: stubs/hmp-cmds-target-i386.c
153
F: target/i386/*.[ch]
154
F: target/i386/Kconfig
155
F: target/i386/meson.build
hmp-commands-info.hx
+1
-3
@@ -106,16 +106,14 @@ SRST
106
Show the cpu registers.
107
ERST
108
109
-#if defined(TARGET_I386)
109
{
110
.name = "lapic",
111
.args_type = "apic-id:i?",
112
.params = "[apic-id]",
113
.help = "show local apic state (apic-id: local apic to read, default is which of current CPU)",
115
-
114
.cmd = hmp_info_local_apic,
115
+ .arch_bitmask = QEMU_ARCH_I386,
116
},
118
-#endif
117
118
SRST
119
``info lapic``
hmp-commands.hx
+1
-4
@@ -1502,18 +1502,15 @@ SRST
1502
Stop the QEMU embedded NBD server.
1503
ERST
1504
1505
-
1506
-#if defined(TARGET_I386)
1507
-
1505
{
1506
.name = "mce",
1507
.args_type = "broadcast:-b,cpu_index:i,bank:i,status:l,mcg_status:l,addr:l,misc:l",
1508
.params = "[-b] cpu bank status mcgstatus addr misc",
1509
.help = "inject a MCE on the given CPU [and broadcast to other CPUs with -b option]",
1510
.cmd = hmp_mce,
1511
+ .arch_bitmask = QEMU_ARCH_I386,
1512
},
1513
1516
-#endif
1514
SRST
1515
``mce`` *cpu* *bank* *status* *mcgstatus* *addr* *misc*
1516
Inject an MCE on the given CPU (x86 only).
stubs/hmp-cmds-target-i386.c
new
+13
@@ -0,0 +1,13 @@
1
+/*
2
+ * Human Monitor x86 stubs
3
+ *
4
+ * Copyright (c) Linaro
5
+ *
6
+ * SPDX-License-Identifier: GPL-2.0-or-later
7
+ */
8
+
9
+#include "qemu/osdep.h"
10
+#include "monitor/hmp.h"
11
+
12
+HMP_STUB(info_local_apic)
13
+HMP_STUB(mce)
stubs/meson.build
+1
@@ -88,6 +88,7 @@ if have_system
88
stub_ss.add(files('qmp-cpu-s390x.c'))
89
stub_ss.add(files('qmp-cpu-s390x-kvm.c'))
90
stub_ss.add(files('hmp-cmds-hw-s390x.c'))
91
+ stub_ss.add(files('hmp-cmds-target-i386.c'))
92
endif
93
94
if have_system or have_user