aboutsummaryrefslogtreecommitdiff
path: root/include/hw/intc
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-09-21 16:28:59 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-09-21 16:28:59 +0100
commit17906a162a1febef92e1d3eddc090e967a351757 (patch)
tree2775332378ae84f30e7081990fe7c0956ade32ad /include/hw/intc
parent50f11062d4c896408731d6a286bcd116d1e08465 (diff)
downloadqemu-17906a162a1febef92e1d3eddc090e967a351757.zip
qemu-17906a162a1febef92e1d3eddc090e967a351757.tar.gz
qemu-17906a162a1febef92e1d3eddc090e967a351757.tar.bz2
nvic: Add banked exception states
For the v8M security extension, some exceptions must be banked between security states. Add the new vecinfo array which holds the state for the banked exceptions and migrate it if the CPU the NVIC is attached to implements the security extension. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include/hw/intc')
-rw-r--r--include/hw/intc/armv7m_nvic.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/hw/intc/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h
index 1a4cce7..317601e 100644
--- a/include/hw/intc/armv7m_nvic.h
+++ b/include/hw/intc/armv7m_nvic.h
@@ -21,6 +21,8 @@
/* Highest permitted number of exceptions (architectural limit) */
#define NVIC_MAX_VECTORS 512
+/* Number of internal exceptions */
+#define NVIC_INTERNAL_VECTORS 16
typedef struct VecInfo {
/* Exception priorities can range from -3 to 255; only the unmodifiable
@@ -41,6 +43,18 @@ typedef struct NVICState {
ARMCPU *cpu;
VecInfo vectors[NVIC_MAX_VECTORS];
+ /* If the v8M security extension is implemented, some of the internal
+ * exceptions are banked between security states (ie there exists both
+ * a Secure and a NonSecure version of the exception and its state):
+ * HardFault, MemManage, UsageFault, SVCall, PendSV, SysTick (R_PJHV)
+ * The rest (including all the external exceptions) are not banked, though
+ * they may be configurable to target either Secure or NonSecure state.
+ * We store the secure exception state in sec_vectors[] for the banked
+ * exceptions, and otherwise use only vectors[] (including for exceptions
+ * like SecureFault that unconditionally target Secure state).
+ * Entries in sec_vectors[] for non-banked exception numbers are unused.
+ */
+ VecInfo sec_vectors[NVIC_INTERNAL_VECTORS];
uint32_t prigroup;
/* vectpending and exception_prio are both cached state that can