Skip to content

Commit

Permalink
Fix the context array size for MPU ports (#1230)
Browse files Browse the repository at this point in the history
Fix the context array size for MPU ports

Ensure the saved context location falls within the reserved context area
rather than overlapping with the next MPU_SETTINGS structure member.

This never caused a problem because actual read/write operations
start from one word before the saved context location.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
  • Loading branch information
aggarg authored Jan 25, 2025
1 parent 2b35979 commit 11d0caa
Show file tree
Hide file tree
Showing 26 changed files with 208 additions and 173 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/kernel-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@ jobs:
fetch-depth: 1

- env:
stepName: Fetch Community-Supported-Demos Submodule
stepName: Fetch Dependencies
shell: bash
run: |
# ${{ env.stepName }}
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
git submodule update --checkout --init --depth 1 FreeRTOS/Demo/ThirdParty/Community-Supported-Demos
git submodule update --checkout --init --depth 1 FreeRTOS/Demo/ThirdParty/Community-Supported-Demos FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
# Checkout user pull request changes
Expand Down
16 changes: 8 additions & 8 deletions portable/ARMv8M/non_secure/portmacrocommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
*
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
* 16 16 8 8 5 16 1
* 16 17 8 8 5 16 1
*/
#define MAX_CONTEXT_SIZE 70
#define MAX_CONTEXT_SIZE 71

#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )

Expand All @@ -264,9 +264,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+------------------------------+-----+
*
* <-----------><--------------><---------><----------------><-----------------------------><---->
* 16 16 8 8 5 1
* 16 17 8 8 5 1
*/
#define MAX_CONTEXT_SIZE 54
#define MAX_CONTEXT_SIZE 55

#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )

Expand All @@ -277,9 +277,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
*
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
* 16 16 8 8 4 16 1
* 16 17 8 8 4 16 1
*/
#define MAX_CONTEXT_SIZE 69
#define MAX_CONTEXT_SIZE 70

#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */

Expand All @@ -290,9 +290,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+----------------------+-----+
*
* <-----------><--------------><---------><----------------><---------------------><---->
* 16 16 8 8 4 1
* 16 17 8 8 4 1
*/
#define MAX_CONTEXT_SIZE 53
#define MAX_CONTEXT_SIZE 54

#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */

Expand Down
16 changes: 8 additions & 8 deletions portable/GCC/ARM_CM23/non_secure/portmacrocommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
*
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
* 16 16 8 8 5 16 1
* 16 17 8 8 5 16 1
*/
#define MAX_CONTEXT_SIZE 70
#define MAX_CONTEXT_SIZE 71

#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )

Expand All @@ -264,9 +264,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+------------------------------+-----+
*
* <-----------><--------------><---------><----------------><-----------------------------><---->
* 16 16 8 8 5 1
* 16 17 8 8 5 1
*/
#define MAX_CONTEXT_SIZE 54
#define MAX_CONTEXT_SIZE 55

#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )

Expand All @@ -277,9 +277,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
*
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
* 16 16 8 8 4 16 1
* 16 17 8 8 4 16 1
*/
#define MAX_CONTEXT_SIZE 69
#define MAX_CONTEXT_SIZE 70

#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */

Expand All @@ -290,9 +290,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+----------------------+-----+
*
* <-----------><--------------><---------><----------------><---------------------><---->
* 16 16 8 8 4 1
* 16 17 8 8 4 1
*/
#define MAX_CONTEXT_SIZE 53
#define MAX_CONTEXT_SIZE 54

#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */

Expand Down
16 changes: 8 additions & 8 deletions portable/GCC/ARM_CM23_NTZ/non_secure/portmacrocommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
*
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
* 16 16 8 8 5 16 1
* 16 17 8 8 5 16 1
*/
#define MAX_CONTEXT_SIZE 70
#define MAX_CONTEXT_SIZE 71

#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )

Expand All @@ -264,9 +264,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+------------------------------+-----+
*
* <-----------><--------------><---------><----------------><-----------------------------><---->
* 16 16 8 8 5 1
* 16 17 8 8 5 1
*/
#define MAX_CONTEXT_SIZE 54
#define MAX_CONTEXT_SIZE 55

#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )

Expand All @@ -277,9 +277,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
*
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
* 16 16 8 8 4 16 1
* 16 17 8 8 4 16 1
*/
#define MAX_CONTEXT_SIZE 69
#define MAX_CONTEXT_SIZE 70

#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */

Expand All @@ -290,9 +290,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+----------------------+-----+
*
* <-----------><--------------><---------><----------------><---------------------><---->
* 16 16 8 8 4 1
* 16 17 8 8 4 1
*/
#define MAX_CONTEXT_SIZE 53
#define MAX_CONTEXT_SIZE 54

#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */

Expand Down
16 changes: 8 additions & 8 deletions portable/GCC/ARM_CM33/non_secure/portmacrocommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
*
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
* 16 16 8 8 5 16 1
* 16 17 8 8 5 16 1
*/
#define MAX_CONTEXT_SIZE 70
#define MAX_CONTEXT_SIZE 71

#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )

Expand All @@ -264,9 +264,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+------------------------------+-----+
*
* <-----------><--------------><---------><----------------><-----------------------------><---->
* 16 16 8 8 5 1
* 16 17 8 8 5 1
*/
#define MAX_CONTEXT_SIZE 54
#define MAX_CONTEXT_SIZE 55

#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )

Expand All @@ -277,9 +277,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
*
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
* 16 16 8 8 4 16 1
* 16 17 8 8 4 16 1
*/
#define MAX_CONTEXT_SIZE 69
#define MAX_CONTEXT_SIZE 70

#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */

Expand All @@ -290,9 +290,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+----------------------+-----+
*
* <-----------><--------------><---------><----------------><---------------------><---->
* 16 16 8 8 4 1
* 16 17 8 8 4 1
*/
#define MAX_CONTEXT_SIZE 53
#define MAX_CONTEXT_SIZE 54

#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */

Expand Down
16 changes: 8 additions & 8 deletions portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
*
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
* 16 16 8 8 5 16 1
* 16 17 8 8 5 16 1
*/
#define MAX_CONTEXT_SIZE 70
#define MAX_CONTEXT_SIZE 71

#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )

Expand All @@ -264,9 +264,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+------------------------------+-----+
*
* <-----------><--------------><---------><----------------><-----------------------------><---->
* 16 16 8 8 5 1
* 16 17 8 8 5 1
*/
#define MAX_CONTEXT_SIZE 54
#define MAX_CONTEXT_SIZE 55

#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )

Expand All @@ -277,9 +277,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
*
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
* 16 16 8 8 4 16 1
* 16 17 8 8 4 16 1
*/
#define MAX_CONTEXT_SIZE 69
#define MAX_CONTEXT_SIZE 70

#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */

Expand All @@ -290,9 +290,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+----------------------+-----+
*
* <-----------><--------------><---------><----------------><---------------------><---->
* 16 16 8 8 4 1
* 16 17 8 8 4 1
*/
#define MAX_CONTEXT_SIZE 53
#define MAX_CONTEXT_SIZE 54

#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */

Expand Down
16 changes: 8 additions & 8 deletions portable/GCC/ARM_CM35P/non_secure/portmacrocommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
*
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
* 16 16 8 8 5 16 1
* 16 17 8 8 5 16 1
*/
#define MAX_CONTEXT_SIZE 70
#define MAX_CONTEXT_SIZE 71

#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )

Expand All @@ -264,9 +264,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+------------------------------+-----+
*
* <-----------><--------------><---------><----------------><-----------------------------><---->
* 16 16 8 8 5 1
* 16 17 8 8 5 1
*/
#define MAX_CONTEXT_SIZE 54
#define MAX_CONTEXT_SIZE 55

#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )

Expand All @@ -277,9 +277,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
*
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
* 16 16 8 8 4 16 1
* 16 17 8 8 4 16 1
*/
#define MAX_CONTEXT_SIZE 69
#define MAX_CONTEXT_SIZE 70

#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */

Expand All @@ -290,9 +290,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
* +-----------+---------------+----------+-----------------+----------------------+-----+
*
* <-----------><--------------><---------><----------------><---------------------><---->
* 16 16 8 8 4 1
* 16 17 8 8 4 1
*/
#define MAX_CONTEXT_SIZE 53
#define MAX_CONTEXT_SIZE 54

#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */

Expand Down
Loading

0 comments on commit 11d0caa

Please sign in to comment.