From patchwork Tue Sep 12 18:13:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 112352 Delivered-To: patches@linaro.org Received: by 10.140.106.117 with SMTP id d108csp5548961qgf; Tue, 12 Sep 2017 11:13:44 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCBIYevW93XVwR09mAVkEqn35QQ4+yCHsloZxXXRdQXNDPSZFltWJj3z/UJdJ6vTIFsf2CX X-Received: by 10.28.97.11 with SMTP id v11mr325818wmb.45.1505240024156; Tue, 12 Sep 2017 11:13:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505240024; cv=none; d=google.com; s=arc-20160816; b=LLFvbSLOujnWzTU+k+ulO8fSWxj+Fa4LJUg0VxciMMh/jX+IfQHTSfHgUi05fGNoVG c/iNZJ2ey4nyIfdx4TDzSiyzRi18JgAMWvWru950rVk+MZioOsWUbVaT2jTElpXPWQLj pRqz3pDYDpN4Z8Wz/NU86jpjqAsDAAhDRF6LOSiI3qRt2IAGtSyp/6buceTpWfm/dgOk 9eKLu3dS+3CCjYTxk8InB6i8qaTosWqvWZP/lJDRiiV/q1FWiLLxCMqxQIVNTNrNI2yT Bc9uH4xAnxLDhsTDxt9fXlLZj4cv3ZgHdrCaQu6+VBiZbHA+ZXuF+gzeW2hqlIyyAGEG VxBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=stY5Ps6HXs3obf3PcYxE3USHO9aFc13HjVy0YFrAprw=; b=Go/miWArE6HcHLIKLdo2Klueo65KROOI7/0KzG4+o8gl/d/5/8AioIZ8+PRz+zo2Dh 2QW9j3Ra+jHpJmoh0MowJfqvQ8o/rD7DMWxwYDnVx0yidtD5HiIbmA///WMNTe6xIcne vcmp30ldLyzCRIO9Ycb7vq2Xm0oJWuFMTlrTtKzF5eWnbSEMzkNols5xAkr4Y1jjPWeA QzfiY6kD8LTgyEdaouqRR5A5uFdTyeJGkNor1WNBVnxzdm20ixH+cJneQmBQnZ5PgKDs CmVtHQMJSCnHMLy0UZqHIuMrs9rcNQllj7hwvAFUEgplfqu7NQ+t91RskVXeuD1yKc+0 tH9Q== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by mx.google.com with ESMTPS id b26si9452243wrc.383.2017.09.12.11.13.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Sep 2017 11:13:44 -0700 (PDT) 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.89) (envelope-from ) id 1drpgt-00014o-Hz; Tue, 12 Sep 2017 19:13:43 +0100 From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: patches@linaro.org Subject: [PATCH 06/19] nvic: Make ICSR.RETTOBASE handle banked exceptions Date: Tue, 12 Sep 2017 19:13:53 +0100 Message-Id: <1505240046-11454-7-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505240046-11454-1-git-send-email-peter.maydell@linaro.org> References: <1505240046-11454-1-git-send-email-peter.maydell@linaro.org> Update the code in nvic_rettobase() so that it checks the sec_vectors[] array as well as the vectors[] array if needed. Signed-off-by: Peter Maydell --- hw/intc/armv7m_nvic.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.7.4 Reviewed-by: Richard Henderson diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c index 585b1a7..edaf60c 100644 --- a/hw/intc/armv7m_nvic.c +++ b/hw/intc/armv7m_nvic.c @@ -84,9 +84,12 @@ static int nvic_pending_prio(NVICState *s) static bool nvic_rettobase(NVICState *s) { int irq, nhand = 0; + bool check_sec = arm_feature(&s->cpu->env, ARM_FEATURE_M_SECURITY); for (irq = ARMV7M_EXCP_RESET; irq < s->num_irq; irq++) { - if (s->vectors[irq].active) { + if (s->vectors[irq].active || + (check_sec && irq < NVIC_INTERNAL_VECTORS && + s->sec_vectors[irq].active)) { nhand++; if (nhand == 2) { return 0;