From patchwork Fri Jan 20 18:44:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 92100 Delivered-To: patches@linaro.org Received: by 10.182.3.34 with SMTP id 2csp196967obz; Fri, 20 Jan 2017 10:44:47 -0800 (PST) X-Received: by 10.223.176.16 with SMTP id f16mr4106169wra.113.1484937887696; Fri, 20 Jan 2017 10:44:47 -0800 (PST) Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by mx.google.com with ESMTPS id r126si4392203wmb.109.2017.01.20.10.44.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jan 2017 10:44:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) client-ip=2001:8b0:1d0::2; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1cUeB5-00048A-5Q; Fri, 20 Jan 2017 18:44:47 +0000 From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: patches@linaro.org, Liviu Ionescu , Michael Davidsaver Subject: [PATCH 6/6] armv7m: Clear FAULTMASK on return from non-NMI exceptions Date: Fri, 20 Jan 2017 18:44:43 +0000 Message-Id: <1484937883-1068-7-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484937883-1068-1-git-send-email-peter.maydell@linaro.org> References: <1484937883-1068-1-git-send-email-peter.maydell@linaro.org> From: Michael Davidsaver FAULTMASK must be cleared on return from all exceptions other than NMI. Signed-off-by: Michael Davidsaver Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/helper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.7.4 Reviewed-by: Alex Bennée diff --git a/target/arm/helper.c b/target/arm/helper.c index dc383d1..cfbc622 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -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);