mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
formatting: Fix uncrustify findings
Signed-off-by: Ahmed Ismail <Ahmed.Ismail@arm.com> Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
parent
3f23eab8c7
commit
326cbe1394
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M35.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M35.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M35.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M35.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M35.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M35.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M35.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M35.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M35.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M35.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
#ifndef configENABLE_MVE
|
#ifndef configENABLE_MVE
|
||||||
#define configENABLE_MVE 0
|
#define configENABLE_MVE 0
|
||||||
#elif( configENABLE_MVE != 0 )
|
#elif ( configENABLE_MVE != 0 )
|
||||||
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M35.
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M35.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
|
@ -229,7 +229,8 @@ typedef void ( * portISR_t )( void );
|
||||||
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
#define portMPU_RLAR_REGION_ENABLE ( 1UL )
|
||||||
|
|
||||||
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
#if ( portARMV8M_MINOR_VERSION >= 1 )
|
||||||
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
|
||||||
|
/* Enable Privileged eXecute Never MPU attribute for the selected memory
|
||||||
* region. */
|
* region. */
|
||||||
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
#define portMPU_RLAR_PRIVILEGED_EXECUTE_NEVER ( 1UL << 4UL )
|
||||||
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
#endif /* portARMV8M_MINOR_VERSION >= 1 */
|
||||||
|
@ -380,7 +381,7 @@ typedef void ( * portISR_t )( void );
|
||||||
/**
|
/**
|
||||||
* @brief Constants required to check and configure PACBTI security feature implementation.
|
* @brief Constants required to check and configure PACBTI security feature implementation.
|
||||||
*/
|
*/
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
#define portID_ISAR5_REG ( *( ( volatile uint32_t * ) 0xe000ed74 ) )
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void prvTaskExitError( void );
|
||||||
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configENABLE_FPU */
|
#endif /* configENABLE_FPU */
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures PACBTI features.
|
* @brief Configures PACBTI features.
|
||||||
|
@ -1212,6 +1213,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __syscalls_flash_start__;
|
extern uint32_t * __syscalls_flash_start__;
|
||||||
|
@ -1282,6 +1284,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
* point (i.e. the caller of the MPU_<API>). We need to restore it
|
||||||
* when we exit from the system call. */
|
* when we exit from the system call. */
|
||||||
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ];
|
||||||
|
|
||||||
/* Store the value of the PSPLIM register before the SVC was raised.
|
/* Store the value of the PSPLIM register before the SVC was raised.
|
||||||
* We need to restore it when we exit from the system call. */
|
* We need to restore it when we exit from the system call. */
|
||||||
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
#if ( portUSE_PSPLIM_REGISTER == 1 )
|
||||||
|
@ -1300,6 +1303,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
|
|
||||||
/* Start executing the system call upon returning from this handler. */
|
/* Start executing the system call upon returning from this handler. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ];
|
||||||
|
|
||||||
/* Raise a request to exit from the system call upon finishing the
|
/* Raise a request to exit from the system call upon finishing the
|
||||||
* system call. */
|
* system call. */
|
||||||
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit;
|
||||||
|
@ -1359,6 +1363,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
|
||||||
|
|
||||||
#if defined( __ARMCC_VERSION )
|
#if defined( __ARMCC_VERSION )
|
||||||
|
|
||||||
/* Declaration when these variable are defined in code instead of being
|
/* Declaration when these variable are defined in code instead of being
|
||||||
* exported from linker scripts. */
|
* exported from linker scripts. */
|
||||||
extern uint32_t * __privileged_functions_start__;
|
extern uint32_t * __privileged_functions_start__;
|
||||||
|
@ -1541,7 +1546,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
||||||
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
xMPUSettings->ulContext[ ulIndex ] = ( uint32_t ) pxEndOfStack; /* PSPLIM. */
|
||||||
ulIndex++;
|
ulIndex++;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Check PACBTI security feature configuration before pushing the
|
/* Check PACBTI security feature configuration before pushing the
|
||||||
* CONTROL register's value on task's TCB. */
|
* CONTROL register's value on task's TCB. */
|
||||||
|
@ -1814,11 +1819,11 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
portNVIC_SHPR2_REG = 0;
|
portNVIC_SHPR2_REG = 0;
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
{
|
{
|
||||||
/* Set the CONTROL register value based on PACBTI security feature
|
/* Set the CONTROL register value based on PACBTI security feature
|
||||||
* configuration before starting the first task. */
|
* configuration before starting the first task. */
|
||||||
( void) prvConfigurePACBTI( pdTRUE );
|
( void ) prvConfigurePACBTI( pdTRUE );
|
||||||
}
|
}
|
||||||
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
#endif /* configENABLE_PAC == 1 || configENABLE_BTI == 1 */
|
||||||
|
|
||||||
|
@ -2241,7 +2246,7 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
#if ( ( configENABLE_PAC == 1 ) || ( configENABLE_BTI == 1 ) )
|
||||||
|
|
||||||
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
static uint32_t prvConfigurePACBTI( BaseType_t xWriteControlRegister )
|
||||||
{
|
{
|
||||||
|
@ -2253,13 +2258,13 @@ BaseType_t xPortIsInsideInterrupt( void )
|
||||||
/* Enable UsageFault exception. */
|
/* Enable UsageFault exception. */
|
||||||
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
portSCB_SYS_HANDLER_CTRL_STATE_REG |= portSCB_USG_FAULT_ENABLE_BIT;
|
||||||
|
|
||||||
#if( configENABLE_PAC == 1 )
|
#if ( configENABLE_PAC == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
ulControl |= ( portCONTROL_UPAC_EN | portCONTROL_PAC_EN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( configENABLE_BTI == 1 )
|
#if ( configENABLE_BTI == 1 )
|
||||||
{
|
{
|
||||||
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
ulControl |= ( portCONTROL_UBTI_EN | portCONTROL_BTI_EN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,54 +243,55 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
/*
|
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
/*
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
*
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
*
|
||||||
* 16 16 8 8 5 16 1
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
*/
|
* 16 16 8 8 5 16 1
|
||||||
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 70
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 16 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | | |
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
* 16 16 8 8 4 16 1
|
* 16 16 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 69
|
#define MAX_CONTEXT_SIZE 69
|
||||||
|
|
||||||
#else
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | | | PC, xPSR | EXC_RETURN | |
|
* | | | | PC, xPSR | EXC_RETURN | |
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 16 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 53
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
@ -299,54 +300,54 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
* +----------+-----------------+------------------------------+------------+-----+
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><-----------><---->
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
* 8 8 5 16 1
|
* 8 8 5 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 38
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
|
||||||
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
* | | PC, xPSR | CONTROL, EXC_RETURN | |
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><------------------------------><---->
|
* <---------><----------------><------------------------------><---->
|
||||||
* 8 8 5 1
|
* 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
* | | PC, xPSR | EXC_RETURN | | |
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
* +----------+-----------------+----------------------+------------+-----+
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><-----------><---->
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
* 8 8 4 16 1
|
* 8 8 4 16 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 37
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
|
||||||
* | | PC, xPSR | EXC_RETURN | |
|
* | | PC, xPSR | EXC_RETURN | |
|
||||||
* +----------+-----------------+----------------------+-----+
|
* +----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <---------><----------------><----------------------><---->
|
* <---------><----------------><----------------------><---->
|
||||||
* 8 8 4 1
|
* 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
Loading…
Reference in a new issue