hmp: Pass monitor to MonitorDef.get_value()

All of these callbacks use mon_get_cpu_env(). Pass the Monitor
pointer to them it in preparation for adding a monitor argument to
mon_get_cpu_env().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20201113114326.97663-3-kwolf@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
Kevin Wolf 2020-11-13 12:43:25 +01:00 committed by Dr. David Alan Gilbert
parent 2fc5d01bb4
commit 43cf067ff8
5 changed files with 17 additions and 9 deletions

View File

@ -33,7 +33,8 @@
struct MonitorDef { struct MonitorDef {
const char *name; const char *name;
int offset; int offset;
target_long (*get_value)(const struct MonitorDef *md, int val); target_long (*get_value)(Monitor *mon, const struct MonitorDef *md,
int val);
int type; int type;
}; };

View File

@ -1678,7 +1678,7 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)
for(; md->name != NULL; md++) { for(; md->name != NULL; md++) {
if (hmp_compare_cmd(name, md->name)) { if (hmp_compare_cmd(name, md->name)) {
if (md->get_value) { if (md->get_value) {
*pval = md->get_value(md, md->offset); *pval = md->get_value(mon, md, md->offset);
} else { } else {
CPUArchState *env = mon_get_cpu_env(); CPUArchState *env = mon_get_cpu_env();
ptr = (uint8_t *)env + md->offset; ptr = (uint8_t *)env + md->offset;

View File

@ -601,7 +601,8 @@ void hmp_mce(Monitor *mon, const QDict *qdict)
} }
} }
static target_long monitor_get_pc(const struct MonitorDef *md, int val) static target_long monitor_get_pc(Monitor *mon, const struct MonitorDef *md,
int val)
{ {
CPUArchState *env = mon_get_cpu_env(); CPUArchState *env = mon_get_cpu_env();
return env->eip + env->segs[R_CS].base; return env->eip + env->segs[R_CS].base;

View File

@ -29,7 +29,8 @@
#include "monitor/hmp-target.h" #include "monitor/hmp-target.h"
#include "monitor/hmp.h" #include "monitor/hmp.h"
static target_long monitor_get_ccr(const struct MonitorDef *md, int val) static target_long monitor_get_ccr(Monitor *mon, const struct MonitorDef *md,
int val)
{ {
CPUArchState *env = mon_get_cpu_env(); CPUArchState *env = mon_get_cpu_env();
unsigned int u; unsigned int u;
@ -43,19 +44,22 @@ static target_long monitor_get_ccr(const struct MonitorDef *md, int val)
return u; return u;
} }
static target_long monitor_get_decr(const struct MonitorDef *md, int val) static target_long monitor_get_decr(Monitor *mon, const struct MonitorDef *md,
int val)
{ {
CPUArchState *env = mon_get_cpu_env(); CPUArchState *env = mon_get_cpu_env();
return cpu_ppc_load_decr(env); return cpu_ppc_load_decr(env);
} }
static target_long monitor_get_tbu(const struct MonitorDef *md, int val) static target_long monitor_get_tbu(Monitor *mon, const struct MonitorDef *md,
int val)
{ {
CPUArchState *env = mon_get_cpu_env(); CPUArchState *env = mon_get_cpu_env();
return cpu_ppc_load_tbu(env); return cpu_ppc_load_tbu(env);
} }
static target_long monitor_get_tbl(const struct MonitorDef *md, int val) static target_long monitor_get_tbl(Monitor *mon, const struct MonitorDef *md,
int val)
{ {
CPUArchState *env = mon_get_cpu_env(); CPUArchState *env = mon_get_cpu_env();
return cpu_ppc_load_tbl(env); return cpu_ppc_load_tbl(env);

View File

@ -40,7 +40,8 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
} }
#ifndef TARGET_SPARC64 #ifndef TARGET_SPARC64
static target_long monitor_get_psr (const struct MonitorDef *md, int val) static target_long monitor_get_psr(Monitor *mon, const struct MonitorDef *md,
int val)
{ {
CPUArchState *env = mon_get_cpu_env(); CPUArchState *env = mon_get_cpu_env();
@ -48,7 +49,8 @@ static target_long monitor_get_psr (const struct MonitorDef *md, int val)
} }
#endif #endif
static target_long monitor_get_reg(const struct MonitorDef *md, int val) static target_long monitor_get_reg(Monitor *mon, const struct MonitorDef *md,
int val)
{ {
CPUArchState *env = mon_get_cpu_env(); CPUArchState *env = mon_get_cpu_env();
return env->regwptr[val]; return env->regwptr[val];