qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Sparc taddctv/tsubcctv patch


From: David Matthews
Subject: [Qemu-devel] Sparc taddctv/tsubcctv patch
Date: Wed, 10 Oct 2007 17:55:51 +0100
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

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.

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 via email to

[Prev in Thread] Current Thread [Next in Thread]