Commit ed23fbd91c182b0629783b202edbd9a8a1bd6369

Authored by blueswir1
1 parent e6afc2f4

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
Showing 1 changed file with 9 additions and 0 deletions
linux-user/main.c
... ... @@ -758,6 +758,7 @@ void cpu_loop(CPUARMState *env)
758 758 #endif
759 759  
760 760 #ifdef TARGET_SPARC
  761 +#define SPARC64_STACK_BIAS 2047
761 762  
762 763 //#define DEBUG_WIN
763 764  
... ... @@ -780,6 +781,10 @@ static inline void save_window_offset(CPUSPARCState *env, int cwp1)
780 781 abi_ulong sp_ptr;
781 782  
782 783 sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)];
  784 +#ifdef TARGET_SPARC64
  785 + if (sp_ptr & 3)
  786 + sp_ptr += SPARC64_STACK_BIAS;
  787 +#endif
783 788 #if defined(DEBUG_WIN)
784 789 printf("win_overflow: sp_ptr=0x" TARGET_ABI_FMT_lx " save_cwp=%d\n",
785 790 sp_ptr, cwp1);
... ... @@ -822,6 +827,10 @@ static void restore_window(CPUSPARCState *env)
822 827 /* restore the invalid window */
823 828 cwp1 = cpu_cwp_inc(env, env->cwp + 1);
824 829 sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)];
  830 +#ifdef TARGET_SPARC64
  831 + if (sp_ptr & 3)
  832 + sp_ptr += SPARC64_STACK_BIAS;
  833 +#endif
825 834 #if defined(DEBUG_WIN)
826 835 printf("win_underflow: sp_ptr=0x" TARGET_ABI_FMT_lx " load_cwp=%d\n",
827 836 sp_ptr, cwp1);
... ...