Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HpLy2-0002Qt-KU for qemu-devel@nongnu.org; Sat, 19 May 2007 06:15:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HpLy1-0002Qg-65 for qemu-devel@nongnu.org; Sat, 19 May 2007 06:15:17 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HpLy0-0002Qd-W8 for qemu-devel@nongnu.org; Sat, 19 May 2007 06:15:17 -0400 Received: from farad.aurel32.net ([82.232.2.251] helo=mail.aurel32.net) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HpLy0-0006D9-L0 for qemu-devel@nongnu.org; Sat, 19 May 2007 06:15:16 -0400 Received: from amd64.aurel32.net ([2001:618:400:fc13:216:3eff:fe00:1009]) by mail.aurel32.net with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1HpLxy-0000pO-In for qemu-devel@nongnu.org; Sat, 19 May 2007 12:15:14 +0200 Received: from aurel32 by amd64.aurel32.net with local (Exim 4.67) (envelope-from ) id 1HpLxy-0005rW-9y for qemu-devel@nongnu.org; Sat, 19 May 2007 12:15:14 +0200 Date: Sat, 19 May 2007 12:15:14 +0200 From: Aurelien Jarno Message-ID: <20070519101513.GA22507@amd64.aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Subject: [Qemu-devel] [PATCH, MIPS64] Fixed signed integer comparisons 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 Hi all, One more patch for MIPS64 support. It fixes signed integer comparison. The compared value should be casted to target_long (ie int32_t on MIPS32 and int64_t on MIPS64) in order for the comparisons to work in all cases. With this patch I am able to get my o32 system working with a 64-bit kernel. I have seen no problem so far. n32 binaries also works correctly, though I haven't done extensive tests. I have only built small C/C++ softwares and tested them. 64-bit binaries are not working correctly. I get a "Bus error" within ld-2.5.so, so I guess there is still some parts to fix in the MMU emulation. Cheers, Aurelien Index: target-mips/op.c =================================================================== RCS file: /sources/qemu/qemu/target-mips/op.c,v retrieving revision 1.57 diff -u -d -p -r1.57 op.c --- target-mips/op.c 18 May 2007 11:55:54 -0000 1.57 +++ target-mips/op.c 19 May 2007 09:16:14 -0000 @@ -928,14 +928,14 @@ void glue(op_, name) (void) \ OP_COND(eq, T0 == T1); OP_COND(ne, T0 != T1); -OP_COND(ge, (int32_t)T0 >= (int32_t)T1); +OP_COND(ge, (target_long)T0 >= (target_long)T1); OP_COND(geu, T0 >= T1); -OP_COND(lt, (int32_t)T0 < (int32_t)T1); +OP_COND(lt, (target_long)T0 < (target_long)T1); OP_COND(ltu, T0 < T1); -OP_COND(gez, (int32_t)T0 >= 0); -OP_COND(gtz, (int32_t)T0 > 0); -OP_COND(lez, (int32_t)T0 <= 0); -OP_COND(ltz, (int32_t)T0 < 0); +OP_COND(gez, (target_long)T0 >= 0); +OP_COND(gtz, (target_long)T0 > 0); +OP_COND(lez, (target_long)T0 <= 0); +OP_COND(ltz, (target_long)T0 < 0); /* Branches */ void OPPROTO op_goto_tb0(void) Index: target-mips/translate.c =================================================================== RCS file: /sources/qemu/qemu/target-mips/translate.c,v retrieving revision 1.80 diff -u -d -p -r1.80 translate.c --- target-mips/translate.c 18 May 2007 11:55:54 -0000 1.80 +++ target-mips/translate.c 19 May 2007 09:16:15 -0000 @@ -919,7 +921,7 @@ static void gen_flt_ldst (DisasContext * static void gen_arith_imm (DisasContext *ctx, uint32_t opc, int rt, int rs, int16_t imm) { - uint32_t uimm; + target_ulong uimm; const char *opn = "imm arith"; if (rt == 0 && opc != OPC_ADDI && opc != OPC_DADDI) { @@ -939,7 +941,7 @@ static void gen_arith_imm (DisasContext #endif case OPC_SLTI: case OPC_SLTIU: - uimm = (int32_t)imm; /* Sign extend to 32 bits */ + uimm = (target_long)imm; /* Sign extend to 32/64 bits */ /* Fall through. */ case OPC_ANDI: case OPC_ORI: -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net