qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Matthews <dm@prolingua.co.uk>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Sparc taddctv/tsubcctv patch
Date: Wed, 10 Oct 2007 17:55:51 +0100	[thread overview]
Message-ID: <470D0417.6040703@prolingua.co.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 1016 bytes --]

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.


[-- Attachment #2: qemu-sparc.patch --]
[-- Type: text/plain, Size: 1236 bytes --]

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;

                 reply	other threads:[~2007-10-10 16:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=470D0417.6040703@prolingua.co.uk \
    --to=dm@prolingua.co.uk \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).