HMP fixes
Kevin's HMP fixes -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEERfXHG0oMt/uXep+pBRYzHrxb/ecFAl+uhGQACgkQBRYzHrxb /ef55RAAsyzDzShB7NHnFeUu2aDkkJrGAIecT0gt8Bhk9dUyDMfYl//kLWm6cv14 SDg6eccUw95OWT9Rf0P4PCPZ4ELmxB1NhJOI348/zlRMON11CYhRPHolK6qPnsO5 fTLPUGNi4sjPVwqM6IZuRf81vQz7AVGybP1cjAnpIdqzQMjHw3Pb05jlH/gAwVHw CFixJPszac0RwdLg4BA5/F/nEvCt5PHN7Umk2L5/kJqC29rBEOmrS1q05QQ7to24 CLeP9v7iEbnJFCjp8/kXASfYtB6cn9xarTENrjh5oggefn4qKX4xSZ4jG7chNLio Ubc8RtBGWPTSx12AQKQWsxsAYCHu9N1sK9IKDYZXqrtKquNEMazDjPP2MXGKDx/k TqJrG1xKMFNrQE8/CxUeaOy9lqnu5a0aN7U/A+MTtwF81J5RCM/5rVlt2M49bdlr N33An5Z9QjkIihvjBaNNRFiEaqnzbZTYTxnEr7YRJYSx/5HsTdLNU2NkF3y9nkNW SZeq2jUCPkqtFfQ1Uze7W0eep42JnVqjieIpwL914BGG+QDA/pJ9dqXlX7IyGf/f GyEoY2yIeQtgtJObWC80a+rfJkB+rRqefDn6dE+faZFlA6CpsGehyiEt81O6Ddba DigaSXP+DAOQXpgwXSQyT+hsE1sZj64Ub2lnxMiiTV1yNI/KLCQ= =pdIy -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20201113' into staging HMP fixes Kevin's HMP fixes # gpg: Signature made Fri 13 Nov 2020 13:04:36 GMT # gpg: using RSA key 45F5C71B4A0CB7FB977A9FA90516331EBC5BFDE7 # gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" [full] # Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A 9FA9 0516 331E BC5B FDE7 * remotes/dgilbert/tags/pull-hmp-20201113: hmp: Pass monitor to mon_get_cpu_env() hmp: Pass monitor to MonitorDef.get_value() hmp: Pass monitor to mon_get_cpu() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
5ececc3a0b
|
@ -33,15 +33,16 @@
|
|||
struct MonitorDef {
|
||||
const char *name;
|
||||
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;
|
||||
};
|
||||
|
||||
const MonitorDef *target_monitor_defs(void);
|
||||
int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval);
|
||||
|
||||
CPUArchState *mon_get_cpu_env(void);
|
||||
CPUState *mon_get_cpu(void);
|
||||
CPUArchState *mon_get_cpu_env(Monitor *mon);
|
||||
CPUState *mon_get_cpu(Monitor *mon);
|
||||
|
||||
void hmp_info_mem(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_tlb(Monitor *mon, const QDict *qdict);
|
||||
|
|
|
@ -384,7 +384,7 @@ static int64_t expr_unary(Monitor *mon)
|
|||
pch++;
|
||||
}
|
||||
*q = 0;
|
||||
ret = get_monitor_def(®, buf);
|
||||
ret = get_monitor_def(mon, ®, buf);
|
||||
if (ret < 0) {
|
||||
expr_error(mon, "unknown register");
|
||||
}
|
||||
|
|
|
@ -289,14 +289,14 @@ static CPUState *mon_get_cpu_sync(Monitor *mon, bool synchronize)
|
|||
return cpu;
|
||||
}
|
||||
|
||||
CPUState *mon_get_cpu(void)
|
||||
CPUState *mon_get_cpu(Monitor *mon)
|
||||
{
|
||||
return mon_get_cpu_sync(monitor_cur(), true);
|
||||
return mon_get_cpu_sync(mon, true);
|
||||
}
|
||||
|
||||
CPUArchState *mon_get_cpu_env(void)
|
||||
CPUArchState *mon_get_cpu_env(Monitor *mon)
|
||||
{
|
||||
CPUState *cs = mon_get_cpu();
|
||||
CPUState *cs = mon_get_cpu(mon);
|
||||
|
||||
return cs ? cs->env_ptr : NULL;
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ static void hmp_info_registers(Monitor *mon, const QDict *qdict)
|
|||
cpu_dump_state(cs, NULL, CPU_DUMP_FPU);
|
||||
}
|
||||
} else {
|
||||
cs = mon_get_cpu();
|
||||
cs = mon_get_cpu(mon);
|
||||
|
||||
if (!cs) {
|
||||
monitor_printf(mon, "No CPU available\n");
|
||||
|
@ -381,7 +381,7 @@ static void hmp_info_history(Monitor *mon, const QDict *qdict)
|
|||
|
||||
static void hmp_info_cpustats(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
CPUState *cs = mon_get_cpu();
|
||||
CPUState *cs = mon_get_cpu(mon);
|
||||
|
||||
if (!cs) {
|
||||
monitor_printf(mon, "No CPU available\n");
|
||||
|
@ -546,7 +546,7 @@ static void memory_dump(Monitor *mon, int count, int format, int wsize,
|
|||
int l, line_size, i, max_digits, len;
|
||||
uint8_t buf[16];
|
||||
uint64_t v;
|
||||
CPUState *cs = mon_get_cpu();
|
||||
CPUState *cs = mon_get_cpu(mon);
|
||||
|
||||
if (!cs && (format == 'i' || !is_physical)) {
|
||||
monitor_printf(mon, "Can not dump without CPU\n");
|
||||
|
@ -711,7 +711,7 @@ static void hmp_gva2gpa(Monitor *mon, const QDict *qdict)
|
|||
{
|
||||
target_ulong addr = qdict_get_int(qdict, "addr");
|
||||
MemTxAttrs attrs;
|
||||
CPUState *cs = mon_get_cpu();
|
||||
CPUState *cs = mon_get_cpu(mon);
|
||||
hwaddr gpa;
|
||||
|
||||
if (!cs) {
|
||||
|
@ -1663,10 +1663,10 @@ HMPCommand hmp_cmds[] = {
|
|||
* Set @pval to the value in the register identified by @name.
|
||||
* return 0 if OK, -1 if not found
|
||||
*/
|
||||
int get_monitor_def(int64_t *pval, const char *name)
|
||||
int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)
|
||||
{
|
||||
const MonitorDef *md = target_monitor_defs();
|
||||
CPUState *cs = mon_get_cpu();
|
||||
CPUState *cs = mon_get_cpu(mon);
|
||||
void *ptr;
|
||||
uint64_t tmp = 0;
|
||||
int ret;
|
||||
|
@ -1678,9 +1678,9 @@ int get_monitor_def(int64_t *pval, const char *name)
|
|||
for(; md->name != NULL; md++) {
|
||||
if (hmp_compare_cmd(name, md->name)) {
|
||||
if (md->get_value) {
|
||||
*pval = md->get_value(md, md->offset);
|
||||
*pval = md->get_value(mon, md, md->offset);
|
||||
} else {
|
||||
CPUArchState *env = mon_get_cpu_env();
|
||||
CPUArchState *env = mon_get_cpu_env(mon);
|
||||
ptr = (uint8_t *)env + md->offset;
|
||||
switch(md->type) {
|
||||
case MD_I32:
|
||||
|
|
|
@ -178,7 +178,7 @@ void qmp_send_response(MonitorQMP *mon, const QDict *rsp);
|
|||
void monitor_data_destroy_qmp(MonitorQMP *mon);
|
||||
void coroutine_fn monitor_qmp_dispatcher_co(void *data);
|
||||
|
||||
int get_monitor_def(int64_t *pval, const char *name);
|
||||
int get_monitor_def(Monitor *mon, int64_t *pval, const char *name);
|
||||
void help_cmd(Monitor *mon, const char *name);
|
||||
void handle_hmp_command(MonitorHMP *mon, const char *cmdline);
|
||||
int hmp_compare_cmd(const char *name, const char *list);
|
||||
|
|
|
@ -222,7 +222,7 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
|
|||
{
|
||||
CPUArchState *env;
|
||||
|
||||
env = mon_get_cpu_env();
|
||||
env = mon_get_cpu_env(mon);
|
||||
if (!env) {
|
||||
monitor_printf(mon, "No CPU available\n");
|
||||
return;
|
||||
|
@ -550,7 +550,7 @@ void hmp_info_mem(Monitor *mon, const QDict *qdict)
|
|||
{
|
||||
CPUArchState *env;
|
||||
|
||||
env = mon_get_cpu_env();
|
||||
env = mon_get_cpu_env(mon);
|
||||
if (!env) {
|
||||
monitor_printf(mon, "No CPU available\n");
|
||||
return;
|
||||
|
@ -601,9 +601,10 @@ 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(mon);
|
||||
return env->eip + env->segs[R_CS].base;
|
||||
}
|
||||
|
||||
|
@ -656,7 +657,7 @@ void hmp_info_local_apic(Monitor *mon, const QDict *qdict)
|
|||
int id = qdict_get_try_int(qdict, "apic-id", 0);
|
||||
cs = cpu_by_arch_id(id);
|
||||
} else {
|
||||
cs = mon_get_cpu();
|
||||
cs = mon_get_cpu(mon);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
void hmp_info_tlb(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
CPUArchState *env1 = mon_get_cpu_env();
|
||||
CPUArchState *env1 = mon_get_cpu_env(mon);
|
||||
|
||||
if (!env1) {
|
||||
monitor_printf(mon, "No CPU available\n");
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
void hmp_info_tlb(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
CPUArchState *env1 = mon_get_cpu_env();
|
||||
CPUArchState *env1 = mon_get_cpu_env(mon);
|
||||
|
||||
dump_mmu(env1);
|
||||
}
|
||||
|
|
|
@ -29,9 +29,10 @@
|
|||
#include "monitor/hmp-target.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(mon);
|
||||
unsigned int u;
|
||||
int i;
|
||||
|
||||
|
@ -43,27 +44,30 @@ static target_long monitor_get_ccr(const struct MonitorDef *md, int val)
|
|||
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(mon);
|
||||
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(mon);
|
||||
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(mon);
|
||||
return cpu_ppc_load_tbl(env);
|
||||
}
|
||||
|
||||
void hmp_info_tlb(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
CPUArchState *env1 = mon_get_cpu_env();
|
||||
CPUArchState *env1 = mon_get_cpu_env(mon);
|
||||
|
||||
if (!env1) {
|
||||
monitor_printf(mon, "No CPU available\n");
|
||||
|
|
|
@ -204,7 +204,7 @@ void hmp_info_mem(Monitor *mon, const QDict *qdict)
|
|||
{
|
||||
CPUArchState *env;
|
||||
|
||||
env = mon_get_cpu_env();
|
||||
env = mon_get_cpu_env(mon);
|
||||
if (!env) {
|
||||
monitor_printf(mon, "No CPU available\n");
|
||||
return;
|
||||
|
|
|
@ -41,7 +41,7 @@ static void print_tlb(Monitor *mon, int idx, tlb_t *tlb)
|
|||
|
||||
void hmp_info_tlb(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
CPUArchState *env = mon_get_cpu_env();
|
||||
CPUArchState *env = mon_get_cpu_env(mon);
|
||||
int i;
|
||||
|
||||
if (!env) {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
void hmp_info_tlb(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
CPUArchState *env1 = mon_get_cpu_env();
|
||||
CPUArchState *env1 = mon_get_cpu_env(mon);
|
||||
|
||||
if (!env1) {
|
||||
monitor_printf(mon, "No CPU available\n");
|
||||
|
@ -40,17 +40,19 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
|
|||
}
|
||||
|
||||
#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(mon);
|
||||
|
||||
return cpu_get_psr(env);
|
||||
}
|
||||
#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(mon);
|
||||
return env->regwptr[val];
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
void hmp_info_tlb(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
CPUArchState *env1 = mon_get_cpu_env();
|
||||
CPUArchState *env1 = mon_get_cpu_env(mon);
|
||||
|
||||
if (!env1) {
|
||||
monitor_printf(mon, "No CPU available\n");
|
||||
|
|
Loading…
Reference in a new issue