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>
---
stubs/hmp-cmd-info_mem.c | 12 ++++++++++++
hmp-commands-info.hx | 3 +--
stubs/meson.build | 1 +
3 files changed, 14 insertions(+), 2 deletions(-)
create mode 100644 stubs/hmp-cmd-info_mem.c
diff --git a/stubs/hmp-cmd-info_mem.c b/stubs/hmp-cmd-info_mem.c
new file mode 100644
index 00000000000..8a53e367a9f
--- /dev/null
+++ b/stubs/hmp-cmd-info_mem.c
@@ -0,0 +1,12 @@
+/*
+ * Human Monitor 'info mem' stub
+ *
+ * Copyright (c) Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "monitor/hmp.h"
+
+HMP_STUB(info_mem)
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index 336ab870a2c..2d0a8f7d48f 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -209,15 +209,14 @@ SRST
Show virtual to physical memory mappings.
ERST
-#if defined(TARGET_I386) || defined(TARGET_RISCV)
{
.name = "mem",
.args_type = "",
.params = "",
.help = "show the active virtual memory mappings",
.cmd = hmp_info_mem,
+ .arch_bitmask = QEMU_ARCH_I386 | QEMU_ARCH_RISCV,
},
-#endif
SRST
``info mem``
diff --git a/stubs/meson.build b/stubs/meson.build
index 09e73ef8b73..ed7ca54ae06 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -84,6 +84,7 @@ if have_system
stub_ss.add(files('qmp-cpu.c'))
stub_ss.add(files('qmp-cpu-s390x.c'))
stub_ss.add(files('qmp-cpu-s390x-kvm.c'))
+ stub_ss.add(files('hmp-cmd-info_mem.c'))
stub_ss.add(files('hmp-cmd-info_sev.c'))
stub_ss.add(files('hmp-cmds-hw-s390x.c'))
stub_ss.add(files('hmp-cmds-target-i386.c'))
--
2.53.0