qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [5019] Fix 32 bit address overflow


From: Blue Swirl
Subject: [Qemu-devel] [5019] Fix 32 bit address overflow
Date: Sun, 17 Aug 2008 16:13:03 +0000

Revision: 5019
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5019
Author:   blueswir1
Date:     2008-08-17 16:13:02 +0000 (Sun, 17 Aug 2008)

Log Message:
-----------
Fix 32 bit address overflow

Modified Paths:
--------------
    trunk/tcg/sparc/tcg-target.c

Modified: trunk/tcg/sparc/tcg-target.c
===================================================================
--- trunk/tcg/sparc/tcg-target.c        2008-08-17 14:34:27 UTC (rev 5018)
+++ trunk/tcg/sparc/tcg-target.c        2008-08-17 16:13:02 UTC (rev 5019)
@@ -625,8 +625,18 @@
     /* ld [arg1 + x], arg1 */
     tcg_out_ldst(s, arg1, arg1, offsetof(CPUTLBEntry, addend) -
                  offsetof(CPUTLBEntry, addr_read), HOST_LD_OP);
+
+#if TARGET_LONG_BITS == 32
+    /* and addr_reg, x, arg0 */
+    tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_I5, 0xffffffff);
+    tcg_out_arith(s, arg0, addr_reg, TCG_REG_I5, ARITH_AND);
+    /* add arg0, arg1, arg0 */
+    tcg_out_arith(s, arg0, arg0, arg1, ARITH_ADD);
+#else
     /* add addr_reg, arg1, arg0 */
     tcg_out_arith(s, arg0, addr_reg, arg1, ARITH_ADD);
+#endif
+
 #else
     arg0 = addr_reg;
 #endif
@@ -785,8 +795,17 @@
     tcg_out_ldst(s, arg1, arg1, offsetof(CPUTLBEntry, addend) -
                  offsetof(CPUTLBEntry, addr_write), HOST_LD_OP);
 
+#if TARGET_LONG_BITS == 32
+    /* and addr_reg, x, arg0 */
+    tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_I5, 0xffffffff);
+    tcg_out_arith(s, arg0, addr_reg, TCG_REG_I5, ARITH_AND);
+    /* add arg0, arg1, arg0 */
+    tcg_out_arith(s, arg0, arg0, arg1, ARITH_ADD);
+#else
     /* add addr_reg, arg1, arg0 */
     tcg_out_arith(s, arg0, addr_reg, arg1, ARITH_ADD);
+#endif
+
 #else
     arg0 = addr_reg;
 #endif






reply via email to

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