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>
Philippe Mathieu-Daudé committed
Mar 20, 2026 at 14:14 UTC
2124d080a0db1daa383fd1db386d691c714d567d
2 files changed
+19
-18
target/sparc/cpu.c
+19
@@ -993,12 +993,31 @@ static const Property sparc_cpu_properties[] = {
993
};
994
995
#ifndef CONFIG_USER_ONLY
996
+
997
+#ifdef TARGET_SPARC64
998
+#include "monitor/hmp.h"
999
+
1000
+static const MonitorDef sparc64_monitor_defs[] = {
1001
+ { "asi", offsetof(CPUSPARCState, asi) },
1002
+ { "pstate", offsetof(CPUSPARCState, pstate) },
1003
+ { "cansave", offsetof(CPUSPARCState, cansave) },
1004
+ { "canrestore", offsetof(CPUSPARCState, canrestore) },
1005
+ { "otherwin", offsetof(CPUSPARCState, otherwin) },
1006
+ { "wstate", offsetof(CPUSPARCState, wstate) },
1007
+ { "cleanwin", offsetof(CPUSPARCState, cleanwin) },
1008
+ { NULL },
1009
+};
1010
+#endif
1011
+
1012
#include "hw/core/sysemu-cpu-ops.h"
1013
1014
static const struct SysemuCPUOps sparc_sysemu_ops = {
1015
.has_work = sparc_cpu_has_work,
1016
.get_phys_page_debug = sparc_cpu_get_phys_page_debug,
1017
.legacy_vmsd = &vmstate_sparc_cpu,
1018
+#if defined(TARGET_SPARC64)
1019
+ .monitor_defs = sparc64_monitor_defs,
1020
+#endif
1021
};
1022
#endif
1023
target/sparc/monitor.c
-18
@@ -37,21 +37,3 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
37
}
38
dump_mmu(env1);
39
}
40
-
41
-const MonitorDef monitor_defs[] = {
42
-#ifdef TARGET_SPARC64
43
- { "asi", offsetof(CPUSPARCState, asi) },
44
- { "pstate", offsetof(CPUSPARCState, pstate) },
45
- { "cansave", offsetof(CPUSPARCState, cansave) },
46
- { "canrestore", offsetof(CPUSPARCState, canrestore) },
47
- { "otherwin", offsetof(CPUSPARCState, otherwin) },
48
- { "wstate", offsetof(CPUSPARCState, wstate) },
49
- { "cleanwin", offsetof(CPUSPARCState, cleanwin) },
50
-#endif
51
- { NULL },
52
-};
53
-
54
-const MonitorDef *target_monitor_defs(void)
55
-{
56
- return monitor_defs;
57
-}