Add the @arch_bitmask field to the HMPCommand structure, allowing to restrict a command to a set of target architectures (represented by the QEMU_ARCH_* enum constants). Signed-off-by: Philippe Mathieu-Daudé --- monitor/monitor-internal.h | 6 ++++++ monitor/hmp-target.c | 1 + monitor/hmp.c | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index 3ecd394ecf6..78281928e7a 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -74,6 +74,12 @@ typedef struct HMPCommand { const char *params; const char *help; const char *flags; /* p=preconfig */ + /** + * @arch_bitmask: bitmask of QEMU_ARCH_* constants + * Allow to restrict the command for a particular set of + * target architectures. + */ + uint32_t arch_bitmask; void (*cmd)(Monitor *mon, const QDict *qdict); /* * If implementing a command that takes no arguments and simply diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c index d07e545ef7e..9d8dcb8835a 100644 --- a/monitor/hmp-target.c +++ b/monitor/hmp-target.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qemu/base-arch-defs.h" #include "monitor-internal.h" #include "monitor/qdev.h" #include "net/slirp.h" diff --git a/monitor/hmp.c b/monitor/hmp.c index 3b9e180c1ca..c1e99c462b8 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -36,6 +36,7 @@ #include "qemu/cutils.h" #include "qemu/log.h" #include "qemu/option.h" +#include "qemu/base-arch-defs.h" #include "qemu/target-info.h" #include "qemu/units.h" #include "exec/gdbstub.h" @@ -219,6 +220,9 @@ static bool cmd_can_preconfig(const HMPCommand *cmd) static bool cmd_available(const HMPCommand *cmd) { + if (cmd->arch_bitmask && !qemu_arch_available(cmd->arch_bitmask)) { + return false; + } return phase_check(PHASE_MACHINE_READY) || cmd_can_preconfig(cmd); } -- 2.53.0