From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:47460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMQP1-0005XV-Ao for qemu-devel@nongnu.org; Tue, 17 May 2011 15:58:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QMQP0-0004qB-AE for qemu-devel@nongnu.org; Tue, 17 May 2011 15:57:59 -0400 Received: from mail-qy0-f180.google.com ([209.85.216.180]:54295) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMQP0-0004q5-1R for qemu-devel@nongnu.org; Tue, 17 May 2011 15:57:58 -0400 Received: by qyk10 with SMTP id 10so513016qyk.4 for ; Tue, 17 May 2011 12:57:57 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Blue Swirl Date: Tue, 17 May 2011 22:57:37 +0300 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/2][SPARC] Fix TA0_Shutdown feature List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Julien Grall Cc: qemu-devel@nongnu.org, Fabien Chouteau On Tue, May 17, 2011 at 6:32 PM, Julien Grall wrot= e: > Fix TA0_SHUTDOWN feature But what would be the bug? > Signed-off-by: Julien Grall > --- > =C2=A0target-sparc/op_helper.c | =C2=A0 13 +++++++++++-- > =C2=A0target-sparc/translate.c | =C2=A0 =C2=A09 +-------- > =C2=A02 files changed, 12 insertions(+), 10 deletions(-) > > diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c > index a6fabad..cb775f5 100644 > --- a/target-sparc/op_helper.c > +++ b/target-sparc/op_helper.c > @@ -326,8 +326,17 @@ void HELPER(raise_exception)(int tt) > > =C2=A0void HELPER(trap_always)(int tt) > =C2=A0{ > - =C2=A0 =C2=A0env->exception_index =3D tt; > - =C2=A0 =C2=A0do_interrupt(env); > + =C2=A0 =C2=A0if (tt =3D=3D TT_TRAP > + =C2=A0 =C2=A0 =C2=A0 =C2=A0&& env->def->features & CPU_FEATURE_TA0_SHUT= DOWN > +#ifndef TARGET_SPARC64 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0&& env->psret =3D=3D 0 > +#endif > + =C2=A0 =C2=A0 =C2=A0 =C2=A0) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0helper_shutdown(); > + =C2=A0 =C2=A0} else { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0env->exception_index =3D tt; > + =C2=A0 =C2=A0 =C2=A0 =C2=A0do_interrupt(env); > + =C2=A0 =C2=A0} > =C2=A0} > > =C2=A0void helper_shutdown(void) > diff --git a/target-sparc/translate.c b/target-sparc/translate.c > index b30003b..a47a2de 100644 > --- a/target-sparc/translate.c > +++ b/target-sparc/translate.c > @@ -2009,14 +2009,7 @@ static void disas_sparc_insn(DisasContext * dc) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 tcg= _gen_addi_tl(cpu_dst, cpu_dst, TT_TRAP); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 tcg= _gen_trunc_tl_i32(cpu_tmp32, cpu_dst); > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if= (rs2 =3D=3D 0 && > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0dc->def->features & CPU_FEATURE_TA0_SHUTDOWN) { > - > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0gen_helper_shutdown(); > - > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} = else { > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0gen_helper_trap_always(cpu_tmp32); > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ge= n_helper_trap_always(cpu_tmp32); No, this would actually be just opposite to how QEMU works. Performance comes from doing more work at translation time in order to save time during executing the generated code.