mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
Sparc64: replace tsptr with helper routine
tl and tsptr of members sparc64 cpu state must be changed simultaneously to keep trap state window in sync with current trap level. Currently translation of store to tl does not change tsptr, which leads to corrupt trap state on corresponding trap level. This patch removes tsptr from sparc64 cpu state and replaces all uses with call to helper routine. Changes v0->v1: - reimplemented helper routine with tcg generator - on cpu reset trap type and pstate are populated with power-on reset values, including tl=maxtl Signed-off-by: igor.v.kovalenko@gmail.com Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
a16aae0ca4
commit
8194f35a0c
6 changed files with 69 additions and 40 deletions
|
@ -3311,26 +3311,28 @@ void helper_wrpstate(target_ulong new_state)
|
|||
|
||||
void helper_done(void)
|
||||
{
|
||||
env->pc = env->tsptr->tpc;
|
||||
env->npc = env->tsptr->tnpc + 4;
|
||||
PUT_CCR(env, env->tsptr->tstate >> 32);
|
||||
env->asi = (env->tsptr->tstate >> 24) & 0xff;
|
||||
change_pstate((env->tsptr->tstate >> 8) & 0xf3f);
|
||||
PUT_CWP64(env, env->tsptr->tstate & 0xff);
|
||||
trap_state* tsptr = cpu_tsptr(env);
|
||||
|
||||
env->pc = tsptr->tpc;
|
||||
env->npc = tsptr->tnpc + 4;
|
||||
PUT_CCR(env, tsptr->tstate >> 32);
|
||||
env->asi = (tsptr->tstate >> 24) & 0xff;
|
||||
change_pstate((tsptr->tstate >> 8) & 0xf3f);
|
||||
PUT_CWP64(env, tsptr->tstate & 0xff);
|
||||
env->tl--;
|
||||
env->tsptr = &env->ts[env->tl & MAXTL_MASK];
|
||||
}
|
||||
|
||||
void helper_retry(void)
|
||||
{
|
||||
env->pc = env->tsptr->tpc;
|
||||
env->npc = env->tsptr->tnpc;
|
||||
PUT_CCR(env, env->tsptr->tstate >> 32);
|
||||
env->asi = (env->tsptr->tstate >> 24) & 0xff;
|
||||
change_pstate((env->tsptr->tstate >> 8) & 0xf3f);
|
||||
PUT_CWP64(env, env->tsptr->tstate & 0xff);
|
||||
trap_state* tsptr = cpu_tsptr(env);
|
||||
|
||||
env->pc = tsptr->tpc;
|
||||
env->npc = tsptr->tnpc;
|
||||
PUT_CCR(env, tsptr->tstate >> 32);
|
||||
env->asi = (tsptr->tstate >> 24) & 0xff;
|
||||
change_pstate((tsptr->tstate >> 8) & 0xf3f);
|
||||
PUT_CWP64(env, tsptr->tstate & 0xff);
|
||||
env->tl--;
|
||||
env->tsptr = &env->ts[env->tl & MAXTL_MASK];
|
||||
}
|
||||
|
||||
void helper_set_softint(uint64_t value)
|
||||
|
@ -3392,9 +3394,15 @@ static const char * const excp_names[0x80] = {
|
|||
};
|
||||
#endif
|
||||
|
||||
trap_state* cpu_tsptr(CPUState* env)
|
||||
{
|
||||
return &env->ts[env->tl & MAXTL_MASK];
|
||||
}
|
||||
|
||||
void do_interrupt(CPUState *env)
|
||||
{
|
||||
int intno = env->exception_index;
|
||||
trap_state* tsptr;
|
||||
|
||||
#ifdef DEBUG_PCALL
|
||||
if (qemu_loglevel_mask(CPU_LOG_INT)) {
|
||||
|
@ -3451,13 +3459,14 @@ void do_interrupt(CPUState *env)
|
|||
if (env->tl < env->maxtl)
|
||||
env->tl++;
|
||||
}
|
||||
env->tsptr = &env->ts[env->tl & MAXTL_MASK];
|
||||
env->tsptr->tstate = ((uint64_t)GET_CCR(env) << 32) |
|
||||
tsptr = cpu_tsptr(env);
|
||||
|
||||
tsptr->tstate = ((uint64_t)GET_CCR(env) << 32) |
|
||||
((env->asi & 0xff) << 24) | ((env->pstate & 0xf3f) << 8) |
|
||||
GET_CWP64(env);
|
||||
env->tsptr->tpc = env->pc;
|
||||
env->tsptr->tnpc = env->npc;
|
||||
env->tsptr->tt = intno;
|
||||
tsptr->tpc = env->pc;
|
||||
tsptr->tnpc = env->npc;
|
||||
tsptr->tt = intno;
|
||||
|
||||
switch (intno) {
|
||||
case TT_IVEC:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue