[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 27/53] target/xtensa: convert to use format_state instead
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH v2 27/53] target/xtensa: convert to use format_state instead of dump_state |
Date: |
Wed, 15 Sep 2021 09:52:51 +0100 |
User-agent: |
Mutt/2.0.7 (2021-05-04) |
On Wed, Sep 15, 2021 at 09:32:38AM +0200, Philippe Mathieu-Daudé wrote:
> On 9/14/21 4:20 PM, Daniel P. Berrangé wrote:
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> > target/xtensa/cpu.c | 2 +-
> > target/xtensa/cpu.h | 2 +-
> > target/xtensa/translate.c | 45 ++++++++++++++++++++-------------------
> > 3 files changed, 25 insertions(+), 24 deletions(-)
>
> > -void xtensa_cpu_dump_state(CPUState *cs, FILE *f, int flags)
> > +void xtensa_cpu_format_state(CPUState *cs, GString *buf, int flags)
> > {
> > XtensaCPU *cpu = XTENSA_CPU(cs);
> > CPUXtensaState *env = &cpu->env;
> > xtensa_isa isa = env->config->isa;
> > int i, j;
> >
> > - qemu_fprintf(f, "PC=%08x\n\n", env->pc);
> > + g_string_append_printf(buf, "PC=%08x\n\n", env->pc);
> >
> > for (i = j = 0; i < xtensa_isa_num_sysregs(isa); ++i) {
> > const uint32_t *reg =
> > @@ -1340,55 +1340,56 @@ void xtensa_cpu_dump_state(CPUState *cs, FILE *f,
> > int flags)
> > int regno = xtensa_sysreg_number(isa, i);
> >
> > if (regno >= 0) {
> > - qemu_fprintf(f, "%12s=%08x%c",
> > - xtensa_sysreg_name(isa, i),
> > - reg[regno],
> > - (j++ % 4) == 3 ? '\n' : ' ');
> > + g_string_append_printf(buf, "%12s=%08x%c",
> > + xtensa_sysreg_name(isa, i),
> > + reg[regno],
> > + (j++ % 4) == 3 ? '\n' : ' ');
> > }
> > }
> >
> > - qemu_fprintf(f, (j % 4) == 0 ? "\n" : "\n\n");
> > + g_string_append_printf(buf, (j % 4) == 0 ? "\n" : "\n\n");
> >
> > for (i = 0; i < 16; ++i) {
> > - qemu_fprintf(f, " A%02d=%08x%c",
> > - i, env->regs[i], (i % 4) == 3 ? '\n' : ' ');
> > + g_string_append_printf(buf, " A%02d=%08x%c",
> > + i, env->regs[i], (i % 4) == 3 ? '\n' : ' ');
> > }
> >
> > xtensa_sync_phys_from_window(env);
> > - qemu_fprintf(f, "\n");
> > + g_string_append_printf(buf, "\n");
>
> g_string_append_c(); pre-existing but better to move it before
> xtensa_sync_phys_from_window().
I don't want to be re-arranging the code in this series. It is just
a straight search/replace of qemu_fprintf with g_string_append_printf,
with the bare minimum of other changes, to minimize risk of breaking
something unexpected.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
[PATCH v2 30/53] qapi: introduce x-query-roms QMP command, Daniel P . Berrangé, 2021/09/14