Amemory protection unit (MPU) is acomputer hardware unit that providesmemory protection. It is usually implemented as part of thecentral processing unit (CPU).[1] MPU is a trimmed down version ofmemory management unit (MMU) providing only memory protection support. It is usually implemented in low power processors that require only memory protection and do not need the full-fledged feature of a MMU likevirtual memory management.[2][3]
The MPU allows theprivileged software to define memory regions and assign memory access permission and memory attributes to each of them. Depending on the implementation of theprocessor, the number of supported memory regions will vary. The MPU onARMv8-M processors supports up to 16 regions. The memory attributes define the ordering and merging behaviors of these regions, as well ascaching and buffering attributes. Cache attributes can be used by internal caches, if available, and can be exported for use by system caches.[4]
MPU monitors transactions, includinginstruction fetches and data accesses from theprocessor, which can trigger afault exception when an access violation is detected. The main purpose of memory protection is to prevent aprocess from accessing memory that has not been allocated to it. This prevents abug ormalware within a process from affecting other processes, or theoperating system itself.[4]