monitor: Do not check TARGET_I386/RISCV to build 'info mem' command
This command is filtered at build-time for i386/x86_64 and riscv32/riscv64 binaries. By using the recently introduced HMPCommand::arch_bitmask flag we can filter it at runtime, making it possible to compile hmp-commands-info.hx once. Since the method depends on a pair of distinct targets, define it in its own stub file. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Acked-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20260427080738.77138-18-philmd@linaro.org>
Philippe Mathieu-Daudé committed
Apr 10, 2026 at 19:10 UTC
eab44a938dd2fba4753c57c55f1ad7e4a2d46d87
3 files changed
+14
-2
hmp-commands-info.hx
+1
-2
@@ -202,15 +202,14 @@ SRST
202
Show virtual to physical memory mappings.
203
ERST
204
205
-#if defined(TARGET_I386) || defined(TARGET_RISCV)
205
{
206
.name = "mem",
207
.args_type = "",
208
.params = "",
209
.help = "show the active virtual memory mappings",
210
.cmd = hmp_info_mem,
211
+ .arch_bitmask = QEMU_ARCH_I386 | QEMU_ARCH_RISCV,
212
},
213
-#endif
213
214
SRST
215
``info mem``
stubs/hmp-cmd-info_mem.c
new
+12
@@ -0,0 +1,12 @@
1
+/*
2
+ * Human Monitor 'info mem' stub
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_mem)
stubs/meson.build
+1
@@ -87,6 +87,7 @@ if have_system
87
stub_ss.add(files('qmp-cpu.c'))
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-cmd-info_mem.c'))
91
stub_ss.add(files('hmp-cmd-info_sev.c'))
92
stub_ss.add(files('hmp-cmds-hw-s390x.c'))
93
stub_ss.add(files('hmp-cmds-target-i386.c'))