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>
---
include/monitor/hmp-target.h | 4 ----
monitor/hmp-target.c | 12 +-----------
target/i386/monitor.c | 2 +-
target/m68k/monitor.c | 24 ++++++++++++------------
target/sparc/monitor.c | 14 +++++++-------
5 files changed, 21 insertions(+), 35 deletions(-)
diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h
index 5167d17d41d..56322ceddd4 100644
--- a/include/monitor/hmp-target.h
+++ b/include/monitor/hmp-target.h
@@ -34,13 +34,9 @@ struct MonitorDef {
int offset;
target_long (*get_value)(Monitor *mon, const struct MonitorDef *md,
int val);
- int type;
};
#endif
-#define MD_TLONG 0
-#define MD_I32 1
-
const MonitorDef *target_monitor_defs(void);
int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval);
diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c
index 420969bd6eb..3f019ae2a28 100644
--- a/monitor/hmp-target.c
+++ b/monitor/hmp-target.c
@@ -82,17 +82,7 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)
} else {
CPUArchState *env = mon_get_cpu_env(mon);
ptr = (uint8_t *)env + md->offset;
- switch(md->type) {
- case MD_I32:
- *pval = *(int32_t *)ptr;
- break;
- case MD_TLONG:
- *pval = *(target_long *)ptr;
- break;
- default:
- *pval = 0;
- break;
- }
+ *pval = *(int32_t *)ptr;
}
return 0;
}
diff --git a/target/i386/monitor.c b/target/i386/monitor.c
index 446428602ef..977f65fe16c 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -602,7 +602,7 @@ static target_long monitor_get_pc(Monitor *mon, const struct MonitorDef *md,
const MonitorDef monitor_defs[] = {
#define SEG(name, seg) \
- { name ".limit", offsetof(CPUX86State, segs[seg].limit), NULL, MD_I32 },
+ { name ".limit", offsetof(CPUX86State, segs[seg].limit) },
SEG("cs", R_CS)
SEG("ds", R_DS)
SEG("es", R_ES)
diff --git a/target/m68k/monitor.c b/target/m68k/monitor.c
index 08ced037b47..94bb12833af 100644
--- a/target/m68k/monitor.c
+++ b/target/m68k/monitor.c
@@ -24,18 +24,18 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
}
static const MonitorDef monitor_defs[] = {
- { "ssp", offsetof(CPUM68KState, sp[0]), NULL, MD_I32 },
- { "usp", offsetof(CPUM68KState, sp[1]), NULL, MD_I32 },
- { "isp", offsetof(CPUM68KState, sp[2]), NULL, MD_I32 },
- { "sfc", offsetof(CPUM68KState, sfc), NULL, MD_I32 },
- { "dfc", offsetof(CPUM68KState, dfc), NULL, MD_I32 },
- { "urp", offsetof(CPUM68KState, mmu.urp), NULL, MD_I32 },
- { "srp", offsetof(CPUM68KState, mmu.srp), NULL, MD_I32 },
- { "dttr0", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR0]), NULL, MD_I32 },
- { "dttr1", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR1]), NULL, MD_I32 },
- { "ittr0", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR0]), NULL, MD_I32 },
- { "ittr1", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR1]), NULL, MD_I32 },
- { "mmusr", offsetof(CPUM68KState, mmu.mmusr), NULL, MD_I32 },
+ { "ssp", offsetof(CPUM68KState, sp[0]) },
+ { "usp", offsetof(CPUM68KState, sp[1]) },
+ { "isp", offsetof(CPUM68KState, sp[2]) },
+ { "sfc", offsetof(CPUM68KState, sfc) },
+ { "dfc", offsetof(CPUM68KState, dfc) },
+ { "urp", offsetof(CPUM68KState, mmu.urp) },
+ { "srp", offsetof(CPUM68KState, mmu.srp) },
+ { "dttr0", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR0]) },
+ { "dttr1", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR1]) },
+ { "ittr0", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR0]) },
+ { "ittr1", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR1]) },
+ { "mmusr", offsetof(CPUM68KState, mmu.mmusr) },
{ NULL },
};
diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c
index e9300ded4ad..a60671a60a4 100644
--- a/target/sparc/monitor.c
+++ b/target/sparc/monitor.c
@@ -41,13 +41,13 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
const MonitorDef monitor_defs[] = {
#ifdef TARGET_SPARC64
- { "asi", offsetof(CPUSPARCState, asi), NULL, MD_I32 },
- { "pstate", offsetof(CPUSPARCState, pstate), NULL, MD_I32 },
- { "cansave", offsetof(CPUSPARCState, cansave), NULL, MD_I32 },
- { "canrestore", offsetof(CPUSPARCState, canrestore), NULL, MD_I32 },
- { "otherwin", offsetof(CPUSPARCState, otherwin), NULL, MD_I32 },
- { "wstate", offsetof(CPUSPARCState, wstate), NULL, MD_I32 },
- { "cleanwin", offsetof(CPUSPARCState, cleanwin), NULL, MD_I32 },
+ { "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 },
};
--
2.53.0