Skip to contentSkip to conversation

[5113] Add correct stack bias if a 64 bit stack is used

Qemu-devel Blue Swirl 1 participant 1 message Aug 30, 2008

lore
Share & tools
lore

Blue Swirl

author
#0 lore raw

Revision: 5113

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5113
Author:   blueswir1
Date:     2008-08-30 09:20:21 +0000 (Sat, 30 Aug 2008)

Log Message:
-----------
Add correct stack bias if a 64 bit stack is used

Modified Paths:
--------------
trunk/linux-user/main.c

Modified: trunk/linux-user/main.c
===================================================================

linux-user/main.c +9 -0
@@ -758,6 +758,7 @@
 #endif
 
 #ifdef TARGET_SPARC
+#define SPARC64_STACK_BIAS 2047
 
 //#define DEBUG_WIN
 
@@ -780,6 +781,10 @@
     abi_ulong sp_ptr;
 
     sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)];
+#ifdef TARGET_SPARC64
+    if (sp_ptr & 3)
+        sp_ptr += SPARC64_STACK_BIAS;
+#endif
 #if defined(DEBUG_WIN)
     printf("win_overflow: sp_ptr=0x" TARGET_ABI_FMT_lx " save_cwp=%d\n",
            sp_ptr, cwp1);
@@ -822,6 +827,10 @@
     /* restore the invalid window */
     cwp1 = cpu_cwp_inc(env, env->cwp + 1);
     sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)];
+#ifdef TARGET_SPARC64
+    if (sp_ptr & 3)
+        sp_ptr += SPARC64_STACK_BIAS;
+#endif
 #if defined(DEBUG_WIN)
     printf("win_underflow: sp_ptr=0x" TARGET_ABI_FMT_lx " load_cwp=%d\n",
            sp_ptr, cwp1);