[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 24/53] target/sh: convert to use format_state instead of dump_
From: |
Daniel P . Berrangé |
Subject: |
[PATCH v2 24/53] target/sh: convert to use format_state instead of dump_state |
Date: |
Tue, 14 Sep 2021 15:20:13 +0100 |
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
target/sh4/cpu.c | 2 +-
target/sh4/cpu.h | 2 +-
target/sh4/translate.c | 36 ++++++++++++++++++++----------------
3 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
index 8326922942..0ac881d6af 100644
--- a/target/sh4/cpu.c
+++ b/target/sh4/cpu.c
@@ -259,7 +259,7 @@ static void superh_cpu_class_init(ObjectClass *oc, void
*data)
cc->class_by_name = superh_cpu_class_by_name;
cc->has_work = superh_cpu_has_work;
- cc->dump_state = superh_cpu_dump_state;
+ cc->format_state = superh_cpu_format_state;
cc->set_pc = superh_cpu_set_pc;
cc->gdb_read_register = superh_cpu_gdb_read_register;
cc->gdb_write_register = superh_cpu_gdb_write_register;
diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h
index 01c4344082..6940ca417a 100644
--- a/target/sh4/cpu.h
+++ b/target/sh4/cpu.h
@@ -206,7 +206,7 @@ struct SuperHCPU {
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, int flags);
+void superh_cpu_format_state(CPUState *cpu, GString *buf, int flags);
hwaddr superh_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
int superh_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
int superh_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
diff --git a/target/sh4/translate.c b/target/sh4/translate.c
index 8704fea1ca..f6fd8939b0 100644
--- a/target/sh4/translate.c
+++ b/target/sh4/translate.c
@@ -156,32 +156,36 @@ void sh4_translate_init(void)
fregnames[i]);
}
-void superh_cpu_dump_state(CPUState *cs, FILE *f, int flags)
+void superh_cpu_format_state(CPUState *cs, GString *buf, int flags)
{
SuperHCPU *cpu = SUPERH_CPU(cs);
CPUSH4State *env = &cpu->env;
int i;
- 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);
+ g_string_append_printf(buf, "pc=0x%08x sr=0x%08x pr=0x%08x fpscr=0x%08x\n",
+ env->pc, cpu_read_sr(env), env->pr, env->fpscr);
+ g_string_append_printf(buf, "spc=0x%08x ssr=0x%08x gbr=0x%08x
vbr=0x%08x\n",
+ env->spc, env->ssr, env->gbr, env->vbr);
+ g_string_append_printf(buf, "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) {
- 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]);
+ g_string_append_printf(buf, "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) {
- qemu_printf("in delay slot (delayed_pc=0x%08x)\n",
- env->delayed_pc);
+ g_string_append_printf(buf, "in delay slot (delayed_pc=0x%08x)\n",
+ env->delayed_pc);
} else if (env->flags & DELAY_SLOT_CONDITIONAL) {
- qemu_printf("in conditional delay slot (delayed_pc=0x%08x)\n",
- env->delayed_pc);
+ g_string_append_printf(buf, "in conditional delay slot "
+ "(delayed_pc=0x%08x)\n",
+ env->delayed_pc);
} else if (env->flags & DELAY_SLOT_RTE) {
- qemu_fprintf(f, "in rte delay slot (delayed_pc=0x%08x)\n",
- env->delayed_pc);
+ g_string_append_printf(buf, "in rte delay slot (delayed_pc=0x%08x)\n",
+ env->delayed_pc);
}
}
--
2.31.1
- Re: [PATCH v2 18/53] target/nios2: convert to use format_state instead of dump_state, (continued)
- [PATCH v2 19/53] target/openrisc: convert to use format_state instead of dump_state, Daniel P . Berrangé, 2021/09/14
- [PATCH v2 20/53] target/ppc: convert to use format_state instead of dump_state, Daniel P . Berrangé, 2021/09/14
- [PATCH v2 21/53] target/riscv: convert to use format_state instead of dump_state, Daniel P . Berrangé, 2021/09/14
- [PATCH v2 22/53] target/rx: convert to use format_state instead of dump_state, Daniel P . Berrangé, 2021/09/14
- [PATCH v2 23/53] target/s390x: convert to use format_state instead of dump_state, Daniel P . Berrangé, 2021/09/14
- [PATCH v2 24/53] target/sh: convert to use format_state instead of dump_state,
Daniel P . Berrangé <=
- [PATCH v2 25/53] target/sparc: convert to use format_state instead of dump_state, Daniel P . Berrangé, 2021/09/14
- [PATCH v2 26/53] target/tricore: convert to use format_state instead of dump_state, Daniel P . Berrangé, 2021/09/14
- [PATCH v2 27/53] target/xtensa: convert to use format_state instead of dump_state, Daniel P . Berrangé, 2021/09/14