qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 13/53] target/hppa: convert to use format_state instead of dum


From: Daniel P . Berrangé
Subject: [PATCH v2 13/53] target/hppa: convert to use format_state instead of dump_state
Date: Tue, 14 Sep 2021 15:20:02 +0100

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 target/hppa/cpu.c    |  2 +-
 target/hppa/cpu.h    |  2 +-
 target/hppa/helper.c | 25 ++++++++++++++-----------
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index 2eace4ee12..f7fe7c49d6 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -164,7 +164,7 @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data)
 
     cc->class_by_name = hppa_cpu_class_by_name;
     cc->has_work = hppa_cpu_has_work;
-    cc->dump_state = hppa_cpu_dump_state;
+    cc->format_state = hppa_cpu_format_state;
     cc->set_pc = hppa_cpu_set_pc;
     cc->gdb_read_register = hppa_cpu_gdb_read_register;
     cc->gdb_write_register = hppa_cpu_gdb_write_register;
diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h
index 748270bfa3..d4f1922545 100644
--- a/target/hppa/cpu.h
+++ b/target/hppa/cpu.h
@@ -327,7 +327,7 @@ int hppa_cpu_gdb_read_register(CPUState *cpu, GByteArray 
*buf, int reg);
 int hppa_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
 void hppa_cpu_do_interrupt(CPUState *cpu);
 bool hppa_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void hppa_cpu_dump_state(CPUState *cs, FILE *f, int);
+void hppa_cpu_format_state(CPUState *cs, GString *buf, int);
 bool hppa_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
                        MMUAccessType access_type, int mmu_idx,
                        bool probe, uintptr_t retaddr);
diff --git a/target/hppa/helper.c b/target/hppa/helper.c
index 1ccff5765a..6e30d1ea63 100644
--- a/target/hppa/helper.c
+++ b/target/hppa/helper.c
@@ -76,7 +76,7 @@ void cpu_hppa_put_psw(CPUHPPAState *env, target_ureg psw)
     }
 }
 
-void hppa_cpu_dump_state(CPUState *cs, FILE *f, int flags)
+void hppa_cpu_format_state(CPUState *cs, GString *buf, int flags)
 {
     HPPACPU *cpu = HPPA_CPU(cs);
     CPUHPPAState *env = &cpu->env;
@@ -85,9 +85,10 @@ void hppa_cpu_dump_state(CPUState *cs, FILE *f, int flags)
     char psw_c[20];
     int i;
 
-    qemu_fprintf(f, "IA_F " TARGET_FMT_lx " IA_B " TARGET_FMT_lx "\n",
-                 hppa_form_gva_psw(psw, env->iasq_f, env->iaoq_f),
-                 hppa_form_gva_psw(psw, env->iasq_b, env->iaoq_b));
+    g_string_append_printf(buf,
+                           "IA_F " TARGET_FMT_lx " IA_B " TARGET_FMT_lx "\n",
+                           hppa_form_gva_psw(psw, env->iasq_f, env->iaoq_f),
+                           hppa_form_gva_psw(psw, env->iasq_b, env->iaoq_b));
 
     psw_c[0]  = (psw & PSW_W ? 'W' : '-');
     psw_c[1]  = (psw & PSW_E ? 'E' : '-');
@@ -110,20 +111,22 @@ void hppa_cpu_dump_state(CPUState *cs, FILE *f, int flags)
     psw_c[18] = '\0';
     psw_cb = ((env->psw_cb >> 4) & 0x01111111) | (env->psw_cb_msb << 28);
 
-    qemu_fprintf(f, "PSW  " TREG_FMT_lx " CB   " TREG_FMT_lx " %s\n",
-                 psw, psw_cb, psw_c);
+    g_string_append_printf(buf,
+                           "PSW  " TREG_FMT_lx " CB   " TREG_FMT_lx " %s\n",
+                           psw, psw_cb, psw_c);
 
     for (i = 0; i < 32; i++) {
-        qemu_fprintf(f, "GR%02d " TREG_FMT_lx "%c", i, env->gr[i],
-                     (i & 3) == 3 ? '\n' : ' ');
+        g_string_append_printf(buf, "GR%02d " TREG_FMT_lx "%c", i, env->gr[i],
+                               (i & 3) == 3 ? '\n' : ' ');
     }
 #ifndef CONFIG_USER_ONLY
     for (i = 0; i < 8; i++) {
-        qemu_fprintf(f, "SR%02d %08x%c", i, (uint32_t)(env->sr[i] >> 32),
-                     (i & 3) == 3 ? '\n' : ' ');
+        g_string_append_printf(buf,
+                               "SR%02d %08x%c", i, (uint32_t)(env->sr[i] >> 
32),
+                               (i & 3) == 3 ? '\n' : ' ');
     }
 #endif
-     qemu_fprintf(f, "\n");
+     g_string_append_printf(buf, "\n");
 
     /* ??? FR */
 }
-- 
2.31.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]