Now that all targets expose their system registers via internal GDB register descriptions (i386 segment limits, m68k, sparc64, RISC-V aliases), the legacy MonitorDef table and SysemuCPUOps::monitor_get_register callback are no longer needed.
HMP $register expressions now use gdb_get_register_list() exclusively. Signed-off-by: Marc-André Lureau <[email protected]> --- include/hw/core/sysemu-cpu-ops.h | 16 --------------- include/monitor/hmp.h | 6 ------ include/qemu/typedefs.h | 1 - monitor/hmp.c | 43 +--------------------------------------- 4 files changed, 1 insertion(+), 65 deletions(-) diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h index d125540262d2..daac2a3b13b1 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -103,22 +103,6 @@ typedef struct SysemuCPUOps { */ bool (*internal_is_big_endian)(CPUState *cpu); - /** - * @monitor_get_register: Callback to fill @pval with register @name value. - * This field is legacy, use @gdb_core_xml_file - * to dump registers instead. - * Returns: 0 on success or negative errno on failure. - */ - int (*monitor_get_register)(CPUState *cs, const char *name, int64_t *pval); - -#ifdef CONFIG_HMP - /** - * @monitor_defs: Array of MonitorDef entries. This field is legacy, - * use @gdb_core_xml_file to dump registers instead. - */ - const MonitorDef *monitor_defs; -#endif - /** * @legacy_vmsd: Legacy state for migration. * Do not use in new targets, use #DeviceClass::vmsd instead. diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index ef53e87f7608..950dd931d452 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -31,12 +31,6 @@ MonitorHMP *monitor_cur_hmp(void); g_assert_not_reached(); \ } -struct MonitorDef { - const char *name; - int offset; - int64_t (*get_value)(MonitorHMP *hmp, const MonitorDef *md, int offset); -}; - void monitor_new_hmp(const char *id, const char *chardev_id, bool use_readline, Error **errp); diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 2344c92182ea..5580e1fc4aba 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -72,7 +72,6 @@ typedef struct MemoryRegionSection MemoryRegionSection; typedef struct MigrationIncomingState MigrationIncomingState; typedef struct MigrationState MigrationState; typedef struct Monitor Monitor; -typedef struct MonitorDef MonitorDef; typedef struct MSIMessage MSIMessage; typedef struct NetClientState NetClientState; typedef struct NetFilterState NetFilterState; diff --git a/monitor/hmp.c b/monitor/hmp.c index e97e0a9ff0d7..feb604da27f2 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -25,7 +25,6 @@ #include "qemu/osdep.h" #include <dirent.h> #include "hw/core/qdev.h" -#include "hw/core/sysemu-cpu-ops.h" #include "monitor-internal.h" #include "monitor-hmp-internal.h" #include "monitor/hmp.h" @@ -443,8 +442,6 @@ static bool gdb_get_register(MonitorHMP *hmp, int64_t *pval, const char *name) static const char *pch; static sigjmp_buf expr_env; -static int get_monitor_def(MonitorHMP *mon, int64_t *pval, const char *name); - static G_NORETURN G_GNUC_PRINTF(2, 3) void expr_error(MonitorHMP *mon, const char *fmt, ...) { @@ -526,8 +523,7 @@ static int64_t expr_unary(MonitorHMP *mon) pch++; } *q = 0; - if (!gdb_get_register(mon, ®, buf) - && get_monitor_def(mon, ®, buf) < 0) { + if (!gdb_get_register(mon, ®, buf)) { expr_error(mon, "unknown register"); } n = reg; @@ -1720,43 +1716,6 @@ void monitor_register_hmp_info_hrt(const char *name, g_assert_not_reached(); } -/* - * Set @pval to the value in the register identified by @name. - * return 0 if OK, -1 if not found - */ -static int get_monitor_def(MonitorHMP *hmp, int64_t *pval, const char *name) -{ - CPUState *cs = monitor_hmp_get_cpu(hmp); - const MonitorDef *md = NULL; - void *ptr; - - if (cs == NULL) { - return -1; - } - md = cs->cc->sysemu_ops->monitor_defs; - if (md == NULL) { - return -1; - } - - for (; md->name != NULL; md++) { - if (hmp_compare_cmd(name, md->name)) { - if (md->get_value) { - *pval = md->get_value(hmp, md, md->offset); - } else { - CPUArchState *env = monitor_hmp_get_cpu_env(hmp); - ptr = (uint8_t *)env + md->offset; - *pval = *(int32_t *)ptr; - } - return 0; - } - } - - if (!cs->cc->sysemu_ops->monitor_get_register) { - return -1; - } - return cs->cc->sysemu_ops->monitor_get_register(cs, name, pval); -} - int monitor_hmp_vprintf(MonitorHMP *hmp, const char *fmt, va_list ap) { g_autofree char *buf = g_strdup_vprintf(fmt, ap); -- 2.56.0.116.g6de20f6092dc
