Please be aware that this work is based on my reading of ARM documentation, and hasn't yet been cross-checked with real hardware. Patch #1 is (I think) fairly straightforward. I'd like to get some comments on patches #2 and #3, which I don't consider ready for merge.
The first patch was previously sent on the thread "armv7-m: exit on external reset request", and included here with only a changed commit message. I'm trying to add support for the MPU (PMSAv7) for cortex-m3 and cortex-m4. In the process I found an issue with handling of exceptions other than IRQ. In arm_v7m_cpu_do_interrupt() 'v7m.exception' is not being updated for UsageFault, SVC, and MemManage cases. In the UsageFault case, the handler isn't invoked, and an invalid instruction is perpetually re-executed, resulting in a stuck state. Patch #2 relaxes handling of mis-aligned handler functions (ie. missing '.thumb_func') to mirror what is already done on exception return. While a guest_errors message will be helpful for people (like myself) who make this mistake, I'm not sure if automatically correcting the error is appropriate. I'm having some difficulty in getting my test code loaded on a real cortex-m4 for a cross-check. It may be some time before I succeed (might have to get a different board). If anyone is interested in trying to do this test, please let me know as I'm happy to assist. Michael Davidsaver (3): armv7-m: exit on external reset request armv7-m: fix non-IRQ exceptions armv7-m: add MPU to cortex-m3 and cortex-m4 hw/arm/armv7m.c | 8 --- hw/intc/armv7m_nvic.c | 160 ++++++++++++++++++++++++++++++++++++++++++++++++-- target-arm/cpu-qom.h | 4 ++ target-arm/cpu.c | 14 +++++ target-arm/helper.c | 34 +++++++++-- 5 files changed, 200 insertions(+), 20 deletions(-) -- 2.1.4