armv7m: Clear FAULTMASK on return from non-NMI exceptions
authorMichael Davidsaver <mdavidsaver@gmail.com>
Fri, 27 Jan 2017 15:20:22 +0000 (15:20 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 27 Jan 2017 15:20:22 +0000 (15:20 +0000)
FAULTMASK must be cleared on return from all
exceptions other than NMI.

Signed-off-by: Michael Davidsaver <mdavidsaver@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 1484937883-1068-7-git-send-email-peter.maydell@linaro.org

target/arm/helper.c

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