From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LCH0o-0004ax-HF for qemu-devel@nongnu.org; Mon, 15 Dec 2008 12:13:42 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LCH0n-0004Zb-9W for qemu-devel@nongnu.org; Mon, 15 Dec 2008 12:13:41 -0500 Received: from [199.232.76.173] (port=38765 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCH0n-0004ZL-2X for qemu-devel@nongnu.org; Mon, 15 Dec 2008 12:13:41 -0500 Received: from savannah.gnu.org ([199.232.41.3]:48395 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LCH0m-0004cd-Jh for qemu-devel@nongnu.org; Mon, 15 Dec 2008 12:13:40 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LCH0m-0002oQ-11 for qemu-devel@nongnu.org; Mon, 15 Dec 2008 17:13:40 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LCH0l-0002oM-In for qemu-devel@nongnu.org; Mon, 15 Dec 2008 17:13:39 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Mon, 15 Dec 2008 17:13:39 +0000 Subject: [Qemu-devel] [6045] target-ppc: update nip before calling an helper in FP instructions Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6045 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6045 Author: aurel32 Date: 2008-12-15 17:13:39 +0000 (Mon, 15 Dec 2008) Log Message: ----------- target-ppc: update nip before calling an helper in FP instructions Signed-off-by: Aurelien Jarno Modified Paths: -------------- trunk/target-ppc/translate.c Modified: trunk/target-ppc/translate.c =================================================================== --- trunk/target-ppc/translate.c 2008-12-15 17:13:31 UTC (rev 6044) +++ trunk/target-ppc/translate.c 2008-12-15 17:13:39 UTC (rev 6045) @@ -2072,6 +2072,8 @@ gen_exception(ctx, POWERPC_EXCP_FPU); \ return; \ } \ + /* NIP cannot be restored if the memory exception comes from an helper */ \ + gen_update_nip(ctx, ctx->nip - 4); \ gen_reset_fpstatus(); \ gen_helper_f##op(cpu_fpr[rD(ctx->opcode)], cpu_fpr[rA(ctx->opcode)], \ cpu_fpr[rC(ctx->opcode)], cpu_fpr[rB(ctx->opcode)]); \ @@ -2093,6 +2095,8 @@ gen_exception(ctx, POWERPC_EXCP_FPU); \ return; \ } \ + /* NIP cannot be restored if the memory exception comes from an helper */ \ + gen_update_nip(ctx, ctx->nip - 4); \ gen_reset_fpstatus(); \ gen_helper_f##op(cpu_fpr[rD(ctx->opcode)], cpu_fpr[rA(ctx->opcode)], \ cpu_fpr[rB(ctx->opcode)]); \ @@ -2113,6 +2117,8 @@ gen_exception(ctx, POWERPC_EXCP_FPU); \ return; \ } \ + /* NIP cannot be restored if the memory exception comes from an helper */ \ + gen_update_nip(ctx, ctx->nip - 4); \ gen_reset_fpstatus(); \ gen_helper_f##op(cpu_fpr[rD(ctx->opcode)], cpu_fpr[rA(ctx->opcode)], \ cpu_fpr[rC(ctx->opcode)]); \ @@ -2133,6 +2139,8 @@ gen_exception(ctx, POWERPC_EXCP_FPU); \ return; \ } \ + /* NIP cannot be restored if the memory exception comes from an helper */ \ + gen_update_nip(ctx, ctx->nip - 4); \ gen_reset_fpstatus(); \ gen_helper_f##name(cpu_fpr[rD(ctx->opcode)], cpu_fpr[rB(ctx->opcode)]); \ gen_compute_fprf(cpu_fpr[rD(ctx->opcode)], \ @@ -2146,6 +2154,8 @@ gen_exception(ctx, POWERPC_EXCP_FPU); \ return; \ } \ + /* NIP cannot be restored if the memory exception comes from an helper */ \ + gen_update_nip(ctx, ctx->nip - 4); \ gen_reset_fpstatus(); \ gen_helper_f##name(cpu_fpr[rD(ctx->opcode)], cpu_fpr[rB(ctx->opcode)]); \ gen_compute_fprf(cpu_fpr[rD(ctx->opcode)], \ @@ -2175,6 +2185,8 @@ gen_exception(ctx, POWERPC_EXCP_FPU); return; } + /* NIP cannot be restored if the memory exception comes from an helper */ + gen_update_nip(ctx, ctx->nip - 4); gen_reset_fpstatus(); gen_helper_frsqrte(cpu_fpr[rD(ctx->opcode)], cpu_fpr[rB(ctx->opcode)]); gen_helper_frsp(cpu_fpr[rD(ctx->opcode)], cpu_fpr[rD(ctx->opcode)]); @@ -2193,6 +2205,8 @@ gen_exception(ctx, POWERPC_EXCP_FPU); return; } + /* NIP cannot be restored if the memory exception comes from an helper */ + gen_update_nip(ctx, ctx->nip - 4); gen_reset_fpstatus(); gen_helper_fsqrt(cpu_fpr[rD(ctx->opcode)], cpu_fpr[rB(ctx->opcode)]); gen_compute_fprf(cpu_fpr[rD(ctx->opcode)], 1, Rc(ctx->opcode) != 0); @@ -2204,6 +2218,8 @@ gen_exception(ctx, POWERPC_EXCP_FPU); return; } + /* NIP cannot be restored if the memory exception comes from an helper */ + gen_update_nip(ctx, ctx->nip - 4); gen_reset_fpstatus(); gen_helper_fsqrt(cpu_fpr[rD(ctx->opcode)], cpu_fpr[rB(ctx->opcode)]); gen_helper_frsp(cpu_fpr[rD(ctx->opcode)], cpu_fpr[rD(ctx->opcode)]); @@ -2254,6 +2270,8 @@ gen_exception(ctx, POWERPC_EXCP_FPU); return; } + /* NIP cannot be restored if the memory exception comes from an helper */ + gen_update_nip(ctx, ctx->nip - 4); gen_reset_fpstatus(); crf = tcg_const_i32(crfD(ctx->opcode)); gen_helper_fcmpo(cpu_fpr[rA(ctx->opcode)], cpu_fpr[rB(ctx->opcode)], crf); @@ -2269,6 +2287,8 @@ gen_exception(ctx, POWERPC_EXCP_FPU); return; } + /* NIP cannot be restored if the memory exception comes from an helper */ + gen_update_nip(ctx, ctx->nip - 4); gen_reset_fpstatus(); crf = tcg_const_i32(crfD(ctx->opcode)); gen_helper_fcmpu(cpu_fpr[rA(ctx->opcode)], cpu_fpr[rB(ctx->opcode)], crf); @@ -2340,7 +2360,10 @@ crb = 31 - crbD(ctx->opcode); gen_reset_fpstatus(); if (likely(crb != FPSCR_FEX && crb != FPSCR_VX)) { - TCGv_i32 t0 = tcg_const_i32(crb); + TCGv_i32 t0; + /* NIP cannot be restored if the memory exception comes from an helper */ + gen_update_nip(ctx, ctx->nip - 4); + t0 = tcg_const_i32(crb); gen_helper_fpscr_clrbit(t0); tcg_temp_free_i32(t0); } @@ -2362,7 +2385,10 @@ gen_reset_fpstatus(); /* XXX: we pretend we can only do IEEE floating-point computations */ if (likely(crb != FPSCR_FEX && crb != FPSCR_VX && crb != FPSCR_NI)) { - TCGv_i32 t0 = tcg_const_i32(crb); + TCGv_i32 t0; + /* NIP cannot be restored if the memory exception comes from an helper */ + gen_update_nip(ctx, ctx->nip - 4); + t0 = tcg_const_i32(crb); gen_helper_fpscr_setbit(t0); tcg_temp_free_i32(t0); } @@ -2382,6 +2408,8 @@ gen_exception(ctx, POWERPC_EXCP_FPU); return; } + /* NIP cannot be restored if the memory exception comes from an helper */ + gen_update_nip(ctx, ctx->nip - 4); gen_reset_fpstatus(); t0 = tcg_const_i32(FM(ctx->opcode)); gen_helper_store_fpscr(cpu_fpr[rB(ctx->opcode)], t0); @@ -2406,6 +2434,8 @@ } bf = crbD(ctx->opcode) >> 2; sh = 7 - bf; + /* NIP cannot be restored if the memory exception comes from an helper */ + gen_update_nip(ctx, ctx->nip - 4); gen_reset_fpstatus(); t0 = tcg_const_i64(FPIMM(ctx->opcode) << (4 * sh)); t1 = tcg_const_i32(1 << sh);