target/sparc: Replace target_monitor_defs -> SysemuCPUOps::monitor_defs

Restrict sparc64_monitor_defs[] to cpu.c, register it
as SysemuCPUOps::monitor_defs hook (taking care to not
register it on 32-bit SPARC target), allowing to remove
the target_monitor_defs() method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-30-philmd@linaro.org>
This commit is contained in:
Philippe Mathieu-Daudé
2026-03-20 14:14:13 +01:00
parent b97130c9bd
commit 2124d080a0
2 changed files with 19 additions and 18 deletions

View File

@@ -993,12 +993,31 @@ static const Property sparc_cpu_properties[] = {
};
#ifndef CONFIG_USER_ONLY
#ifdef TARGET_SPARC64
#include "monitor/hmp.h"
static const MonitorDef sparc64_monitor_defs[] = {
{ "asi", offsetof(CPUSPARCState, asi) },
{ "pstate", offsetof(CPUSPARCState, pstate) },
{ "cansave", offsetof(CPUSPARCState, cansave) },
{ "canrestore", offsetof(CPUSPARCState, canrestore) },
{ "otherwin", offsetof(CPUSPARCState, otherwin) },
{ "wstate", offsetof(CPUSPARCState, wstate) },
{ "cleanwin", offsetof(CPUSPARCState, cleanwin) },
{ NULL },
};
#endif
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps sparc_sysemu_ops = {
.has_work = sparc_cpu_has_work,
.get_phys_page_debug = sparc_cpu_get_phys_page_debug,
.legacy_vmsd = &vmstate_sparc_cpu,
#if defined(TARGET_SPARC64)
.monitor_defs = sparc64_monitor_defs,
#endif
};
#endif

View File

@@ -37,21 +37,3 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
}
dump_mmu(env1);
}
const MonitorDef monitor_defs[] = {
#ifdef TARGET_SPARC64
{ "asi", offsetof(CPUSPARCState, asi) },
{ "pstate", offsetof(CPUSPARCState, pstate) },
{ "cansave", offsetof(CPUSPARCState, cansave) },
{ "canrestore", offsetof(CPUSPARCState, canrestore) },
{ "otherwin", offsetof(CPUSPARCState, otherwin) },
{ "wstate", offsetof(CPUSPARCState, wstate) },
{ "cleanwin", offsetof(CPUSPARCState, cleanwin) },
#endif
{ NULL },
};
const MonitorDef *target_monitor_defs(void)
{
return monitor_defs;
}