Commit e6bf7d70b5a459f96f0b2cbc677926eebe685c84

Authored by blueswir1
1 parent 2cade6a3

Fix saving and loading of trap state

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4883 c046a42c-6fe2-441c-8c8c-71466251a162
target-sparc/helper.c
... ... @@ -742,6 +742,14 @@ void do_interrupt(CPUState *env)
742 742 return;
743 743 }
744 744 #endif
  745 + if (env->tl < MAXTL - 1) {
  746 + env->tl++;
  747 + } else {
  748 + env->pstate |= PS_RED;
  749 + if (env->tl != MAXTL)
  750 + env->tl++;
  751 + }
  752 + env->tsptr = &env->ts[env->tl];
745 753 env->tsptr->tstate = ((uint64_t)GET_CCR(env) << 32) |
746 754 ((env->asi & 0xff) << 24) | ((env->pstate & 0xf3f) << 8) |
747 755 GET_CWP64(env);
... ... @@ -758,14 +766,6 @@ void do_interrupt(CPUState *env)
758 766 cpu_set_cwp(env, cpu_cwp_inc(env, env->cwp + 1));
759 767 env->tbr &= ~0x7fffULL;
760 768 env->tbr |= ((env->tl > 1) ? 1 << 14 : 0) | (intno << 5);
761   - if (env->tl < MAXTL - 1) {
762   - env->tl++;
763   - } else {
764   - env->pstate |= PS_RED;
765   - if (env->tl != MAXTL)
766   - env->tl++;
767   - }
768   - env->tsptr = &env->ts[env->tl];
769 769 env->pc = env->tbr;
770 770 env->npc = env->pc + 4;
771 771 env->exception_index = 0;
... ...
target-sparc/op_helper.c
... ... @@ -2680,26 +2680,26 @@ void helper_wrpstate(target_ulong new_state)
2680 2680  
2681 2681 void helper_done(void)
2682 2682 {
2683   - env->tl--;
2684   - env->tsptr = &env->ts[env->tl];
2685 2683 env->pc = env->tsptr->tpc;
2686 2684 env->npc = env->tsptr->tnpc + 4;
2687 2685 PUT_CCR(env, env->tsptr->tstate >> 32);
2688 2686 env->asi = (env->tsptr->tstate >> 24) & 0xff;
2689 2687 change_pstate((env->tsptr->tstate >> 8) & 0xf3f);
2690 2688 PUT_CWP64(env, env->tsptr->tstate & 0xff);
  2689 + env->tl--;
  2690 + env->tsptr = &env->ts[env->tl];
2691 2691 }
2692 2692  
2693 2693 void helper_retry(void)
2694 2694 {
2695   - env->tl--;
2696   - env->tsptr = &env->ts[env->tl];
2697 2695 env->pc = env->tsptr->tpc;
2698 2696 env->npc = env->tsptr->tnpc;
2699 2697 PUT_CCR(env, env->tsptr->tstate >> 32);
2700 2698 env->asi = (env->tsptr->tstate >> 24) & 0xff;
2701 2699 change_pstate((env->tsptr->tstate >> 8) & 0xf3f);
2702 2700 PUT_CWP64(env, env->tsptr->tstate & 0xff);
  2701 + env->tl--;
  2702 + env->tsptr = &env->ts[env->tl];
2703 2703 }
2704 2704 #endif
2705 2705  
... ...