mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-25 17:56:05 +00:00
Race conditions exist when remapping the NXP MPU. When writing the start, end, or attribute registers of a MPU descriptor, the hardware will automatically clear the region's valid bit. If that region gets accessed before the code is able to set the valid bit, the core will fault. Issue #20595 revealled this problem with the code in region_init() when the compiler options are set to no optimizations. The code generated by the compiler put local variables on the stack and then read those stack based variables when writing the MPU descriptor registers. If that region mapped the stack a memory fault would occur. Higher compiler optimizations would store these local variables in CPU registers which avoided the memory access when programming the MPU descriptor. Because the NXP MPU uses a logic OR operation of the MPU descriptors, the fix uses the last descriptor in the MPU hardware to remap all of dynamic memory for access instead of the first of the dynamic memory descriptors as was occuring before. This allows reprogramming of the primary discriptor blocks without having a memory fault. After all the dynamic memory blocks are mapped, the unused blocks will have their valid bits cleared including this temporary one, if it wasn't alread changed during the mapping of the current set. Fixes #20595 Signed-off-by: David Leach <david.leach@nxp.com> |
||
---|---|---|
.. | ||
arc | ||
arm | ||
common | ||
nios2 | ||
posix | ||
riscv | ||
x86 | ||
xtensa | ||
CMakeLists.txt | ||
Kconfig |