mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-01-18 15:50:32 -05:00
Update system call entry mechanism (#896)
Earlier the System Call entry from an unprivileged task looked like: 1. SVC for entering system call. 2. System call implementation. 3. SVC for exiting system call. Now, the system call entry needs to make only one system call and everything else is handled internally. This PR also makes the following small changes: 1. Add one struct param for system calls with 5 parameters. This removes the need for special handling for system calls with 5 parameters. 2. Remove raise privilege SVC when MPU wrapper v2 is used. 3. Add additional run time parameter checks to MPU wrappers for xTaskGenericNotify and xQueueTakeMutexRecursive APIs. These changes are tested on the following platforms: 1. STM32H743ZI (Cortex-M7) 2. STM32L152RE (Cortex-M3) 3. Nuvoton M2351 (Cortex-M23) 4. NXP LPC55S69 (Cortex-M33)
This commit is contained in:
parent
52c1c6e578
commit
9bfd85a253
115 changed files with 46168 additions and 54704 deletions
|
|
@ -33,6 +33,9 @@ the code is included in C files but excluded by the preprocessor in assembly
|
|||
files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler. */
|
||||
#include "FreeRTOSConfig.h"
|
||||
|
||||
/* System call numbers includes. */
|
||||
#include "mpu_syscall_numbers.h"
|
||||
|
||||
#ifndef configUSE_MPU_WRAPPERS_V1
|
||||
#define configUSE_MPU_WRAPPERS_V1 0
|
||||
#endif
|
||||
|
|
@ -45,7 +48,6 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler.
|
|||
EXTERN SecureContext_LoadContext
|
||||
#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) )
|
||||
EXTERN vSystemCallEnter
|
||||
EXTERN vSystemCallEnter_1
|
||||
EXTERN vSystemCallExit
|
||||
#endif
|
||||
|
||||
|
|
@ -95,7 +97,7 @@ vResetPrivilege:
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
vPortAllocateSecureContext:
|
||||
svc 0 /* Secure context is allocated in the supervisor call. portSVC_ALLOCATE_SECURE_CONTEXT = 0. */
|
||||
svc 100 /* Secure context is allocated in the supervisor call. portSVC_ALLOCATE_SECURE_CONTEXT = 100. */
|
||||
bx lr /* Return. */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
@ -230,7 +232,7 @@ vStartFirstTask:
|
|||
cpsie i /* Globally enable interrupts. */
|
||||
dsb
|
||||
isb
|
||||
svc 2 /* System call to start the first task. portSVC_START_SCHEDULER = 2. */
|
||||
svc 102 /* System call to start the first task. portSVC_START_SCHEDULER = 102. */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
ulSetInterruptMask:
|
||||
|
|
@ -482,21 +484,17 @@ SVC_Handler:
|
|||
b route_svc
|
||||
|
||||
route_svc:
|
||||
ldr r2, [r0, #24]
|
||||
subs r2, #2
|
||||
ldrb r3, [r2, #0]
|
||||
cmp r3, #4 /* portSVC_SYSTEM_CALL_ENTER. */
|
||||
beq system_call_enter
|
||||
cmp r3, #5 /* portSVC_SYSTEM_CALL_ENTER_1. */
|
||||
beq system_call_enter_1
|
||||
cmp r3, #6 /* portSVC_SYSTEM_CALL_EXIT. */
|
||||
ldr r3, [r0, #24]
|
||||
subs r3, #2
|
||||
ldrb r2, [r3, #0]
|
||||
cmp r2, #NUM_SYSTEM_CALLS
|
||||
blt system_call_enter
|
||||
cmp r2, #104 /* portSVC_SYSTEM_CALL_EXIT. */
|
||||
beq system_call_exit
|
||||
b vPortSVCHandler_C
|
||||
|
||||
system_call_enter:
|
||||
b vSystemCallEnter
|
||||
system_call_enter_1:
|
||||
b vSystemCallEnter_1
|
||||
system_call_exit:
|
||||
b vSystemCallExit
|
||||
|
||||
|
|
@ -523,7 +521,7 @@ vPortFreeSecureContext:
|
|||
bne free_secure_context /* Branch if r1 != 0. */
|
||||
bx lr /* There is no secure context (xSecureContext is NULL). */
|
||||
free_secure_context:
|
||||
svc 1 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 1. */
|
||||
svc 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */
|
||||
bx lr /* Return. */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue