armv7m: Clear FAULTMASK on return from non-NMI exceptions

FAULTMASK must be cleared on return from all
exceptions other than NMI.

Backports commit a20ee6005564590d33eabec11ed4dc7c432db36b from qemu
This commit is contained in:
Michael Davidsaver 2018-03-02 13:41:13 -05:00 committed by Lioncash
parent cc9458cf59
commit 7f044bf8cc
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7

View File

@ -5339,8 +5339,14 @@ static void do_v7m_exception_exit(CPUARMState *env)
uint32_t xpsr; uint32_t xpsr;
type = env->regs[15]; type = env->regs[15];
//if (env->v7m.exception != 0) if (env->v7m.exception != ARMV7M_EXCP_NMI) {
// armv7m_nvic_complete_irq(env->nvic, env->v7m.exception); /* Auto-clear FAULTMASK on return from other than NMI */
env->daif &= ~PSTATE_F;
}
/* Unicorn: commented out
if (env->v7m.exception != 0) {
armv7m_nvic_complete_irq(env->nvic, env->v7m.exception);
}*/
/* Switch to the target stack. */ /* Switch to the target stack. */
switch_v7m_sp(env, (type & 4) != 0); switch_v7m_sp(env, (type & 4) != 0);