Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HXKmz-0000gl-M7 for qemu-devel@nongnu.org; Fri, 30 Mar 2007 13:21:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HXKmx-0000c6-SX for qemu-devel@nongnu.org; Fri, 30 Mar 2007 13:21:25 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HXKmx-0000ba-NB for qemu-devel@nongnu.org; Fri, 30 Mar 2007 12:21:23 -0500 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 1HXKkE-0007SP-4H for qemu-devel@nongnu.org; Fri, 30 Mar 2007 13:18:35 -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 1HXKk9-0002S6-32 for qemu-devel@nongnu.org; Fri, 30 Mar 2007 19:18:29 +0200 Received: from aurel32 by amd64.aurel32.net with local (Exim 4.63) (envelope-from ) id 1HXKk8-0000i8-M6 for qemu-devel@nongnu.org; Fri, 30 Mar 2007 19:18:28 +0200 Date: Fri, 30 Mar 2007 19:18:28 +0200 From: Aurelien Jarno Message-ID: <20070330171828.GA2727@amd64.aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Subject: [Qemu-devel] [SPARC][PATCH] Generate cp_disabled trap for Cpop 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 Hi all, Both of the SPARC CPU currently emulated in QEMU do not have a coprocessor. In such case executing a Cpop1 or a Cpop2 instruction should generate a cp_disabled trap, but the current implementation generates a illegal_instruction instead. The patch below fixes that. Bye, Aurelien Index: target-sparc/cpu.h =================================================================== RCS file: /sources/qemu/qemu/target-sparc/cpu.h,v retrieving revision 1.30 diff -u -d -p -r1.30 cpu.h --- target-sparc/cpu.h 25 Mar 2007 07:55:52 -0000 1.30 +++ target-sparc/cpu.h 30 Mar 2007 17:09:46 -0000 @@ -40,6 +40,7 @@ #define TT_TOVF 0x0a #define TT_EXTINT 0x10 #define TT_DIV_ZERO 0x2a +#define TT_NCP_INSN 0x24 #define TT_TRAP 0x80 #else #define TT_TFAULT 0x08 Index: target-sparc/translate.c =================================================================== RCS file: /sources/qemu/qemu/target-sparc/translate.c,v retrieving revision 1.38 diff -u -d -p -r1.38 translate.c --- target-sparc/translate.c 25 Mar 2007 07:55:52 -0000 1.38 +++ target-sparc/translate.c 30 Mar 2007 17:09:47 -0000 @@ -1736,7 +1739,7 @@ static void disas_sparc_insn(DisasContex gen_op_sra(); gen_movl_T0_reg(rd); #endif - } else if (xop < 0x38) { + } else if (xop < 0x36) { rs1 = GET_FIELD(insn, 13, 17); gen_movl_reg_T0(rs1); if (IS_IMM) { /* immediate */ @@ -2142,6 +2145,10 @@ static void disas_sparc_insn(DisasContex goto illegal_insn; } } + } else if (xop == 0x36 || xop == 0x37) { /* CPop1 & CPop2 */ + save_state(dc); + gen_op_exception(TT_NCP_INSN); + dc->is_br = 1; #ifdef TARGET_SPARC64 } else if (xop == 0x39) { /* V9 return */ rs1 = GET_FIELD(insn, 13, 17); -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net