Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ifer8-0001bq-Rj for qemu-devel@nongnu.org; Wed, 10 Oct 2007 12:56:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ifer7-0001bT-CJ for qemu-devel@nongnu.org; Wed, 10 Oct 2007 12:56:22 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ifer7-0001bM-4A for qemu-devel@nongnu.org; Wed, 10 Oct 2007 12:56:21 -0400 Received: from dunedin.prolingua.co.uk ([82.68.7.43]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ifer6-0008Jh-CX for qemu-devel@nongnu.org; Wed, 10 Oct 2007 12:56:20 -0400 Received: from [192.168.1.155] (danae.prolingua.co.uk [192.168.1.155]) by dunedin.prolingua.co.uk (8.13.8/8.13.8/Debian-3) with ESMTP id l9AGuDkM024583 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 10 Oct 2007 17:56:13 +0100 Message-ID: <470D0417.6040703@prolingua.co.uk> Date: Wed, 10 Oct 2007 17:55:51 +0100 From: David Matthews MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080807070701010403030005" Subject: [Qemu-devel] Sparc taddctv/tsubcctv patch 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 This is a multi-part message in MIME format. --------------080807070701010403030005 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit This patch fixes a couple of bugs in taddcctv and tsubcctv on the Sparc. It saves the state so that if the instructions trap the correct address is delivered to the kernel and it fixes the detection of overflow in taddcctv. This was patched against CVS version of 20070816 but the fixes don't seem to be in the current CVS. To provide a bit of context: I'm maintaining Poly/ML (www.polyml.org) on various platforms including the Sparc. The Sparc code-generator is now nearly 20 years old and uses the taddcctv and tsubcctv instructions for arbitrary precision arithmetic. I'm using an ageing Sparcstation 5 with 16M and it is painfully slow so I tried out qemu. I couldn't get Solaris to boot but the Debian installation runs fine. I was using the Debian package of qemu which seems to have been prepared on 16th August. I did try the latest CVS but that gave an exception on booting Sparc Debian. Perhaps I need a newer version of openbios as well. Thanks for all your work on qemu. David. --------------080807070701010403030005 Content-Type: text/plain; name="qemu-sparc.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="qemu-sparc.patch" Index: target-sparc/op.c =================================================================== RCS file: /sources/qemu/qemu/target-sparc/op.c,v retrieving revision 1.35 diff -u -r1.35 op.c --- target-sparc/op.c 11 Jul 2007 16:43:30 -0000 1.35 +++ target-sparc/op.c 10 Oct 2007 16:26:34 -0000 @@ -531,7 +531,7 @@ ((src1 & 0xffffffff) ^ (T0 & 0xffffffff))) & (1 << 31)) raise_exception(TT_TOVF); #else - if ((src1 & 0x03) || (T1 & 0x03)) + if (((src1 ^ T1 ^ -1) & (src1 ^ T0)) & (1 << 31)) raise_exception(TT_TOVF); #endif Index: target-sparc/translate.c =================================================================== RCS file: /sources/qemu/qemu/target-sparc/translate.c,v retrieving revision 1.65 diff -u -r1.65 translate.c --- target-sparc/translate.c 11 Jul 2007 16:43:30 -0000 1.65 +++ target-sparc/translate.c 10 Oct 2007 16:26:36 -0000 @@ -1928,10 +1928,12 @@ gen_movl_T0_reg(rd); break; case 0x22: /* taddcctv */ + save_state(dc); gen_op_tadd_T1_T0_ccTV(); gen_movl_T0_reg(rd); break; case 0x23: /* tsubcctv */ + save_state(dc); gen_op_tsub_T1_T0_ccTV(); gen_movl_T0_reg(rd); break; --------------080807070701010403030005--