@samitouri / QOSamiQemu / commits / b97130c9bd

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

Restrict m68k_monitor_defs[] to cpu.c, register it as SysemuCPUOps::monitor_defs hook, 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-29-philmd@linaro.org>

Philippe Mathieu-Daudé committed Mar 20, 2026 at 14:14 UTC b97130c9bd730c2e6f186a2bf6155dee012e9c97
2 files changed +18 -21
target/m68k/cpu.c
+18
@@ -25,6 +25,7 @@
25
26 #ifndef CONFIG_USER_ONLY
27 #include "migration/vmstate.h"
28 +#include "monitor/hmp.h"
29 #endif
30
31 #include "cpu.h"
@@ -602,11 +603,28 @@ static const VMStateDescription vmstate_m68k_cpu = {
603 },
604 };
605
606 +static const MonitorDef m68k_monitor_defs[] = {
607 + { "ssp", offsetof(CPUM68KState, sp[0]) },
608 + { "usp", offsetof(CPUM68KState, sp[1]) },
609 + { "isp", offsetof(CPUM68KState, sp[2]) },
610 + { "sfc", offsetof(CPUM68KState, sfc) },
611 + { "dfc", offsetof(CPUM68KState, dfc) },
612 + { "urp", offsetof(CPUM68KState, mmu.urp) },
613 + { "srp", offsetof(CPUM68KState, mmu.srp) },
614 + { "dttr0", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR0]) },
615 + { "dttr1", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR1]) },
616 + { "ittr0", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR0]) },
617 + { "ittr1", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR1]) },
618 + { "mmusr", offsetof(CPUM68KState, mmu.mmusr) },
619 + { NULL },
620 +};
621 +
622 #include "hw/core/sysemu-cpu-ops.h"
623
624 static const struct SysemuCPUOps m68k_sysemu_ops = {
625 .has_work = m68k_cpu_has_work,
626 .get_phys_page_debug = m68k_cpu_get_phys_page_debug,
627 + .monitor_defs = m68k_monitor_defs,
628 };
629 #endif /* !CONFIG_USER_ONLY */
630
target/m68k/monitor.c
-21
@@ -21,24 +21,3 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
21
22 dump_mmu(env1);
23 }
24 -
25 -static const MonitorDef monitor_defs[] = {
26 - { "ssp", offsetof(CPUM68KState, sp[0]) },
27 - { "usp", offsetof(CPUM68KState, sp[1]) },
28 - { "isp", offsetof(CPUM68KState, sp[2]) },
29 - { "sfc", offsetof(CPUM68KState, sfc) },
30 - { "dfc", offsetof(CPUM68KState, dfc) },
31 - { "urp", offsetof(CPUM68KState, mmu.urp) },
32 - { "srp", offsetof(CPUM68KState, mmu.srp) },
33 - { "dttr0", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR0]) },
34 - { "dttr1", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR1]) },
35 - { "ittr0", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR0]) },
36 - { "ittr1", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR1]) },
37 - { "mmusr", offsetof(CPUM68KState, mmu.mmusr) },
38 - { NULL },
39 -};
40 -
41 -const MonitorDef *target_monitor_defs(void)
42 -{
43 - return monitor_defs;
44 -}