Received: from eggs.gnu.org ([2001:4830:134:3::10]:39497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSEsZ-0002jt-Ig for qemu-devel@nongnu.org; Tue, 26 Jul 2016 22:47:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSEsV-0001o9-OS for qemu-devel@nongnu.org; Tue, 26 Jul 2016 22:47:26 -0400 Date: Wed, 27 Jul 2016 12:26:40 +1000 From: David Gibson Message-ID: <20160727022639.GW17429@voom.fritz.box> References: <1469571686-7284-1-git-send-email-benh@kernel.crashing.org> <1469571686-7284-21-git-send-email-benh@kernel.crashing.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qxpYSgLynlcP4boX" Content-Disposition: inline In-Reply-To: <1469571686-7284-21-git-send-email-benh@kernel.crashing.org> Subject: Re: [Qemu-devel] [PATCH 21/32] ppc: Don't update NIP on conditional trap instructions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Benjamin Herrenschmidt Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org --qxpYSgLynlcP4boX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 27, 2016 at 08:21:15AM +1000, Benjamin Herrenschmidt wrote: > This is no longer necessary as the helpers will properly retrieve > the return address when needed. Is this right? Don't the tw etc. instructions continue on rather than retrying if an exception occurs? >=20 > Signed-off-by: Benjamin Herrenschmidt > --- > target-ppc/excp_helper.c | 6 ++++-- > target-ppc/translate.c | 8 -------- > 2 files changed, 4 insertions(+), 10 deletions(-) >=20 > diff --git a/target-ppc/excp_helper.c b/target-ppc/excp_helper.c > index 570d188..c31bbad 100644 > --- a/target-ppc/excp_helper.c > +++ b/target-ppc/excp_helper.c > @@ -1031,7 +1031,8 @@ void helper_tw(CPUPPCState *env, target_ulong arg1,= target_ulong arg2, > ((int32_t)arg1 =3D=3D (int32_t)arg2 && (flags & 0x04))= || > ((uint32_t)arg1 < (uint32_t)arg2 && (flags & 0x02)) || > ((uint32_t)arg1 > (uint32_t)arg2 && (flags & 0x01)))))= { > - raise_exception_err(env, POWERPC_EXCP_PROGRAM, POWERPC_EXCP_TRAP= ); > + raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM, > + POWERPC_EXCP_TRAP, GETPC()); > } > } > =20 > @@ -1044,7 +1045,8 @@ void helper_td(CPUPPCState *env, target_ulong arg1,= target_ulong arg2, > ((int64_t)arg1 =3D=3D (int64_t)arg2 && (flags & 0x04))= || > ((uint64_t)arg1 < (uint64_t)arg2 && (flags & 0x02)) || > ((uint64_t)arg1 > (uint64_t)arg2 && (flags & 0x01)))))= { > - raise_exception_err(env, POWERPC_EXCP_PROGRAM, POWERPC_EXCP_TRAP= ); > + raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM, > + POWERPC_EXCP_TRAP, GETPC()); > } > } > #endif > diff --git a/target-ppc/translate.c b/target-ppc/translate.c > index 8f5afba..7163b19 100644 > --- a/target-ppc/translate.c > +++ b/target-ppc/translate.c > @@ -3365,8 +3365,6 @@ static void gen_sc(DisasContext *ctx) > static void gen_tw(DisasContext *ctx) > { > TCGv_i32 t0 =3D tcg_const_i32(TO(ctx->opcode)); > - /* Update the nip since this might generate a trap exception */ > - gen_update_nip(ctx, ctx->nip - 4); > gen_helper_tw(cpu_env, cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opc= ode)], > t0); > tcg_temp_free_i32(t0); > @@ -3377,8 +3375,6 @@ static void gen_twi(DisasContext *ctx) > { > TCGv t0 =3D tcg_const_tl(SIMM(ctx->opcode)); > TCGv_i32 t1 =3D tcg_const_i32(TO(ctx->opcode)); > - /* Update the nip since this might generate a trap exception */ > - gen_update_nip(ctx, ctx->nip - 4); > gen_helper_tw(cpu_env, cpu_gpr[rA(ctx->opcode)], t0, t1); > tcg_temp_free(t0); > tcg_temp_free_i32(t1); > @@ -3389,8 +3385,6 @@ static void gen_twi(DisasContext *ctx) > static void gen_td(DisasContext *ctx) > { > TCGv_i32 t0 =3D tcg_const_i32(TO(ctx->opcode)); > - /* Update the nip since this might generate a trap exception */ > - gen_update_nip(ctx, ctx->nip - 4); > gen_helper_td(cpu_env, cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opc= ode)], > t0); > tcg_temp_free_i32(t0); > @@ -3401,8 +3395,6 @@ static void gen_tdi(DisasContext *ctx) > { > TCGv t0 =3D tcg_const_tl(SIMM(ctx->opcode)); > TCGv_i32 t1 =3D tcg_const_i32(TO(ctx->opcode)); > - /* Update the nip since this might generate a trap exception */ > - gen_update_nip(ctx, ctx->nip - 4); > gen_helper_td(cpu_env, cpu_gpr[rA(ctx->opcode)], t0, t1); > tcg_temp_free(t0); > tcg_temp_free_i32(t1); --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --qxpYSgLynlcP4boX Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXmBvfAAoJEGw4ysog2bOS7XcP/1CAE3oMa3gRuPx02eMS+/ur Ij37gwhpJOmc1SDayI6nBC+fKotiJksKpybIn/sk6bRB1mAFML+nAlwR68WkBo+k lGG4FSiKBOqJ2zt82NJ9q4/8m4z+V17qxKk6jw5XQtvHimc4Vj+kvaviO4x3gwKJ /+1A+oyDfD//Oi7F4+UhMVPOrmodaD2XqP2qgSSIfC+EEs0hwqxqWz2cHHnDJnU7 5SBzuBtXCqvDe54H2KiIUBKnY8tJ/CB/ferqSnVrh/I+vgr0UGSmWSqk5bpanr65 /R0EHSkXYhqlN74kdRByy3sxv2KShd2WLFB9a1xTqFzvKQMbGreFh0VarceAAoe7 0YmwGP2Zz+b607MrDUsqexJs5nrgqYq6JUJpC6JjcUf7db//npR3juS3rtHUdMfi vK8sIgpHpgq2VVuphUn0kdcajschmJT0fuBzQVGbPMmWhSVRzF7Vo9FAt6mKF2Kc cTeaxdn13EtZB9947YjImTAumRhLI8tkl/T9ZIZhOHfvot9am81dIxZ4BC2p22A6 RfEcta+fw9JbQblMNGZ/r87xGe7VYE7ri1QL3iNNYlg87hHjM9HOUEh8z6nZqEyD ldk4OJ7lHfmpxf1NHgRT0LI59ngTN58hzECuog5M1cv/iku2VJuAU/kX3czd3/t+ g6+2p9CEVweWkR3KZxLa =/a4p -----END PGP SIGNATURE----- --qxpYSgLynlcP4boX--