mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 10:34:58 -06:00
qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
CPUClass method dump_statistics() takes an fprintf()-like callback and a FILE * to pass to it. Most callers pass fprintf() and stderr. log_cpu_state() passes fprintf() and qemu_log_file. hmp_info_registers() passes monitor_fprintf() and the current monitor cast to FILE *. monitor_fprintf() casts it right back, and is otherwise identical to monitor_printf(). The callback gets passed around a lot, which is tiresome. The type-punning around monitor_fprintf() is ugly. Drop the callback, and call qemu_fprintf() instead. Also gets rid of the type-punning, since qemu_fprintf() takes NULL instead of the current monitor cast to FILE *. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20190417191805.28198-15-armbru@redhat.com>
This commit is contained in:
parent
19aaa4c3fd
commit
90c84c5600
63 changed files with 682 additions and 711 deletions
|
@ -232,8 +232,7 @@ static inline SuperHCPU *sh_env_get_cpu(CPUSH4State *env)
|
|||
|
||||
void superh_cpu_do_interrupt(CPUState *cpu);
|
||||
bool superh_cpu_exec_interrupt(CPUState *cpu, int int_req);
|
||||
void superh_cpu_dump_state(CPUState *cpu, FILE *f,
|
||||
fprintf_function cpu_fprintf, int flags);
|
||||
void superh_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
|
||||
hwaddr superh_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
|
||||
int superh_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||
int superh_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "exec/translator.h"
|
||||
#include "trace-tcg.h"
|
||||
#include "exec/log.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
|
||||
|
||||
typedef struct DisasContext {
|
||||
|
@ -156,32 +157,32 @@ void sh4_translate_init(void)
|
|||
fregnames[i]);
|
||||
}
|
||||
|
||||
void superh_cpu_dump_state(CPUState *cs, FILE *f,
|
||||
fprintf_function cpu_fprintf, int flags)
|
||||
void superh_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
{
|
||||
SuperHCPU *cpu = SUPERH_CPU(cs);
|
||||
CPUSH4State *env = &cpu->env;
|
||||
int i;
|
||||
cpu_fprintf(f, "pc=0x%08x sr=0x%08x pr=0x%08x fpscr=0x%08x\n",
|
||||
env->pc, cpu_read_sr(env), env->pr, env->fpscr);
|
||||
cpu_fprintf(f, "spc=0x%08x ssr=0x%08x gbr=0x%08x vbr=0x%08x\n",
|
||||
env->spc, env->ssr, env->gbr, env->vbr);
|
||||
cpu_fprintf(f, "sgr=0x%08x dbr=0x%08x delayed_pc=0x%08x fpul=0x%08x\n",
|
||||
env->sgr, env->dbr, env->delayed_pc, env->fpul);
|
||||
|
||||
qemu_fprintf(f, "pc=0x%08x sr=0x%08x pr=0x%08x fpscr=0x%08x\n",
|
||||
env->pc, cpu_read_sr(env), env->pr, env->fpscr);
|
||||
qemu_fprintf(f, "spc=0x%08x ssr=0x%08x gbr=0x%08x vbr=0x%08x\n",
|
||||
env->spc, env->ssr, env->gbr, env->vbr);
|
||||
qemu_fprintf(f, "sgr=0x%08x dbr=0x%08x delayed_pc=0x%08x fpul=0x%08x\n",
|
||||
env->sgr, env->dbr, env->delayed_pc, env->fpul);
|
||||
for (i = 0; i < 24; i += 4) {
|
||||
cpu_fprintf(f, "r%d=0x%08x r%d=0x%08x r%d=0x%08x r%d=0x%08x\n",
|
||||
qemu_printf("r%d=0x%08x r%d=0x%08x r%d=0x%08x r%d=0x%08x\n",
|
||||
i, env->gregs[i], i + 1, env->gregs[i + 1],
|
||||
i + 2, env->gregs[i + 2], i + 3, env->gregs[i + 3]);
|
||||
}
|
||||
if (env->flags & DELAY_SLOT) {
|
||||
cpu_fprintf(f, "in delay slot (delayed_pc=0x%08x)\n",
|
||||
qemu_printf("in delay slot (delayed_pc=0x%08x)\n",
|
||||
env->delayed_pc);
|
||||
} else if (env->flags & DELAY_SLOT_CONDITIONAL) {
|
||||
cpu_fprintf(f, "in conditional delay slot (delayed_pc=0x%08x)\n",
|
||||
qemu_printf("in conditional delay slot (delayed_pc=0x%08x)\n",
|
||||
env->delayed_pc);
|
||||
} else if (env->flags & DELAY_SLOT_RTE) {
|
||||
cpu_fprintf(f, "in rte delay slot (delayed_pc=0x%08x)\n",
|
||||
env->delayed_pc);
|
||||
qemu_fprintf(f, "in rte delay slot (delayed_pc=0x%08x)\n",
|
||||
env->delayed_pc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue