aboutsummaryrefslogtreecommitdiff
path: root/target/tricore
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/tricore
parent19aaa4c3fd15eeb82f10c35ffc7d53e103d10787 (diff)
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/tricore')
-rw-r--r--target/tricore/cpu.h3
-rw-r--r--target/tricore/translate.c26
2 files changed, 14 insertions, 15 deletions
diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h
index 43d577ce8e..64d1a9c75e 100644
--- a/target/tricore/cpu.h
+++ b/target/tricore/cpu.h
@@ -224,8 +224,7 @@ static inline TriCoreCPU *tricore_env_get_cpu(CPUTriCoreState *env)
#define ENV_OFFSET offsetof(TriCoreCPU, env)
hwaddr tricore_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-void tricore_cpu_dump_state(CPUState *cpu, FILE *f,
- fprintf_function cpu_fprintf, int flags);
+void tricore_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
#define MASK_PCXI_PCPN 0xff000000
diff --git a/target/tricore/translate.c b/target/tricore/translate.c
index b12c391be5..352f52bb4a 100644
--- a/target/tricore/translate.c
+++ b/target/tricore/translate.c
@@ -24,6 +24,7 @@
#include "exec/exec-all.h"
#include "tcg-op.h"
#include "exec/cpu_ldst.h"
+#include "qemu/qemu-print.h"
#include "exec/helper-proto.h"
#include "exec/helper-gen.h"
@@ -88,8 +89,7 @@ enum {
MODE_UU = 3,
};
-void tricore_cpu_dump_state(CPUState *cs, FILE *f,
- fprintf_function cpu_fprintf, int flags)
+void tricore_cpu_dump_state(CPUState *cs, FILE *f, int flags)
{
TriCoreCPU *cpu = TRICORE_CPU(cs);
CPUTriCoreState *env = &cpu->env;
@@ -98,26 +98,26 @@ void tricore_cpu_dump_state(CPUState *cs, FILE *f,
psw = psw_read(env);
- cpu_fprintf(f, "PC: " TARGET_FMT_lx, env->PC);
- cpu_fprintf(f, " PSW: " TARGET_FMT_lx, psw);
- cpu_fprintf(f, " ICR: " TARGET_FMT_lx, env->ICR);
- cpu_fprintf(f, "\nPCXI: " TARGET_FMT_lx, env->PCXI);
- cpu_fprintf(f, " FCX: " TARGET_FMT_lx, env->FCX);
- cpu_fprintf(f, " LCX: " TARGET_FMT_lx, env->LCX);
+ qemu_fprintf(f, "PC: " TARGET_FMT_lx, env->PC);
+ qemu_fprintf(f, " PSW: " TARGET_FMT_lx, psw);
+ qemu_fprintf(f, " ICR: " TARGET_FMT_lx, env->ICR);
+ qemu_fprintf(f, "\nPCXI: " TARGET_FMT_lx, env->PCXI);
+ qemu_fprintf(f, " FCX: " TARGET_FMT_lx, env->FCX);
+ qemu_fprintf(f, " LCX: " TARGET_FMT_lx, env->LCX);
for (i = 0; i < 16; ++i) {
if ((i & 3) == 0) {
- cpu_fprintf(f, "\nGPR A%02d:", i);
+ qemu_fprintf(f, "\nGPR A%02d:", i);
}
- cpu_fprintf(f, " " TARGET_FMT_lx, env->gpr_a[i]);
+ qemu_fprintf(f, " " TARGET_FMT_lx, env->gpr_a[i]);
}
for (i = 0; i < 16; ++i) {
if ((i & 3) == 0) {
- cpu_fprintf(f, "\nGPR D%02d:", i);
+ qemu_fprintf(f, "\nGPR D%02d:", i);
}
- cpu_fprintf(f, " " TARGET_FMT_lx, env->gpr_d[i]);
+ qemu_fprintf(f, " " TARGET_FMT_lx, env->gpr_d[i]);
}
- cpu_fprintf(f, "\n");
+ qemu_fprintf(f, "\n");
}
/*