aboutsummaryrefslogtreecommitdiff
path: root/linux-user/main.c
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-08-30 09:20:21 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-08-30 09:20:21 +0000
commited23fbd91c182b0629783b202edbd9a8a1bd6369 (patch)
treefcc221f17d71a694180e60e518d0bae194c851f2 /linux-user/main.c
parente6afc2f4b9a93403b20cad9cecb05478f9067ea2 (diff)
Add correct stack bias if a 64 bit stack is used
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5113 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user/main.c')
-rw-r--r--linux-user/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index 50e2da4dbf..32f5455e64 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -758,6 +758,7 @@ void cpu_loop(CPUARMState *env)
#endif
#ifdef TARGET_SPARC
+#define SPARC64_STACK_BIAS 2047
//#define DEBUG_WIN
@@ -780,6 +781,10 @@ static inline void save_window_offset(CPUSPARCState *env, int cwp1)
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 @@ static void restore_window(CPUSPARCState *env)
/* 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);