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:
Gaurav-Aggarwal-AWS 2023-11-21 18:42:23 +05:30 committed by GitHub
parent 52c1c6e578
commit 9bfd85a253
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
115 changed files with 46168 additions and 54704 deletions

View file

@ -32,6 +32,7 @@ To avoid errors place any such code inside a #ifdef __ICCARM__/#endif block so
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>
#include <mpu_syscall_numbers.h>
RSEG CODE:CODE(2)
thumb
@ -40,7 +41,6 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler.
EXTERN vTaskSwitchContext
EXTERN vPortSVCHandler_C
EXTERN vSystemCallEnter
EXTERN vSystemCallEnter_1
EXTERN vSystemCallExit
PUBLIC xPortPendSVHandler
@ -58,9 +58,8 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler.
#endif
/* These must be in sync with portmacro.h. */
#define portSVC_SYSTEM_CALL_ENTER 3
#define portSVC_SYSTEM_CALL_ENTER_1 4
#define portSVC_SYSTEM_CALL_EXIT 5
#define portSVC_START_SCHEDULER 100
#define portSVC_SYSTEM_CALL_EXIT 103
/*-----------------------------------------------------------*/
xPortPendSVHandler:
@ -164,10 +163,8 @@ vPortSVCHandler:
ldr r1, [r0, #24]
ldrb r2, [r1, #-2]
cmp r2, #portSVC_SYSTEM_CALL_ENTER
beq syscall_enter
cmp r2, #portSVC_SYSTEM_CALL_ENTER_1
beq syscall_enter_1
cmp r2, #NUM_SYSTEM_CALLS
blt syscall_enter
cmp r2, #portSVC_SYSTEM_CALL_EXIT
beq syscall_exit
b vPortSVCHandler_C
@ -176,10 +173,6 @@ vPortSVCHandler:
mov r1, lr
b vSystemCallEnter
syscall_enter_1:
mov r1, lr
b vSystemCallEnter_1
syscall_exit:
mov r1, lr
b vSystemCallExit
@ -218,7 +211,7 @@ vPortStartFirstTask:
cpsie f
dsb
isb
svc 0
svc #portSVC_START_SCHEDULER
/*-----------------------------------------------------------*/