diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2020-03-03 17:49:47 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2020-03-12 16:01:37 +0000 |
commit | 8c4985298fca616e91b88996c225a9efd04b7500 (patch) | |
tree | 1272116a91742978cda60e4130cd541b15cb15f5 /hw/intc/armv7m_nvic.c | |
parent | 67d9ef7d541c3d21a25796c51c26da096a433565 (diff) | |
download | qemu-8c4985298fca616e91b88996c225a9efd04b7500.zip qemu-8c4985298fca616e91b88996c225a9efd04b7500.tar.gz qemu-8c4985298fca616e91b88996c225a9efd04b7500.tar.bz2 |
hw/intc/armv7m_nvic: Rebuild hflags on reset
Some of an M-profile CPU's cached hflags state depends on state that's
in our NVIC object. We already do an hflags rebuild when the NVIC
registers are written, but we also need to do this on NVIC reset,
because there's no guarantee that this will happen before the
CPU reset.
This fixes an assertion due to mismatched hflags which happens if
the CPU is reset from inside a HardFault handler.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200303174950.3298-2-peter.maydell@linaro.org
Diffstat (limited to 'hw/intc/armv7m_nvic.c')
-rw-r--r-- | hw/intc/armv7m_nvic.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c index a62587e..1ad35e5 100644 --- a/hw/intc/armv7m_nvic.c +++ b/hw/intc/armv7m_nvic.c @@ -2593,6 +2593,12 @@ static void armv7m_nvic_reset(DeviceState *dev) s->itns[i] = true; } } + + /* + * We updated state that affects the CPU's MMUidx and thus its hflags; + * and we can't guarantee that we run before the CPU reset function. + */ + arm_rebuild_hflags(&s->cpu->env); } static void nvic_systick_trigger(void *opaque, int n, int level) |