]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hw/intc/armv7m_nvic: Correct size of ICSR.VECTPENDING
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 23 Jul 2021 16:21:45 +0000 (17:21 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 27 Jul 2021 09:57:39 +0000 (10:57 +0100)
The VECTPENDING field in the ICSR is 9 bits wide, in bits [20:12] of
the register.  We were incorrectly masking it to 8 bits, so it would
report the wrong value if the pending exception was greater than 256.
Fix the bug.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20210723162146.5167-6-peter.maydell@linaro.org

hw/intc/armv7m_nvic.c

index 2aba21368226fa9d858332b27364c2badb1d6558..c9149a3b221dae2df428ceb8008671fe5f992901 100644 (file)
@@ -1039,7 +1039,7 @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
         /* VECTACTIVE */
         val = cpu->env.v7m.exception;
         /* VECTPENDING */
-        val |= (s->vectpending & 0xff) << 12;
+        val |= (s->vectpending & 0x1ff) << 12;
         /* ISRPENDING - set if any external IRQ is pending */
         if (nvic_isrpending(s)) {
             val |= (1 << 22);