nvic: Add cached vectpending_is_s_banked state
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 12 Sep 2017 18:13:50 +0000 (19:13 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 21 Sep 2017 15:29:23 +0000 (16:29 +0100)
With banked exceptions, just the exception number in
s->vectpending is no longer sufficient to uniquely identify
the pending exception. Add a vectpending_is_s_banked bool
which is true if the exception is using the sec_vectors[]
array.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1505240046-11454-4-git-send-email-peter.maydell@linaro.org

hw/intc/armv7m_nvic.c
include/hw/intc/armv7m_nvic.h

index 8793f75af1cb2b147881abd221052910103bdf66..a11df3d15518e235194298a29ab559f37169af9b 100644 (file)
@@ -1254,6 +1254,7 @@ static void armv7m_nvic_reset(DeviceState *dev)
 
     s->exception_prio = NVIC_NOEXC_PRIO;
     s->vectpending = 0;
+    s->vectpending_is_s_banked = false;
 }
 
 static void nvic_systick_trigger(void *opaque, int n, int level)
index 317601e7ecfc788d1ebb6c2b7e9b45222889655e..87c78b3c2671073eacbabd6615b27eff3d272b19 100644 (file)
@@ -57,10 +57,17 @@ typedef struct NVICState {
     VecInfo sec_vectors[NVIC_INTERNAL_VECTORS];
     uint32_t prigroup;
 
-    /* vectpending and exception_prio are both cached state that can
-     * be recalculated from the vectors[] array and the prigroup field.
+    /* The following fields are all cached state that can be recalculated
+     * from the vectors[] and sec_vectors[] arrays and the prigroup field:
+     *  - vectpending
+     *  - vectpending_is_secure
+     *  - exception_prio
      */
     unsigned int vectpending; /* highest prio pending enabled exception */
+    /* true if vectpending is a banked secure exception, ie it is in
+     * sec_vectors[] rather than vectors[]
+     */
+    bool vectpending_is_s_banked;
     int exception_prio; /* group prio of the highest prio active exception */
 
     MemoryRegion sysregmem;