You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/07/30 17:59:28 UTC

[GitHub] [incubator-nuttx] patacongo opened a new issue #1489: Improved MPU usage in PROTECTED mode

patacongo opened a new issue #1489:
URL: https://github.com/apache/incubator-nuttx/issues/1489


   In PROTECTED mode, the MPU is used to map regions of memory to supervisor- and/or user-accessible memory.  Currently, that algorithm is very simple:  The entire address range is made accessible in supervisor mode; a single MPU region is used to enable user-mode access in each user memory region.
   
   Each MPU region must bit both of a power-of-two size and with an alignment in memory equal to the size.  That is, a 16Kb mapped region must be aligned to a 16Kb address.  This simple region mapping causes some serious memory alignment problems.  For example, suppose there is 64Kb of memory (say RAM) and we need at least 1Kb for supervisor memory.  At best, after the 1Kb memory is set aside for supervisor access, the remaining 63Kb can support a maximum of a 32Kb region, aligned either at the beginning of the 64Kb region or at an offset of 32Kb into the 64Kb region.  The remaining 31Kb is lost.
   
   This could be solved by either:
   
   1. Use multiple regions to map the memory.  In the above example, we could map 48Kb with two regions (still losing 13Kb) or 56Kb with three regions (still losing 5Kb).  Or, better,
   2. Use the ARMv7-M sub-regions.  For example, map the entire 64Kb, but unmap the single 1Kb sub-region reserved for supervisor mode access (no memory loss).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org