aboutsummaryrefslogtreecommitdiff
path: root/target/sh4/translate.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2019-04-17 21:18:02 +0200
committerMarkus Armbruster <armbru@redhat.com>2019-04-18 22:18:59 +0200
commit90c84c56006747537e9e4240271523c4c3b7a481 (patch)
tree7cb7cc06e9dfae5c89d0581e6b9458349ed82260 /target/sh4/translate.c
parent19aaa4c3fd15eeb82f10c35ffc7d53e103d10787 (diff)
downloadqemu-90c84c56006747537e9e4240271523c4c3b7a481.zip
qemu-90c84c56006747537e9e4240271523c4c3b7a481.tar.gz
qemu-90c84c56006747537e9e4240271523c4c3b7a481.tar.bz2
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>
Diffstat (limited to 'target/sh4/translate.c')
-rw-r--r--target/sh4/translate.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/target/sh4/translate.c b/target/sh4/translate.c
index ab254b0..cffc691 100644
--- a/target/sh4/translate.c
+++ b/target/sh4/translate.c
@@ -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);
}
}