From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjaDl-00024G-3Z for qemu-devel@nongnu.org; Mon, 12 Sep 2016 19:01:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjaDf-0004ki-1N for qemu-devel@nongnu.org; Mon, 12 Sep 2016 19:00:59 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35656) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjaDe-0004kO-PU for qemu-devel@nongnu.org; Mon, 12 Sep 2016 19:00:54 -0400 Received: by mail-wm0-f66.google.com with SMTP id c131so369716wmh.2 for ; Mon, 12 Sep 2016 16:00:54 -0700 (PDT) Date: Tue, 13 Sep 2016 00:59:51 +0200 From: "Edgar E. Iglesias" Message-ID: <20160912225951.GN16305@toto> References: <1473076452-19795-1-git-send-email-rabin.vincent@axis.com> <1473076452-19795-6-git-send-email-rabin.vincent@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1473076452-19795-6-git-send-email-rabin.vincent@axis.com> Subject: Re: [Qemu-devel] [PATCH 6/9] target-cris: reduce v32isms from v10 log dumps List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Rabin Vincent Cc: qemu-devel@nongnu.org, Hans-Peter Nilsson , Rabin Vincent On Mon, Sep 05, 2016 at 01:54:09PM +0200, Rabin Vincent wrote: > From: Hans-Peter Nilsson > > Use the correct register names for v10 and don't dump support function > registers for pre-v32. > > Signed-off-by: Hans-Peter Nilsson > Signed-off-by: Rabin Vincent > --- > target-cris/translate.c | 36 +++++++++++++++++++++++------------- > 1 file changed, 23 insertions(+), 13 deletions(-) > > diff --git a/target-cris/translate.c b/target-cris/translate.c > index c280e24..a4512b5 100644 > --- a/target-cris/translate.c > +++ b/target-cris/translate.c > @@ -140,14 +140,14 @@ static void gen_BUG(DisasContext *dc, const char *file, int line) > cpu_abort(CPU(dc->cpu), "%s:%d\n", file, line); > } > > -static const char *regnames[] = > +static const char *regnames_v32[] = > { > "$r0", "$r1", "$r2", "$r3", > "$r4", "$r5", "$r6", "$r7", > "$r8", "$r9", "$r10", "$r11", > "$r12", "$r13", "$sp", "$acr", > }; > -static const char *pregnames[] = > +static const char *pregnames_v32[] = > { > "$bz", "$vr", "$pid", "$srs", > "$wz", "$exs", "$eda", "$mof", > @@ -3336,12 +3336,20 @@ void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, > { > CRISCPU *cpu = CRIS_CPU(cs); > CPUCRISState *env = &cpu->env; > + const char **regnames; > + const char **pregnames; > int i; > - uint32_t srs; > > if (!env || !f) { > return; > } > + if (env->pregs[PR_VR] < 32) { > + pregnames = pregnames_v10; > + regnames = regnames_v10; > + } else { > + pregnames = pregnames_v32; > + regnames = regnames_v32; > + } > > cpu_fprintf(f, "PC=%x CCS=%x btaken=%d btarget=%x\n" > "cc_op=%d cc_src=%d cc_dest=%d cc_result=%x cc_mask=%x\n", > @@ -3363,14 +3371,16 @@ void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, > cpu_fprintf(f, "\n"); > } > } > - srs = env->pregs[PR_SRS]; > - cpu_fprintf(f, "\nsupport function regs bank %x:\n", srs); > - if (srs < ARRAY_SIZE(env->sregs)) { > - for (i = 0; i < 16; i++) { > - cpu_fprintf(f, "s%2.2d=%8.8x ", > - i, env->sregs[srs][i]); > - if ((i + 1) % 4 == 0) { > - cpu_fprintf(f, "\n"); > + if (env->pregs[PR_SRS] >= 32) { did you mean env->pregs[PR_VR] >= 32 here? > + uint32_t srs = env->pregs[PR_SRS]; > + cpu_fprintf(f, "\nsupport function regs bank %x:\n", srs); > + if (srs < ARRAY_SIZE(env->sregs)) { > + for (i = 0; i < 16; i++) { > + cpu_fprintf(f, "s%2.2d=%8.8x ", > + i, env->sregs[srs][i]); > + if ((i + 1) % 4 == 0) { > + cpu_fprintf(f, "\n"); > + } > } > } > } > @@ -3415,12 +3425,12 @@ void cris_initialize_tcg(void) > for (i = 0; i < 16; i++) { > cpu_R[i] = tcg_global_mem_new(cpu_env, > offsetof(CPUCRISState, regs[i]), > - regnames[i]); > + regnames_v32[i]); > } > for (i = 0; i < 16; i++) { > cpu_PR[i] = tcg_global_mem_new(cpu_env, > offsetof(CPUCRISState, pregs[i]), > - pregnames[i]); > + pregnames_v32[i]); > } > } > > -- > 2.1.4 >