]> git.sur5r.net Git - freertos/commitdiff
Reinstate privileged only RAM region when a task is running that does not otherwise...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 3 Oct 2009 19:56:09 +0000 (19:56 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 3 Oct 2009 19:56:09 +0000 (19:56 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@890 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/portable/GCC/ARM_CM3_MPU/port.c

index 92d54133723efed661b33c29d7675964a9d170d7..48fa7d8586e662ce70e9e0a3f78c36ee9f5ce3a6 100644 (file)
@@ -502,12 +502,14 @@ void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMOR
 {\r
 extern unsigned long __SRAM_segment_start__[];\r
 extern unsigned long __SRAM_segment_end__[];\r
+extern unsigned long __privileged_data_start__[];\r
+extern unsigned long __privileged_data_end__[];\r
 long lIndex;\r
 unsigned long ul;\r
 \r
        if( xRegions == NULL )\r
        {\r
-               /* No MPU regions are specified to allow access to all RAM. */\r
+               /* No MPU regions are specified so allow access to all RAM. */\r
         xMPUSettings->xRegion[ 0 ].ulRegionBaseAddress =       \r
                                ( ( unsigned long ) __SRAM_segment_start__ ) | /* Base address. */\r
                                ( portMPU_REGION_VALID ) |\r
@@ -519,9 +521,22 @@ unsigned long ul;
                                ( prvGetMPURegionSizeSetting( ( unsigned long ) __SRAM_segment_end__ - ( unsigned long ) __SRAM_segment_start__ ) ) |\r
                                ( portMPU_REGION_ENABLE );\r
 \r
+               /* Re-instate the privileged only RAM region as xRegion[ 0 ] will have\r
+               just removed the privileged only parameters. */\r
+               xMPUSettings->xRegion[ 1 ].ulRegionBaseAddress =        \r
+                               ( ( unsigned long ) __privileged_data_start__ ) | /* Base address. */\r
+                               ( portMPU_REGION_VALID ) |\r
+                               ( portSTACK_REGION + 1 );\r
+\r
+               xMPUSettings->xRegion[ 1 ].ulRegionAttribute =          \r
+                               ( portMPU_REGION_PRIVILEGED_READ_WRITE ) |\r
+                               ( portMPU_REGION_CACHEABLE_BUFFERABLE ) |\r
+                               prvGetMPURegionSizeSetting( ( unsigned long ) __privileged_data_end__ - ( unsigned long ) __privileged_data_start__ ) |\r
+                               ( portMPU_REGION_ENABLE );\r
+                               \r
                /* Invalidate all other regions. */\r
-               for( ul = 1; ul <= portNUM_CONFIGURABLE_REGIONS; ul++ )\r
-               {\r
+               for( ul = 2; ul <= portNUM_CONFIGURABLE_REGIONS; ul++ )\r
+               { \r
                        xMPUSettings->xRegion[ ul ].ulRegionBaseAddress = ( portSTACK_REGION + ul ) | portMPU_REGION_VALID;     \r
                        xMPUSettings->xRegion[ ul ].ulRegionAttribute = 0UL;\r
                }\r