This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Cortex-M MPU User access to privileged code

Hi All,

I currently want to make use of the MPU. I have several functions which are required to be in privileged mode and are stored in a region set as privileged-read-only, user denied, executable.

This works fine when a BL or BLX instruction jumps here from privileged code however not sure how the management fault will react if the BL or BLX was from user mode. I expect this would cause a fault but unsure how the MMFSR, MMFAR and stack frame are affected. For example does the PC stored in the stack frame point to the fault causing BL or BLX instruction or does it point to the destination address?.

The reason I want to know this is I want to write a fault handler that will catch this, check if the target address is within an area reserved for these functions and if it is, change the stack frame to enable privilege mode and use a trampoline that will execute the function in privilege mode then switch back to user mode and return to the original caller.

The coding itself isn't a problem for me but I just need to know more specific detail on how the memory manager fault is invoked.

Thanks in advance!.

Parents Reply Children
No data