[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 1/1] target/riscv: Print CPU and privledge in disas
From: |
Alistair Francis |
Subject: |
Re: [PATCH v1 1/1] target/riscv: Print CPU and privledge in disas |
Date: |
Fri, 27 Sep 2019 10:03:32 -0700 |
On Fri, Sep 27, 2019 at 2:10 AM Philippe Mathieu-Daudé
<address@hidden> wrote:
>
> On 9/27/19 2:45 AM, Alistair Francis wrote:
> > Signed-off-by: Alistair Francis <address@hidden>
> > ---
> > target/riscv/translate.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/target/riscv/translate.c b/target/riscv/translate.c
> > index adeddb85f6..537af0003e 100644
> > --- a/target/riscv/translate.c
> > +++ b/target/riscv/translate.c
> > @@ -810,7 +810,14 @@ static void riscv_tr_tb_stop(DisasContextBase *dcbase,
> > CPUState *cpu)
> >
> > static void riscv_tr_disas_log(const DisasContextBase *dcbase, CPUState
> > *cpu)
> > {
> > +#ifndef CONFIG_USER_ONLY
> > + RISCVCPU *rvcpu = RISCV_CPU(cpu);
> > + CPURISCVState *env = &rvcpu->env;
> > +#endif
> > qemu_log("IN: %s\n", lookup_symbol(dcbase->pc_first));
> > +#ifndef CONFIG_USER_ONLY
> > + qemu_log("CPU: %d; priv: "TARGET_FMT_ld"\n", cpu->cpu_index,
> > env->priv);
> > +#endif
>
> Nit: can be extracted as another function to reduce the ifdef'ry and
> simply use:
>
> log_cpu_priv(cpu);
>
> > log_target_disas(cpu, dcbase->pc_first, dcbase->tb->size);
> > }
> >
>
> With function previously defined:
>
> static void log_cpu_priv(const CPUState *cpu)
> {
> #ifndef CONFIG_USER_ONLY
> RISCVCPU *rvcpu = RISCV_CPU(cpu);
> CPURISCVState *env = &rvcpu->env;
>
> qemu_log("CPU: %d; priv: "TARGET_FMT_ld"\n", cpu->cpu_index, env->priv);
> #endif
> }
>
> Anyway, fixing the typo in the patch subject:
> Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Thanks I have included your comment and Bin's comments in v2.
Alistair
>