How do I properly exit from the fault handler?
I am currently using STM32F746. I am trying to exit from a MemManage fault handler back to the instruction which triggered the fault (I am trying something hacky that properly resolves the cause of the fault inside the handler so going back to the original program point makes sense).
When entering the handler, the previous context (e.g., PC, CPSR..) are saved in the stack so I thought restoring those would make me go back to the original point.
However, I cannot properly restore the xPSR, and I think because of that things are not working as expected. I tried something like "MSR apsr, r12" and "MSR xpsr, r12", but instead of fully restoring the xPSR, it seems like it is only restoring the flags of the xPSR (and not the GE and the mode bits).
Also what is weird is that my xPSR inside the handler looks something like 0x610e0004, which does not make sense to me. I thought the last five bit should be in the form of 1xxxx in binary, from https://heyrick.eu/armwiki/The_Status_register.
Why is the last five bits 00100, which seems invalid to me, and how can I restore the xPSR properly to go back to the previous execution state?
Thank you!
