286a287,291
> //PSTATE.priv is set to 1 here. The manual says it should be 0, but
> //Legion sets it to 1.
> MiscReg PSTATE = tc->readMiscReg(MISCREG_PSTATE);
> PSTATE |= (1 << 2);
> tc->setMiscRegWithEffect(MISCREG_PSTATE, PSTATE);
343,344c348,349
< //set PSTATE.priv to 0
< PSTATE &= ~(1 << 2);
---
> /* //set PSTATE.priv to 0
> PSTATE &= ~(1 << 2);*/
346c351,353
< PSTATE &= ~(1 << 1);
---
> //PSTATE.priv is set to 1 here. The manual says it should be 0, but
> //Legion sets it to 1.
> PSTATE |= (1 << 2);
454c461,463
< PSTATE &= ~(1 << 2);
---
> //PSTATE.priv is set to 1 here. The manual says it should be 0, but
> //Legion sets it to 1.
> PSTATE |= (1 << 2);
536,538c545,547
< if(!(PSTATE & (1 << 2)))
< current = User;
< else if(!(HPSTATE & (1 << 2)))
---
> if(HPSTATE & (1 << 2))
> current = Hyperprivileged;
> else if(PSTATE & (1 << 2))
541c550
< current = Hyperprivileged;
---
> current = User;
548d556
< enterREDState(tc);
549a558,560
> //This changes the hpstate and pstate, so we need to make sure we
> //save the old version on the trap stack in doREDFault.
> enterREDState(tc);
581,583d591
< //First, enter RED state.
< enterREDState(tc);
<
592,593c600,601
< //Turn on pef, set everything else to 0
< tc->setMiscReg(MISCREG_PSTATE, 1 << 4);
---
> //Turn on pef and priv, set everything else to 0
> tc->setMiscReg(MISCREG_PSTATE, (1 << 4) | (1 << 2));
609a618,621
> //Enter RED state. We do this last so that the actual state preserved in
> //the trap stack is the state from before this fault.
> enterREDState(tc);
>