monitor: Remove MonitorDef::type field and MD_TLONG / MD_I32
None of the few targets still using MonitorDef use MD_TLONG, they either use MD_I32 or the %get_value handler. Remove the MonitorDef::type and its definitions altogether: simply check for the %get_value handler, if NULL then consider 32-bit. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-Id: <20260320091019.59902-3-philmd@linaro.org>
Philippe Mathieu-Daudé committed
Mar 20, 2026 at 09:06 UTC
e918afdb65c463e149484ad803d962cbcb6908ab
5 files changed
+21
-35
include/monitor/hmp-target.h
-4
@@ -34,13 +34,9 @@ struct MonitorDef {
34
int offset;
35
target_long (*get_value)(Monitor *mon, const struct MonitorDef *md,
36
int val);
37
- int type;
37
};
38
#endif
39
41
-#define MD_TLONG 0
42
-#define MD_I32 1
43
-
40
const MonitorDef *target_monitor_defs(void);
41
int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval);
42
monitor/hmp-target.c
+1
-11
@@ -82,17 +82,7 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)
82
} else {
83
CPUArchState *env = mon_get_cpu_env(mon);
84
ptr = (uint8_t *)env + md->offset;
85
- switch(md->type) {
86
- case MD_I32:
87
- *pval = *(int32_t *)ptr;
88
- break;
89
- case MD_TLONG:
90
- *pval = *(target_long *)ptr;
91
- break;
92
- default:
93
- *pval = 0;
94
- break;
95
- }
85
+ *pval = *(int32_t *)ptr;
86
}
87
return 0;
88
}
target/i386/monitor.c
+1
-1
@@ -602,7 +602,7 @@ static target_long monitor_get_pc(Monitor *mon, const struct MonitorDef *md,
602
603
const MonitorDef monitor_defs[] = {
604
#define SEG(name, seg) \
605
- { name ".limit", offsetof(CPUX86State, segs[seg].limit), NULL, MD_I32 },
605
+ { name ".limit", offsetof(CPUX86State, segs[seg].limit) },
606
SEG("cs", R_CS)
607
SEG("ds", R_DS)
608
SEG("es", R_ES)
target/m68k/monitor.c
+12
-12
@@ -24,18 +24,18 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
24
}
25
26
static const MonitorDef monitor_defs[] = {
27
- { "ssp", offsetof(CPUM68KState, sp[0]), NULL, MD_I32 },
28
- { "usp", offsetof(CPUM68KState, sp[1]), NULL, MD_I32 },
29
- { "isp", offsetof(CPUM68KState, sp[2]), NULL, MD_I32 },
30
- { "sfc", offsetof(CPUM68KState, sfc), NULL, MD_I32 },
31
- { "dfc", offsetof(CPUM68KState, dfc), NULL, MD_I32 },
32
- { "urp", offsetof(CPUM68KState, mmu.urp), NULL, MD_I32 },
33
- { "srp", offsetof(CPUM68KState, mmu.srp), NULL, MD_I32 },
34
- { "dttr0", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR0]), NULL, MD_I32 },
35
- { "dttr1", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR1]), NULL, MD_I32 },
36
- { "ittr0", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR0]), NULL, MD_I32 },
37
- { "ittr1", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR1]), NULL, MD_I32 },
38
- { "mmusr", offsetof(CPUM68KState, mmu.mmusr), NULL, MD_I32 },
27
+ { "ssp", offsetof(CPUM68KState, sp[0]) },
28
+ { "usp", offsetof(CPUM68KState, sp[1]) },
29
+ { "isp", offsetof(CPUM68KState, sp[2]) },
30
+ { "sfc", offsetof(CPUM68KState, sfc) },
31
+ { "dfc", offsetof(CPUM68KState, dfc) },
32
+ { "urp", offsetof(CPUM68KState, mmu.urp) },
33
+ { "srp", offsetof(CPUM68KState, mmu.srp) },
34
+ { "dttr0", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR0]) },
35
+ { "dttr1", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR1]) },
36
+ { "ittr0", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR0]) },
37
+ { "ittr1", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR1]) },
38
+ { "mmusr", offsetof(CPUM68KState, mmu.mmusr) },
39
{ NULL },
40
};
41
target/sparc/monitor.c
+7
-7
@@ -41,13 +41,13 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
41
42
const MonitorDef monitor_defs[] = {
43
#ifdef TARGET_SPARC64
44
- { "asi", offsetof(CPUSPARCState, asi), NULL, MD_I32 },
45
- { "pstate", offsetof(CPUSPARCState, pstate), NULL, MD_I32 },
46
- { "cansave", offsetof(CPUSPARCState, cansave), NULL, MD_I32 },
47
- { "canrestore", offsetof(CPUSPARCState, canrestore), NULL, MD_I32 },
48
- { "otherwin", offsetof(CPUSPARCState, otherwin), NULL, MD_I32 },
49
- { "wstate", offsetof(CPUSPARCState, wstate), NULL, MD_I32 },
50
- { "cleanwin", offsetof(CPUSPARCState, cleanwin), NULL, MD_I32 },
44
+ { "asi", offsetof(CPUSPARCState, asi) },
45
+ { "pstate", offsetof(CPUSPARCState, pstate) },
46
+ { "cansave", offsetof(CPUSPARCState, cansave) },
47
+ { "canrestore", offsetof(CPUSPARCState, canrestore) },
48
+ { "otherwin", offsetof(CPUSPARCState, otherwin) },
49
+ { "wstate", offsetof(CPUSPARCState, wstate) },
50
+ { "cleanwin", offsetof(CPUSPARCState, cleanwin) },
51
#endif
52
{ NULL },
53
};