[PATCH-for-11.1 06/10] target/sparc: Replace legacy target_monitor_defs -> legacy_monitor_defs

Philippe Mathieu-Daudé posted 10 patches 1 day, 22 hours ago
[PATCH-for-11.1 06/10] target/sparc: Replace legacy target_monitor_defs -> legacy_monitor_defs
Posted by Philippe Mathieu-Daudé 1 day, 22 hours ago
Expose sparc64_monitor_defs within target/sparc/ and register
it as CPUClass::legacy_monitor_defs hook (taking care to not
register it on 32-bit SPARC target).

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/sparc/cpu.h     | 2 ++
 target/sparc/cpu.c     | 3 +++
 target/sparc/monitor.c | 9 +++------
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h
index ac0eb9f0faa..83f6859019d 100644
--- a/target/sparc/cpu.h
+++ b/target/sparc/cpu.h
@@ -7,6 +7,8 @@
 #include "exec/target_long.h"
 #include "qemu/cpu-float.h"
 
+extern const MonitorDef *sparc64_monitor_defs;
+
 #if !defined(TARGET_SPARC64)
 #define TARGET_DPREGS 16
 #define TARGET_FCCREGS 1
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
index 1493336e7a2..65468ceeb78 100644
--- a/target/sparc/cpu.c
+++ b/target/sparc/cpu.c
@@ -1096,6 +1096,9 @@ static void sparc_cpu_class_init(ObjectClass *oc, const void *data)
     cc->gdb_core_xml_file = "sparc64-cpu.xml";
 #else
     cc->gdb_core_xml_file = "sparc32-cpu.xml";
+#endif
+#if defined(TARGET_SPARC64)
+    cc->legacy_monitor_defs = sparc64_monitor_defs;
 #endif
     cc->tcg_ops = &sparc_tcg_ops;
 }
diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c
index 99abddbf1e0..377c2b18cab 100644
--- a/target/sparc/monitor.c
+++ b/target/sparc/monitor.c
@@ -38,8 +38,8 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
     dump_mmu(env1);
 }
 
-const MonitorDef monitor_defs[] = {
 #ifdef TARGET_SPARC64
+static const MonitorDef monitor_defs[] = {
     { "asi", offsetof(CPUSPARCState, asi) },
     { "pstate", offsetof(CPUSPARCState, pstate) },
     { "cansave", offsetof(CPUSPARCState, cansave) },
@@ -47,11 +47,8 @@ const MonitorDef monitor_defs[] = {
     { "otherwin", offsetof(CPUSPARCState, otherwin) },
     { "wstate", offsetof(CPUSPARCState, wstate) },
     { "cleanwin", offsetof(CPUSPARCState, cleanwin) },
-#endif
     { NULL },
 };
 
-const MonitorDef *target_monitor_defs(void)
-{
-    return monitor_defs;
-}
+const MonitorDef *sparc64_monitor_defs = monitor_defs;
+#endif
-- 
2.53.0