From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXTd6-0001Sa-L9 for qemu-devel@nongnu.org; Tue, 18 Jul 2017 10:37:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXTd0-0003u9-HG for qemu-devel@nongnu.org; Tue, 18 Jul 2017 10:37:40 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:61591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXTd0-0003s9-Af for qemu-devel@nongnu.org; Tue, 18 Jul 2017 10:37:34 -0400 References: From: Yongbok Kim Message-ID: Date: Tue, 18 Jul 2017 15:37:12 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/14] target/mips: Fix MIPS64 MFC0 UserLocal on BE host List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: James Hogan Cc: qemu-devel@nongnu.org, Aurelien Jarno , Petar Jovanovic On 18/07/2017 12:55, James Hogan wrote: > Using MFC0 to read CP0_UserLocal uses tcg_gen_ld32s_tl, however > CP0_UserLocal is a target_ulong. On a big endian host with a MIPS64 > target this reads and sign extends the more significant half of the > 64-bit register. > > Fix this by using ld_tl to load the whole target_ulong and ext32s_tl to > sign extend it, as done for various other target_ulong COP0 registers. > > Fixes: d279279e2b5c ("target-mips: implement UserLocal Register") > Signed-off-by: James Hogan > Cc: Yongbok Kim > Cc: Aurelien Jarno > Cc: Petar Jovanovic > --- > Changes in v2: > - New patch. > --- > target/mips/translate.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/target/mips/translate.c b/target/mips/translate.c > index 3022f349cb2a..556aba969a12 100644 > --- a/target/mips/translate.c > +++ b/target/mips/translate.c > @@ -5138,8 +5138,9 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel) > goto cp0_unimplemented; > case 2: > CP0_CHECK(ctx->ulri); > - tcg_gen_ld32s_tl(arg, cpu_env, > - offsetof(CPUMIPSState, active_tc.CP0_UserLocal)); > + tcg_gen_ld_tl(arg, cpu_env, > + offsetof(CPUMIPSState, active_tc.CP0_UserLocal)); > + tcg_gen_ext32s_tl(arg, arg); > rn = "UserLocal"; > break; > default: > Reviewed-by: Yongbok Kim Regards, Yongbok