Skip to content

Commit 43cf067

Browse files
kevmwdagrh
authored andcommitted
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 <[email protected]> Message-Id: <[email protected]> Reviewed-by: Dr. David Alan Gilbert <[email protected]> Signed-off-by: Dr. David Alan Gilbert <[email protected]>
1 parent 2fc5d01 commit 43cf067

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

include/monitor/hmp-target.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
struct MonitorDef {
3434
const char *name;
3535
int offset;
36-
target_long (*get_value)(const struct MonitorDef *md, int val);
36+
target_long (*get_value)(Monitor *mon, const struct MonitorDef *md,
37+
int val);
3738
int type;
3839
};
3940

monitor/misc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1678,7 +1678,7 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)
16781678
for(; md->name != NULL; md++) {
16791679
if (hmp_compare_cmd(name, md->name)) {
16801680
if (md->get_value) {
1681-
*pval = md->get_value(md, md->offset);
1681+
*pval = md->get_value(mon, md, md->offset);
16821682
} else {
16831683
CPUArchState *env = mon_get_cpu_env();
16841684
ptr = (uint8_t *)env + md->offset;

target/i386/monitor.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,8 @@ void hmp_mce(Monitor *mon, const QDict *qdict)
601601
}
602602
}
603603

604-
static target_long monitor_get_pc(const struct MonitorDef *md, int val)
604+
static target_long monitor_get_pc(Monitor *mon, const struct MonitorDef *md,
605+
int val)
605606
{
606607
CPUArchState *env = mon_get_cpu_env();
607608
return env->eip + env->segs[R_CS].base;

target/ppc/monitor.c

+8-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
#include "monitor/hmp-target.h"
3030
#include "monitor/hmp.h"
3131

32-
static target_long monitor_get_ccr(const struct MonitorDef *md, int val)
32+
static target_long monitor_get_ccr(Monitor *mon, const struct MonitorDef *md,
33+
int val)
3334
{
3435
CPUArchState *env = mon_get_cpu_env();
3536
unsigned int u;
@@ -43,19 +44,22 @@ static target_long monitor_get_ccr(const struct MonitorDef *md, int val)
4344
return u;
4445
}
4546

46-
static target_long monitor_get_decr(const struct MonitorDef *md, int val)
47+
static target_long monitor_get_decr(Monitor *mon, const struct MonitorDef *md,
48+
int val)
4749
{
4850
CPUArchState *env = mon_get_cpu_env();
4951
return cpu_ppc_load_decr(env);
5052
}
5153

52-
static target_long monitor_get_tbu(const struct MonitorDef *md, int val)
54+
static target_long monitor_get_tbu(Monitor *mon, const struct MonitorDef *md,
55+
int val)
5356
{
5457
CPUArchState *env = mon_get_cpu_env();
5558
return cpu_ppc_load_tbu(env);
5659
}
5760

58-
static target_long monitor_get_tbl(const struct MonitorDef *md, int val)
61+
static target_long monitor_get_tbl(Monitor *mon, const struct MonitorDef *md,
62+
int val)
5963
{
6064
CPUArchState *env = mon_get_cpu_env();
6165
return cpu_ppc_load_tbl(env);

target/sparc/monitor.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,17 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
4040
}
4141

4242
#ifndef TARGET_SPARC64
43-
static target_long monitor_get_psr (const struct MonitorDef *md, int val)
43+
static target_long monitor_get_psr(Monitor *mon, const struct MonitorDef *md,
44+
int val)
4445
{
4546
CPUArchState *env = mon_get_cpu_env();
4647

4748
return cpu_get_psr(env);
4849
}
4950
#endif
5051

51-
static target_long monitor_get_reg(const struct MonitorDef *md, int val)
52+
static target_long monitor_get_reg(Monitor *mon, const struct MonitorDef *md,
53+
int val)
5254
{
5355
CPUArchState *env = mon_get_cpu_env();
5456
return env->regwptr[val];

0 commit comments

Comments
 (0)