diff --git a/include/mpu_prototypes.h b/include/mpu_prototypes.h index 1c9d8c048..547320180 100644 --- a/include/mpu_prototypes.h +++ b/include/mpu_prototypes.h @@ -38,6 +38,42 @@ #ifndef MPU_PROTOTYPES_H #define MPU_PROTOTYPES_H +typedef struct xTaskGenericNotifyParams +{ + TaskHandle_t xTaskToNotify; + UBaseType_t uxIndexToNotify; + uint32_t ulValue; + eNotifyAction eAction; + uint32_t * pulPreviousNotificationValue; +} xTaskGenericNotifyParams_t; + +typedef struct xTaskGenericNotifyWaitParams +{ + UBaseType_t uxIndexToWaitOn; + uint32_t ulBitsToClearOnEntry; + uint32_t ulBitsToClearOnExit; + uint32_t * pulNotificationValue; + TickType_t xTicksToWait; +} xTaskGenericNotifyWaitParams_t; + +typedef struct xTimerGenericCommandFromTaskParams +{ + TimerHandle_t xTimer; + BaseType_t xCommandID; + TickType_t xOptionalValue; + BaseType_t * pxHigherPriorityTaskWoken; + TickType_t xTicksToWait; +} xTimerGenericCommandFromTaskParams_t; + +typedef struct xEventGroupWaitBitsParams +{ + EventGroupHandle_t xEventGroup; + EventBits_t uxBitsToWaitFor; + BaseType_t xClearOnExit; + BaseType_t xWaitForAllBits; + TickType_t xTicksToWait; +} xEventGroupWaitBitsParams_t; + /* MPU versions of task.h API functions. */ void MPU_vTaskDelay( const TickType_t xTicksToDelay ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xTaskDelayUntil( TickType_t * const pxPreviousWakeTime, @@ -76,11 +112,13 @@ BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t * pulPreviousNotificationValue ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t * pulNotificationValue, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) FREERTOS_SYSTEM_CALL; uint32_t MPU_ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn, BaseType_t xClearCountOnExit, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; @@ -230,9 +268,10 @@ BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) FREERTOS_SYSTEM_CALL; const char * MPU_pcTimerGetName( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; void MPU_vTimerSetReloadMode( TimerHandle_t xTimer, - const UBaseType_t uxAutoReload ) FREERTOS_SYSTEM_CALL; + const BaseType_t uxAutoReload ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xTimerGetReloadMode( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; UBaseType_t MPU_uxTimerGetReloadMode( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; @@ -266,6 +305,7 @@ EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; +EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) FREERTOS_SYSTEM_CALL; EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ) FREERTOS_SYSTEM_CALL; EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup, diff --git a/include/mpu_syscall_numbers.h b/include/mpu_syscall_numbers.h new file mode 100644 index 000000000..47913c998 --- /dev/null +++ b/include/mpu_syscall_numbers.h @@ -0,0 +1,105 @@ +/* + * FreeRTOS Kernel + * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +#ifndef MPU_SYSCALL_NUMBERS_H +#define MPU_SYSCALL_NUMBERS_H + +/* Numbers assigned to various system calls. */ +#define SYSTEM_CALL_xTaskGenericNotify 0 +#define SYSTEM_CALL_xTaskGenericNotifyWait 1 +#define SYSTEM_CALL_xTimerGenericCommandFromTask 2 +#define SYSTEM_CALL_xEventGroupWaitBits 3 +#define SYSTEM_CALL_xTaskDelayUntil 4 +#define SYSTEM_CALL_xTaskAbortDelay 5 +#define SYSTEM_CALL_vTaskDelay 6 +#define SYSTEM_CALL_uxTaskPriorityGet 7 +#define SYSTEM_CALL_eTaskGetState 8 +#define SYSTEM_CALL_vTaskGetInfo 9 +#define SYSTEM_CALL_xTaskGetIdleTaskHandle 10 +#define SYSTEM_CALL_vTaskSuspend 11 +#define SYSTEM_CALL_vTaskResume 12 +#define SYSTEM_CALL_xTaskGetTickCount 13 +#define SYSTEM_CALL_uxTaskGetNumberOfTasks 14 +#define SYSTEM_CALL_ulTaskGetRunTimeCounter 15 +#define SYSTEM_CALL_ulTaskGetRunTimePercent 16 +#define SYSTEM_CALL_ulTaskGetIdleRunTimePercent 17 +#define SYSTEM_CALL_ulTaskGetIdleRunTimeCounter 18 +#define SYSTEM_CALL_vTaskSetApplicationTaskTag 19 +#define SYSTEM_CALL_xTaskGetApplicationTaskTag 20 +#define SYSTEM_CALL_vTaskSetThreadLocalStoragePointer 21 +#define SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer 22 +#define SYSTEM_CALL_uxTaskGetSystemState 23 +#define SYSTEM_CALL_uxTaskGetStackHighWaterMark 24 +#define SYSTEM_CALL_uxTaskGetStackHighWaterMark2 25 +#define SYSTEM_CALL_xTaskGetCurrentTaskHandle 26 +#define SYSTEM_CALL_xTaskGetSchedulerState 27 +#define SYSTEM_CALL_vTaskSetTimeOutState 28 +#define SYSTEM_CALL_xTaskCheckForTimeOut 29 +#define SYSTEM_CALL_ulTaskGenericNotifyTake 30 +#define SYSTEM_CALL_xTaskGenericNotifyStateClear 31 +#define SYSTEM_CALL_ulTaskGenericNotifyValueClear 32 +#define SYSTEM_CALL_xQueueGenericSend 33 +#define SYSTEM_CALL_uxQueueMessagesWaiting 34 +#define SYSTEM_CALL_uxQueueSpacesAvailable 35 +#define SYSTEM_CALL_xQueueReceive 36 +#define SYSTEM_CALL_xQueuePeek 37 +#define SYSTEM_CALL_xQueueSemaphoreTake 38 +#define SYSTEM_CALL_xQueueGetMutexHolder 39 +#define SYSTEM_CALL_xQueueTakeMutexRecursive 40 +#define SYSTEM_CALL_xQueueGiveMutexRecursive 41 +#define SYSTEM_CALL_xQueueSelectFromSet 42 +#define SYSTEM_CALL_xQueueAddToSet 43 +#define SYSTEM_CALL_vQueueAddToRegistry 44 +#define SYSTEM_CALL_vQueueUnregisterQueue 45 +#define SYSTEM_CALL_pcQueueGetName 46 +#define SYSTEM_CALL_pvTimerGetTimerID 47 +#define SYSTEM_CALL_vTimerSetTimerID 48 +#define SYSTEM_CALL_xTimerIsTimerActive 49 +#define SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle 50 +#define SYSTEM_CALL_pcTimerGetName 51 +#define SYSTEM_CALL_vTimerSetReloadMode 52 +#define SYSTEM_CALL_xTimerGetReloadMode 53 +#define SYSTEM_CALL_uxTimerGetReloadMode 54 +#define SYSTEM_CALL_xTimerGetPeriod 55 +#define SYSTEM_CALL_xTimerGetExpiryTime 56 +#define SYSTEM_CALL_xEventGroupClearBits 57 +#define SYSTEM_CALL_xEventGroupSetBits 58 +#define SYSTEM_CALL_xEventGroupSync 59 +#define SYSTEM_CALL_uxEventGroupGetNumber 60 +#define SYSTEM_CALL_vEventGroupSetNumber 61 +#define SYSTEM_CALL_xStreamBufferSend 62 +#define SYSTEM_CALL_xStreamBufferReceive 63 +#define SYSTEM_CALL_xStreamBufferIsFull 64 +#define SYSTEM_CALL_xStreamBufferIsEmpty 65 +#define SYSTEM_CALL_xStreamBufferSpacesAvailable 66 +#define SYSTEM_CALL_xStreamBufferBytesAvailable 67 +#define SYSTEM_CALL_xStreamBufferSetTriggerLevel 68 +#define SYSTEM_CALL_xStreamBufferNextMessageLengthBytes 69 +#define NUM_SYSTEM_CALLS 70 /* Total number of system calls. */ + +#endif /* MPU_SYSCALL_NUMBERS_H */ diff --git a/portable/ARMv8M/non_secure/port.c b/portable/ARMv8M/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/ARMv8M/non_secure/port.c +++ b/portable/ARMv8M/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23/mpu_wrappers_v2_asm.c b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23/mpu_wrappers_v2_asm.c index 00c8bcfa8..e67f3cbae 100644 --- a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23/mpu_wrappers_v2_asm.c +++ b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23/mpu_wrappers_v2_asm.c @@ -38,6 +38,8 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -68,11 +70,8 @@ " MPU_xTaskDelayUntil_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskDelayUntilImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskDelayUntil ) : "memory" ); } @@ -101,11 +100,8 @@ " MPU_xTaskAbortDelay_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskAbortDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskAbortDelay ) : "memory" ); } @@ -134,11 +130,8 @@ " MPU_vTaskDelay_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskDelay ) : "memory" ); } @@ -167,11 +160,8 @@ " MPU_uxTaskPriorityGet_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskPriorityGetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskPriorityGet ) : "memory" ); } @@ -200,11 +190,8 @@ " MPU_eTaskGetState_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_eTaskGetStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_eTaskGetState ) : "memory" ); } @@ -239,11 +226,8 @@ " MPU_vTaskGetInfo_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskGetInfoImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskGetInfo ) : "memory" ); } @@ -272,11 +256,8 @@ " MPU_xTaskGetIdleTaskHandle_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetIdleTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetIdleTaskHandle ) : "memory" ); } @@ -305,11 +286,8 @@ " MPU_vTaskSuspend_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskSuspendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSuspend ) : "memory" ); } @@ -338,11 +316,8 @@ " MPU_vTaskResume_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskResumeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskResume ) : "memory" ); } @@ -369,11 +344,8 @@ " MPU_xTaskGetTickCount_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetTickCountImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetTickCount ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -398,11 +370,8 @@ " MPU_uxTaskGetNumberOfTasks_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskGetNumberOfTasksImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetNumberOfTasks ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -429,11 +398,8 @@ " MPU_ulTaskGetRunTimeCounter_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimeCounter ) : "memory" ); } @@ -462,11 +428,8 @@ " MPU_ulTaskGetRunTimePercent_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimePercent ) : "memory" ); } @@ -495,11 +458,8 @@ " MPU_ulTaskGetIdleRunTimePercent_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimePercent ) : "memory" ); } @@ -528,11 +488,8 @@ " MPU_ulTaskGetIdleRunTimeCounter_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimeCounter ) : "memory" ); } @@ -563,11 +520,8 @@ " MPU_vTaskSetApplicationTaskTag_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskSetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetApplicationTaskTag ) : "memory" ); } @@ -596,11 +550,8 @@ " MPU_xTaskGetApplicationTaskTag_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetApplicationTaskTag ) : "memory" ); } @@ -633,11 +584,8 @@ " MPU_vTaskSetThreadLocalStoragePointer_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskSetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetThreadLocalStoragePointer ) : "memory" ); } @@ -668,11 +616,8 @@ " MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_pvTaskGetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer ) : "memory" ); } @@ -705,11 +650,8 @@ " MPU_uxTaskGetSystemState_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskGetSystemStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetSystemState ) : "memory" ); } @@ -738,11 +680,8 @@ " MPU_uxTaskGetStackHighWaterMark_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMarkImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark ) : "memory" ); } @@ -771,11 +710,8 @@ " MPU_uxTaskGetStackHighWaterMark2_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMark2Impl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark2 ) : "memory" ); } @@ -804,11 +740,8 @@ " MPU_xTaskGetCurrentTaskHandle_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetCurrentTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetCurrentTaskHandle ) : "memory" ); } @@ -837,11 +770,8 @@ " MPU_xTaskGetSchedulerState_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetSchedulerStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetSchedulerState ) : "memory" ); } @@ -868,11 +798,8 @@ " MPU_vTaskSetTimeOutState_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskSetTimeOutStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetTimeOutState ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -899,28 +826,17 @@ " MPU_xTaskCheckForTimeOut_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskCheckForTimeOutImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskCheckForTimeOut ) : "memory" ); } /*-----------------------------------------------------------*/ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -938,11 +854,8 @@ " MPU_xTaskGenericNotify_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotify ) : "memory" ); } @@ -951,17 +864,9 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -979,11 +884,8 @@ " MPU_xTaskGenericNotifyWait_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyWaitImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyWait ) : "memory" ); } @@ -1016,11 +918,8 @@ " MPU_ulTaskGenericNotifyTake_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyTake ) : "memory" ); } @@ -1051,11 +950,8 @@ " MPU_xTaskGenericNotifyStateClear_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyStateClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyStateClear ) : "memory" ); } @@ -1088,11 +984,8 @@ " MPU_ulTaskGenericNotifyValueClear_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyValueClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyValueClear ) : "memory" ); } @@ -1125,11 +1018,8 @@ " MPU_xQueueGenericSend_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueGenericSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGenericSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1154,11 +1044,8 @@ " MPU_uxQueueMessagesWaiting_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxQueueMessagesWaitingImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueMessagesWaiting ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1183,11 +1070,8 @@ " MPU_uxQueueSpacesAvailable_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxQueueSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1216,11 +1100,8 @@ " MPU_xQueueReceive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1249,11 +1130,8 @@ " MPU_xQueuePeek_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueuePeekImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueuePeek ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1280,11 +1158,8 @@ " MPU_xQueueSemaphoreTake_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueSemaphoreTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSemaphoreTake ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1311,11 +1186,8 @@ " MPU_xQueueGetMutexHolder_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueGetMutexHolderImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGetMutexHolder ) : "memory" ); } @@ -1346,11 +1218,8 @@ " MPU_xQueueTakeMutexRecursive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueTakeMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueTakeMutexRecursive ) : "memory" ); } @@ -1379,11 +1248,8 @@ " MPU_xQueueGiveMutexRecursive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueGiveMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGiveMutexRecursive ) : "memory" ); } @@ -1414,11 +1280,8 @@ " MPU_xQueueSelectFromSet_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueSelectFromSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSelectFromSet ) : "memory" ); } @@ -1449,11 +1312,8 @@ " MPU_xQueueAddToSet_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueAddToSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueAddToSet ) : "memory" ); } @@ -1484,11 +1344,8 @@ " MPU_vQueueAddToRegistry_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vQueueAddToRegistryImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueAddToRegistry ) : "memory" ); } @@ -1517,11 +1374,8 @@ " MPU_vQueueUnregisterQueue_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vQueueUnregisterQueueImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueUnregisterQueue ) : "memory" ); } @@ -1550,11 +1404,8 @@ " MPU_pcQueueGetName_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_pcQueueGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcQueueGetName ) : "memory" ); } @@ -1583,11 +1434,8 @@ " MPU_pvTimerGetTimerID_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_pvTimerGetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTimerGetTimerID ) : "memory" ); } @@ -1618,11 +1466,8 @@ " MPU_vTimerSetTimerID_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTimerSetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetTimerID ) : "memory" ); } @@ -1651,11 +1496,8 @@ " MPU_xTimerIsTimerActive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerIsTimerActiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerIsTimerActive ) : "memory" ); } @@ -1684,11 +1526,8 @@ " MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGetTimerDaemonTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle ) : "memory" ); } @@ -1697,17 +1536,9 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1725,11 +1556,8 @@ " MPU_xTimerGenericCommandFromTask_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGenericCommandFromTaskImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGenericCommandFromTask ) : "memory" ); } @@ -1758,11 +1586,8 @@ " MPU_pcTimerGetName_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_pcTimerGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcTimerGetName ) : "memory" ); } @@ -1793,11 +1618,8 @@ " MPU_vTimerSetReloadMode_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTimerSetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetReloadMode ) : "memory" ); } @@ -1826,11 +1648,8 @@ " MPU_xTimerGetReloadMode_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetReloadMode ) : "memory" ); } @@ -1859,11 +1678,8 @@ " MPU_uxTimerGetReloadMode_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTimerGetReloadMode ) : "memory" ); } @@ -1892,11 +1708,8 @@ " MPU_xTimerGetPeriod_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGetPeriodImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetPeriod ) : "memory" ); } @@ -1925,28 +1738,17 @@ " MPU_xTimerGetExpiryTime_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGetExpiryTimeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetExpiryTime ) : "memory" ); } #endif /* if ( configUSE_TIMERS == 1 ) */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1964,11 +1766,8 @@ " MPU_xEventGroupWaitBits_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xEventGroupWaitBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupWaitBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1995,11 +1794,8 @@ " MPU_xEventGroupClearBits_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xEventGroupClearBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupClearBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2026,11 +1822,8 @@ " MPU_xEventGroupSetBits_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xEventGroupSetBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSetBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2061,11 +1854,8 @@ " MPU_xEventGroupSync_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xEventGroupSyncImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSync ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2092,11 +1882,8 @@ " MPU_uxEventGroupGetNumber_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxEventGroupGetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxEventGroupGetNumber ) : "memory" ); } @@ -2127,11 +1914,8 @@ " MPU_vEventGroupSetNumber_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vEventGroupSetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vEventGroupSetNumber ) : "memory" ); } @@ -2164,11 +1948,8 @@ " MPU_xStreamBufferSend_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2199,11 +1980,8 @@ " MPU_xStreamBufferReceive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2228,11 +2006,8 @@ " MPU_xStreamBufferIsFull_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsFullImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsFull ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2257,11 +2032,8 @@ " MPU_xStreamBufferIsEmpty_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsEmptyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsEmpty ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2286,11 +2058,8 @@ " MPU_xStreamBufferSpacesAvailable_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2315,11 +2084,8 @@ " MPU_xStreamBufferBytesAvailable_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferBytesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferBytesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2346,11 +2112,8 @@ " MPU_xStreamBufferSetTriggerLevel_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferSetTriggerLevelImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSetTriggerLevel ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2375,11 +2138,8 @@ " MPU_xStreamBufferNextMessageLengthBytes_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferNextMessageLengthBytesImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferNextMessageLengthBytes ) : "memory" ); } /*-----------------------------------------------------------*/ diff --git a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23/portasm.c b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23/portasm.c index 1b41d587f..f8b37b691 100644 --- a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23/portasm.c +++ b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23/portasm.c @@ -36,6 +36,9 @@ /* Portasm includes. */ #include "portasm.h" +/* System call numbers includes. */ +#include "mpu_syscall_numbers.h" + /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the * header files. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -538,7 +541,6 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att ".syntax unified \n" ".extern vPortSVCHandler_C \n" ".extern vSystemCallEnter \n" - ".extern vSystemCallEnter_1 \n" ".extern vSystemCallExit \n" " \n" "movs r0, #4 \n" @@ -553,26 +555,22 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att " b route_svc \n" " \n" "route_svc: \n" - " ldr r2, [r0, #24] \n" - " subs r2, #2 \n" - " ldrb r3, [r2, #0] \n" - " cmp r3, %0 \n" - " beq system_call_enter \n" - " cmp r3, %1 \n" - " beq system_call_enter_1 \n" - " cmp r3, %2 \n" + " ldr r3, [r0, #24] \n" + " subs r3, #2 \n" + " ldrb r2, [r3, #0] \n" + " cmp r2, %0 \n" + " blt system_call_enter \n" + " cmp r2, %1 \n" " beq system_call_exit \n" " b vPortSVCHandler_C \n" " \n" "system_call_enter: \n" " b vSystemCallEnter \n" - "system_call_enter_1: \n" - " b vSystemCallEnter_1 \n" "system_call_exit: \n" " b vSystemCallExit \n" " \n" : /* No outputs. */ - : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) + : "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "r0", "r1", "r2", "r3", "memory" ); } diff --git a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23_NTZ/mpu_wrappers_v2_asm.c b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23_NTZ/mpu_wrappers_v2_asm.c index 00c8bcfa8..e67f3cbae 100644 --- a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23_NTZ/mpu_wrappers_v2_asm.c +++ b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23_NTZ/mpu_wrappers_v2_asm.c @@ -38,6 +38,8 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -68,11 +70,8 @@ " MPU_xTaskDelayUntil_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskDelayUntilImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskDelayUntil ) : "memory" ); } @@ -101,11 +100,8 @@ " MPU_xTaskAbortDelay_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskAbortDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskAbortDelay ) : "memory" ); } @@ -134,11 +130,8 @@ " MPU_vTaskDelay_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskDelay ) : "memory" ); } @@ -167,11 +160,8 @@ " MPU_uxTaskPriorityGet_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskPriorityGetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskPriorityGet ) : "memory" ); } @@ -200,11 +190,8 @@ " MPU_eTaskGetState_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_eTaskGetStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_eTaskGetState ) : "memory" ); } @@ -239,11 +226,8 @@ " MPU_vTaskGetInfo_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskGetInfoImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskGetInfo ) : "memory" ); } @@ -272,11 +256,8 @@ " MPU_xTaskGetIdleTaskHandle_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetIdleTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetIdleTaskHandle ) : "memory" ); } @@ -305,11 +286,8 @@ " MPU_vTaskSuspend_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskSuspendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSuspend ) : "memory" ); } @@ -338,11 +316,8 @@ " MPU_vTaskResume_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskResumeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskResume ) : "memory" ); } @@ -369,11 +344,8 @@ " MPU_xTaskGetTickCount_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetTickCountImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetTickCount ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -398,11 +370,8 @@ " MPU_uxTaskGetNumberOfTasks_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskGetNumberOfTasksImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetNumberOfTasks ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -429,11 +398,8 @@ " MPU_ulTaskGetRunTimeCounter_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimeCounter ) : "memory" ); } @@ -462,11 +428,8 @@ " MPU_ulTaskGetRunTimePercent_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimePercent ) : "memory" ); } @@ -495,11 +458,8 @@ " MPU_ulTaskGetIdleRunTimePercent_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimePercent ) : "memory" ); } @@ -528,11 +488,8 @@ " MPU_ulTaskGetIdleRunTimeCounter_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimeCounter ) : "memory" ); } @@ -563,11 +520,8 @@ " MPU_vTaskSetApplicationTaskTag_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskSetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetApplicationTaskTag ) : "memory" ); } @@ -596,11 +550,8 @@ " MPU_xTaskGetApplicationTaskTag_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetApplicationTaskTag ) : "memory" ); } @@ -633,11 +584,8 @@ " MPU_vTaskSetThreadLocalStoragePointer_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskSetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetThreadLocalStoragePointer ) : "memory" ); } @@ -668,11 +616,8 @@ " MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_pvTaskGetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer ) : "memory" ); } @@ -705,11 +650,8 @@ " MPU_uxTaskGetSystemState_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskGetSystemStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetSystemState ) : "memory" ); } @@ -738,11 +680,8 @@ " MPU_uxTaskGetStackHighWaterMark_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMarkImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark ) : "memory" ); } @@ -771,11 +710,8 @@ " MPU_uxTaskGetStackHighWaterMark2_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMark2Impl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark2 ) : "memory" ); } @@ -804,11 +740,8 @@ " MPU_xTaskGetCurrentTaskHandle_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetCurrentTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetCurrentTaskHandle ) : "memory" ); } @@ -837,11 +770,8 @@ " MPU_xTaskGetSchedulerState_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetSchedulerStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetSchedulerState ) : "memory" ); } @@ -868,11 +798,8 @@ " MPU_vTaskSetTimeOutState_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskSetTimeOutStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetTimeOutState ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -899,28 +826,17 @@ " MPU_xTaskCheckForTimeOut_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskCheckForTimeOutImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskCheckForTimeOut ) : "memory" ); } /*-----------------------------------------------------------*/ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -938,11 +854,8 @@ " MPU_xTaskGenericNotify_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotify ) : "memory" ); } @@ -951,17 +864,9 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -979,11 +884,8 @@ " MPU_xTaskGenericNotifyWait_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyWaitImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyWait ) : "memory" ); } @@ -1016,11 +918,8 @@ " MPU_ulTaskGenericNotifyTake_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyTake ) : "memory" ); } @@ -1051,11 +950,8 @@ " MPU_xTaskGenericNotifyStateClear_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyStateClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyStateClear ) : "memory" ); } @@ -1088,11 +984,8 @@ " MPU_ulTaskGenericNotifyValueClear_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyValueClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyValueClear ) : "memory" ); } @@ -1125,11 +1018,8 @@ " MPU_xQueueGenericSend_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueGenericSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGenericSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1154,11 +1044,8 @@ " MPU_uxQueueMessagesWaiting_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxQueueMessagesWaitingImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueMessagesWaiting ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1183,11 +1070,8 @@ " MPU_uxQueueSpacesAvailable_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxQueueSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1216,11 +1100,8 @@ " MPU_xQueueReceive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1249,11 +1130,8 @@ " MPU_xQueuePeek_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueuePeekImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueuePeek ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1280,11 +1158,8 @@ " MPU_xQueueSemaphoreTake_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueSemaphoreTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSemaphoreTake ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1311,11 +1186,8 @@ " MPU_xQueueGetMutexHolder_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueGetMutexHolderImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGetMutexHolder ) : "memory" ); } @@ -1346,11 +1218,8 @@ " MPU_xQueueTakeMutexRecursive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueTakeMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueTakeMutexRecursive ) : "memory" ); } @@ -1379,11 +1248,8 @@ " MPU_xQueueGiveMutexRecursive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueGiveMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGiveMutexRecursive ) : "memory" ); } @@ -1414,11 +1280,8 @@ " MPU_xQueueSelectFromSet_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueSelectFromSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSelectFromSet ) : "memory" ); } @@ -1449,11 +1312,8 @@ " MPU_xQueueAddToSet_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueAddToSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueAddToSet ) : "memory" ); } @@ -1484,11 +1344,8 @@ " MPU_vQueueAddToRegistry_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vQueueAddToRegistryImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueAddToRegistry ) : "memory" ); } @@ -1517,11 +1374,8 @@ " MPU_vQueueUnregisterQueue_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vQueueUnregisterQueueImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueUnregisterQueue ) : "memory" ); } @@ -1550,11 +1404,8 @@ " MPU_pcQueueGetName_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_pcQueueGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcQueueGetName ) : "memory" ); } @@ -1583,11 +1434,8 @@ " MPU_pvTimerGetTimerID_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_pvTimerGetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTimerGetTimerID ) : "memory" ); } @@ -1618,11 +1466,8 @@ " MPU_vTimerSetTimerID_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTimerSetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetTimerID ) : "memory" ); } @@ -1651,11 +1496,8 @@ " MPU_xTimerIsTimerActive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerIsTimerActiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerIsTimerActive ) : "memory" ); } @@ -1684,11 +1526,8 @@ " MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGetTimerDaemonTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle ) : "memory" ); } @@ -1697,17 +1536,9 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1725,11 +1556,8 @@ " MPU_xTimerGenericCommandFromTask_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGenericCommandFromTaskImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGenericCommandFromTask ) : "memory" ); } @@ -1758,11 +1586,8 @@ " MPU_pcTimerGetName_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_pcTimerGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcTimerGetName ) : "memory" ); } @@ -1793,11 +1618,8 @@ " MPU_vTimerSetReloadMode_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTimerSetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetReloadMode ) : "memory" ); } @@ -1826,11 +1648,8 @@ " MPU_xTimerGetReloadMode_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetReloadMode ) : "memory" ); } @@ -1859,11 +1678,8 @@ " MPU_uxTimerGetReloadMode_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTimerGetReloadMode ) : "memory" ); } @@ -1892,11 +1708,8 @@ " MPU_xTimerGetPeriod_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGetPeriodImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetPeriod ) : "memory" ); } @@ -1925,28 +1738,17 @@ " MPU_xTimerGetExpiryTime_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGetExpiryTimeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetExpiryTime ) : "memory" ); } #endif /* if ( configUSE_TIMERS == 1 ) */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1964,11 +1766,8 @@ " MPU_xEventGroupWaitBits_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xEventGroupWaitBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupWaitBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1995,11 +1794,8 @@ " MPU_xEventGroupClearBits_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xEventGroupClearBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupClearBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2026,11 +1822,8 @@ " MPU_xEventGroupSetBits_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xEventGroupSetBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSetBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2061,11 +1854,8 @@ " MPU_xEventGroupSync_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xEventGroupSyncImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSync ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2092,11 +1882,8 @@ " MPU_uxEventGroupGetNumber_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxEventGroupGetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxEventGroupGetNumber ) : "memory" ); } @@ -2127,11 +1914,8 @@ " MPU_vEventGroupSetNumber_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vEventGroupSetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vEventGroupSetNumber ) : "memory" ); } @@ -2164,11 +1948,8 @@ " MPU_xStreamBufferSend_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2199,11 +1980,8 @@ " MPU_xStreamBufferReceive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2228,11 +2006,8 @@ " MPU_xStreamBufferIsFull_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsFullImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsFull ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2257,11 +2032,8 @@ " MPU_xStreamBufferIsEmpty_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsEmptyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsEmpty ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2286,11 +2058,8 @@ " MPU_xStreamBufferSpacesAvailable_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2315,11 +2084,8 @@ " MPU_xStreamBufferBytesAvailable_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferBytesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferBytesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2346,11 +2112,8 @@ " MPU_xStreamBufferSetTriggerLevel_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferSetTriggerLevelImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSetTriggerLevel ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2375,11 +2138,8 @@ " MPU_xStreamBufferNextMessageLengthBytes_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferNextMessageLengthBytesImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferNextMessageLengthBytes ) : "memory" ); } /*-----------------------------------------------------------*/ diff --git a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23_NTZ/portasm.c b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23_NTZ/portasm.c index ed4933812..5fde8342e 100644 --- a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23_NTZ/portasm.c +++ b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23_NTZ/portasm.c @@ -36,6 +36,9 @@ /* Portasm includes. */ #include "portasm.h" +/* System call numbers includes. */ +#include "mpu_syscall_numbers.h" + /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the * header files. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -478,7 +481,6 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att ".syntax unified \n" ".extern vPortSVCHandler_C \n" ".extern vSystemCallEnter \n" - ".extern vSystemCallEnter_1 \n" ".extern vSystemCallExit \n" " \n" "movs r0, #4 \n" @@ -493,26 +495,22 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att " b route_svc \n" " \n" "route_svc: \n" - " ldr r2, [r0, #24] \n" - " subs r2, #2 \n" - " ldrb r3, [r2, #0] \n" - " cmp r3, %0 \n" - " beq system_call_enter \n" - " cmp r3, %1 \n" - " beq system_call_enter_1 \n" - " cmp r3, %2 \n" + " ldr r3, [r0, #24] \n" + " subs r3, #2 \n" + " ldrb r2, [r3, #0] \n" + " cmp r2, %0 \n" + " blt system_call_enter \n" + " cmp r2, %1 \n" " beq system_call_exit \n" " b vPortSVCHandler_C \n" " \n" "system_call_enter: \n" " b vSystemCallEnter \n" - "system_call_enter_1: \n" - " b vSystemCallEnter_1 \n" "system_call_exit: \n" " b vSystemCallExit \n" " \n" : /* No outputs. */ - : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) + : "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "r0", "r1", "r2", "r3", "memory" ); } diff --git a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33/mpu_wrappers_v2_asm.c b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33/mpu_wrappers_v2_asm.c index d1fbdc0e5..4cb310afd 100644 --- a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33/mpu_wrappers_v2_asm.c +++ b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33/mpu_wrappers_v2_asm.c @@ -38,6 +38,8 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -67,11 +69,8 @@ " MPU_xTaskDelayUntil_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskDelayUntilImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskDelayUntil ) : "memory" ); } @@ -99,11 +98,8 @@ " MPU_xTaskAbortDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskAbortDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskAbortDelay ) : "memory" ); } @@ -131,11 +127,8 @@ " MPU_vTaskDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskDelay ) : "memory" ); } @@ -163,11 +156,8 @@ " MPU_uxTaskPriorityGet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskPriorityGetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskPriorityGet ) : "memory" ); } @@ -195,11 +185,8 @@ " MPU_eTaskGetState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_eTaskGetStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_eTaskGetState ) : "memory" ); } @@ -233,11 +220,8 @@ " MPU_vTaskGetInfo_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskGetInfoImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskGetInfo ) : "memory" ); } @@ -265,11 +249,8 @@ " MPU_xTaskGetIdleTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetIdleTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetIdleTaskHandle ) : "memory" ); } @@ -297,11 +278,8 @@ " MPU_vTaskSuspend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSuspendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSuspend ) : "memory" ); } @@ -329,11 +307,8 @@ " MPU_vTaskResume_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskResumeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskResume ) : "memory" ); } @@ -359,11 +334,8 @@ " MPU_xTaskGetTickCount_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetTickCountImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetTickCount ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -387,11 +359,8 @@ " MPU_uxTaskGetNumberOfTasks_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetNumberOfTasksImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetNumberOfTasks ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -417,11 +386,8 @@ " MPU_ulTaskGetRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimeCounter ) : "memory" ); } @@ -449,11 +415,8 @@ " MPU_ulTaskGetRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimePercent ) : "memory" ); } @@ -481,11 +444,8 @@ " MPU_ulTaskGetIdleRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimePercent ) : "memory" ); } @@ -513,11 +473,8 @@ " MPU_ulTaskGetIdleRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimeCounter ) : "memory" ); } @@ -547,11 +504,8 @@ " MPU_vTaskSetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetApplicationTaskTag ) : "memory" ); } @@ -579,11 +533,8 @@ " MPU_xTaskGetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetApplicationTaskTag ) : "memory" ); } @@ -615,11 +566,8 @@ " MPU_vTaskSetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetThreadLocalStoragePointer ) : "memory" ); } @@ -649,11 +597,8 @@ " MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTaskGetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer ) : "memory" ); } @@ -685,11 +630,8 @@ " MPU_uxTaskGetSystemState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetSystemStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetSystemState ) : "memory" ); } @@ -717,11 +659,8 @@ " MPU_uxTaskGetStackHighWaterMark_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMarkImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark ) : "memory" ); } @@ -749,11 +688,8 @@ " MPU_uxTaskGetStackHighWaterMark2_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMark2Impl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark2 ) : "memory" ); } @@ -781,11 +717,8 @@ " MPU_xTaskGetCurrentTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetCurrentTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetCurrentTaskHandle ) : "memory" ); } @@ -813,11 +746,8 @@ " MPU_xTaskGetSchedulerState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetSchedulerStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetSchedulerState ) : "memory" ); } @@ -843,11 +773,8 @@ " MPU_vTaskSetTimeOutState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetTimeOutStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetTimeOutState ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -873,28 +800,17 @@ " MPU_xTaskCheckForTimeOut_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskCheckForTimeOutImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskCheckForTimeOut ) : "memory" ); } /*-----------------------------------------------------------*/ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -911,11 +827,8 @@ " MPU_xTaskGenericNotify_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotify ) : "memory" ); } @@ -924,17 +837,9 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -951,11 +856,8 @@ " MPU_xTaskGenericNotifyWait_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyWaitImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyWait ) : "memory" ); } @@ -987,11 +889,8 @@ " MPU_ulTaskGenericNotifyTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyTake ) : "memory" ); } @@ -1021,11 +920,8 @@ " MPU_xTaskGenericNotifyStateClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyStateClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyStateClear ) : "memory" ); } @@ -1057,11 +953,8 @@ " MPU_ulTaskGenericNotifyValueClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyValueClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyValueClear ) : "memory" ); } @@ -1093,11 +986,8 @@ " MPU_xQueueGenericSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGenericSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGenericSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1121,11 +1011,8 @@ " MPU_uxQueueMessagesWaiting_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueMessagesWaitingImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueMessagesWaiting ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1149,11 +1036,8 @@ " MPU_uxQueueSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1181,11 +1065,8 @@ " MPU_xQueueReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1213,11 +1094,8 @@ " MPU_xQueuePeek_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueuePeekImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueuePeek ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1243,11 +1121,8 @@ " MPU_xQueueSemaphoreTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSemaphoreTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSemaphoreTake ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1273,11 +1148,8 @@ " MPU_xQueueGetMutexHolder_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGetMutexHolderImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGetMutexHolder ) : "memory" ); } @@ -1307,11 +1179,8 @@ " MPU_xQueueTakeMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueTakeMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueTakeMutexRecursive ) : "memory" ); } @@ -1339,11 +1208,8 @@ " MPU_xQueueGiveMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGiveMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGiveMutexRecursive ) : "memory" ); } @@ -1373,11 +1239,8 @@ " MPU_xQueueSelectFromSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSelectFromSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSelectFromSet ) : "memory" ); } @@ -1407,11 +1270,8 @@ " MPU_xQueueAddToSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueAddToSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueAddToSet ) : "memory" ); } @@ -1441,11 +1301,8 @@ " MPU_vQueueAddToRegistry_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueAddToRegistryImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueAddToRegistry ) : "memory" ); } @@ -1473,11 +1330,8 @@ " MPU_vQueueUnregisterQueue_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueUnregisterQueueImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueUnregisterQueue ) : "memory" ); } @@ -1505,11 +1359,8 @@ " MPU_pcQueueGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcQueueGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcQueueGetName ) : "memory" ); } @@ -1537,11 +1388,8 @@ " MPU_pvTimerGetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTimerGetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTimerGetTimerID ) : "memory" ); } @@ -1571,11 +1419,8 @@ " MPU_vTimerSetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetTimerID ) : "memory" ); } @@ -1603,11 +1448,8 @@ " MPU_xTimerIsTimerActive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerIsTimerActiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerIsTimerActive ) : "memory" ); } @@ -1635,11 +1477,8 @@ " MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetTimerDaemonTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle ) : "memory" ); } @@ -1648,17 +1487,9 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1675,11 +1506,8 @@ " MPU_xTimerGenericCommandFromTask_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGenericCommandFromTaskImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGenericCommandFromTask ) : "memory" ); } @@ -1707,11 +1535,8 @@ " MPU_pcTimerGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcTimerGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcTimerGetName ) : "memory" ); } @@ -1741,11 +1566,8 @@ " MPU_vTimerSetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetReloadMode ) : "memory" ); } @@ -1773,11 +1595,8 @@ " MPU_xTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetReloadMode ) : "memory" ); } @@ -1805,11 +1624,8 @@ " MPU_uxTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTimerGetReloadMode ) : "memory" ); } @@ -1837,11 +1653,8 @@ " MPU_xTimerGetPeriod_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetPeriodImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetPeriod ) : "memory" ); } @@ -1869,28 +1682,17 @@ " MPU_xTimerGetExpiryTime_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetExpiryTimeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetExpiryTime ) : "memory" ); } #endif /* if ( configUSE_TIMERS == 1 ) */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1907,11 +1709,8 @@ " MPU_xEventGroupWaitBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupWaitBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupWaitBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1937,11 +1736,8 @@ " MPU_xEventGroupClearBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupClearBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupClearBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1967,11 +1763,8 @@ " MPU_xEventGroupSetBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSetBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSetBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2001,11 +1794,8 @@ " MPU_xEventGroupSync_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSyncImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSync ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2031,11 +1821,8 @@ " MPU_uxEventGroupGetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxEventGroupGetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxEventGroupGetNumber ) : "memory" ); } @@ -2065,11 +1852,8 @@ " MPU_vEventGroupSetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vEventGroupSetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vEventGroupSetNumber ) : "memory" ); } @@ -2101,11 +1885,8 @@ " MPU_xStreamBufferSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2135,11 +1916,8 @@ " MPU_xStreamBufferReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2163,11 +1941,8 @@ " MPU_xStreamBufferIsFull_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsFullImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsFull ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2191,11 +1966,8 @@ " MPU_xStreamBufferIsEmpty_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsEmptyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsEmpty ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2219,11 +1991,8 @@ " MPU_xStreamBufferSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2247,11 +2016,8 @@ " MPU_xStreamBufferBytesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferBytesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferBytesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2277,11 +2043,8 @@ " MPU_xStreamBufferSetTriggerLevel_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSetTriggerLevelImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSetTriggerLevel ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2305,11 +2068,8 @@ " MPU_xStreamBufferNextMessageLengthBytes_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferNextMessageLengthBytesImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferNextMessageLengthBytes ) : "memory" ); } /*-----------------------------------------------------------*/ diff --git a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33/portasm.c b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33/portasm.c index ba8f6c62d..16c598ad7 100644 --- a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33/portasm.c +++ b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33/portasm.c @@ -36,6 +36,9 @@ /* Portasm includes. */ #include "portasm.h" +/* System call numbers includes. */ +#include "mpu_syscall_numbers.h" + /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the * header files. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -522,7 +525,6 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att ".syntax unified \n" ".extern vPortSVCHandler_C \n" ".extern vSystemCallEnter \n" - ".extern vSystemCallEnter_1 \n" ".extern vSystemCallExit \n" " \n" "tst lr, #4 \n" @@ -533,10 +535,8 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att "ldr r1, [r0, #24] \n" "ldrb r2, [r1, #-2] \n" "cmp r2, %0 \n" - "beq syscall_enter \n" + "blt syscall_enter \n" "cmp r2, %1 \n" - "beq syscall_enter_1 \n" - "cmp r2, %2 \n" "beq syscall_exit \n" "b vPortSVCHandler_C \n" " \n" @@ -544,16 +544,12 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att " mov r1, lr \n" " b vSystemCallEnter \n" " \n" - "syscall_enter_1: \n" - " mov r1, lr \n" - " b vSystemCallEnter_1 \n" - " \n" "syscall_exit: \n" " mov r1, lr \n" " b vSystemCallExit \n" " \n" : /* No outputs. */ - : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) + : "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "r0", "r1", "r2", "memory" ); } diff --git a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33_NTZ/mpu_wrappers_v2_asm.c b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33_NTZ/mpu_wrappers_v2_asm.c index d1fbdc0e5..4cb310afd 100644 --- a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33_NTZ/mpu_wrappers_v2_asm.c +++ b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33_NTZ/mpu_wrappers_v2_asm.c @@ -38,6 +38,8 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -67,11 +69,8 @@ " MPU_xTaskDelayUntil_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskDelayUntilImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskDelayUntil ) : "memory" ); } @@ -99,11 +98,8 @@ " MPU_xTaskAbortDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskAbortDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskAbortDelay ) : "memory" ); } @@ -131,11 +127,8 @@ " MPU_vTaskDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskDelay ) : "memory" ); } @@ -163,11 +156,8 @@ " MPU_uxTaskPriorityGet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskPriorityGetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskPriorityGet ) : "memory" ); } @@ -195,11 +185,8 @@ " MPU_eTaskGetState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_eTaskGetStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_eTaskGetState ) : "memory" ); } @@ -233,11 +220,8 @@ " MPU_vTaskGetInfo_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskGetInfoImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskGetInfo ) : "memory" ); } @@ -265,11 +249,8 @@ " MPU_xTaskGetIdleTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetIdleTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetIdleTaskHandle ) : "memory" ); } @@ -297,11 +278,8 @@ " MPU_vTaskSuspend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSuspendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSuspend ) : "memory" ); } @@ -329,11 +307,8 @@ " MPU_vTaskResume_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskResumeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskResume ) : "memory" ); } @@ -359,11 +334,8 @@ " MPU_xTaskGetTickCount_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetTickCountImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetTickCount ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -387,11 +359,8 @@ " MPU_uxTaskGetNumberOfTasks_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetNumberOfTasksImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetNumberOfTasks ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -417,11 +386,8 @@ " MPU_ulTaskGetRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimeCounter ) : "memory" ); } @@ -449,11 +415,8 @@ " MPU_ulTaskGetRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimePercent ) : "memory" ); } @@ -481,11 +444,8 @@ " MPU_ulTaskGetIdleRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimePercent ) : "memory" ); } @@ -513,11 +473,8 @@ " MPU_ulTaskGetIdleRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimeCounter ) : "memory" ); } @@ -547,11 +504,8 @@ " MPU_vTaskSetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetApplicationTaskTag ) : "memory" ); } @@ -579,11 +533,8 @@ " MPU_xTaskGetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetApplicationTaskTag ) : "memory" ); } @@ -615,11 +566,8 @@ " MPU_vTaskSetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetThreadLocalStoragePointer ) : "memory" ); } @@ -649,11 +597,8 @@ " MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTaskGetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer ) : "memory" ); } @@ -685,11 +630,8 @@ " MPU_uxTaskGetSystemState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetSystemStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetSystemState ) : "memory" ); } @@ -717,11 +659,8 @@ " MPU_uxTaskGetStackHighWaterMark_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMarkImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark ) : "memory" ); } @@ -749,11 +688,8 @@ " MPU_uxTaskGetStackHighWaterMark2_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMark2Impl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark2 ) : "memory" ); } @@ -781,11 +717,8 @@ " MPU_xTaskGetCurrentTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetCurrentTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetCurrentTaskHandle ) : "memory" ); } @@ -813,11 +746,8 @@ " MPU_xTaskGetSchedulerState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetSchedulerStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetSchedulerState ) : "memory" ); } @@ -843,11 +773,8 @@ " MPU_vTaskSetTimeOutState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetTimeOutStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetTimeOutState ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -873,28 +800,17 @@ " MPU_xTaskCheckForTimeOut_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskCheckForTimeOutImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskCheckForTimeOut ) : "memory" ); } /*-----------------------------------------------------------*/ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -911,11 +827,8 @@ " MPU_xTaskGenericNotify_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotify ) : "memory" ); } @@ -924,17 +837,9 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -951,11 +856,8 @@ " MPU_xTaskGenericNotifyWait_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyWaitImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyWait ) : "memory" ); } @@ -987,11 +889,8 @@ " MPU_ulTaskGenericNotifyTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyTake ) : "memory" ); } @@ -1021,11 +920,8 @@ " MPU_xTaskGenericNotifyStateClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyStateClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyStateClear ) : "memory" ); } @@ -1057,11 +953,8 @@ " MPU_ulTaskGenericNotifyValueClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyValueClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyValueClear ) : "memory" ); } @@ -1093,11 +986,8 @@ " MPU_xQueueGenericSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGenericSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGenericSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1121,11 +1011,8 @@ " MPU_uxQueueMessagesWaiting_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueMessagesWaitingImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueMessagesWaiting ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1149,11 +1036,8 @@ " MPU_uxQueueSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1181,11 +1065,8 @@ " MPU_xQueueReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1213,11 +1094,8 @@ " MPU_xQueuePeek_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueuePeekImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueuePeek ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1243,11 +1121,8 @@ " MPU_xQueueSemaphoreTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSemaphoreTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSemaphoreTake ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1273,11 +1148,8 @@ " MPU_xQueueGetMutexHolder_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGetMutexHolderImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGetMutexHolder ) : "memory" ); } @@ -1307,11 +1179,8 @@ " MPU_xQueueTakeMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueTakeMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueTakeMutexRecursive ) : "memory" ); } @@ -1339,11 +1208,8 @@ " MPU_xQueueGiveMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGiveMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGiveMutexRecursive ) : "memory" ); } @@ -1373,11 +1239,8 @@ " MPU_xQueueSelectFromSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSelectFromSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSelectFromSet ) : "memory" ); } @@ -1407,11 +1270,8 @@ " MPU_xQueueAddToSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueAddToSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueAddToSet ) : "memory" ); } @@ -1441,11 +1301,8 @@ " MPU_vQueueAddToRegistry_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueAddToRegistryImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueAddToRegistry ) : "memory" ); } @@ -1473,11 +1330,8 @@ " MPU_vQueueUnregisterQueue_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueUnregisterQueueImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueUnregisterQueue ) : "memory" ); } @@ -1505,11 +1359,8 @@ " MPU_pcQueueGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcQueueGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcQueueGetName ) : "memory" ); } @@ -1537,11 +1388,8 @@ " MPU_pvTimerGetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTimerGetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTimerGetTimerID ) : "memory" ); } @@ -1571,11 +1419,8 @@ " MPU_vTimerSetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetTimerID ) : "memory" ); } @@ -1603,11 +1448,8 @@ " MPU_xTimerIsTimerActive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerIsTimerActiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerIsTimerActive ) : "memory" ); } @@ -1635,11 +1477,8 @@ " MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetTimerDaemonTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle ) : "memory" ); } @@ -1648,17 +1487,9 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1675,11 +1506,8 @@ " MPU_xTimerGenericCommandFromTask_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGenericCommandFromTaskImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGenericCommandFromTask ) : "memory" ); } @@ -1707,11 +1535,8 @@ " MPU_pcTimerGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcTimerGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcTimerGetName ) : "memory" ); } @@ -1741,11 +1566,8 @@ " MPU_vTimerSetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetReloadMode ) : "memory" ); } @@ -1773,11 +1595,8 @@ " MPU_xTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetReloadMode ) : "memory" ); } @@ -1805,11 +1624,8 @@ " MPU_uxTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTimerGetReloadMode ) : "memory" ); } @@ -1837,11 +1653,8 @@ " MPU_xTimerGetPeriod_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetPeriodImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetPeriod ) : "memory" ); } @@ -1869,28 +1682,17 @@ " MPU_xTimerGetExpiryTime_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetExpiryTimeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetExpiryTime ) : "memory" ); } #endif /* if ( configUSE_TIMERS == 1 ) */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1907,11 +1709,8 @@ " MPU_xEventGroupWaitBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupWaitBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupWaitBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1937,11 +1736,8 @@ " MPU_xEventGroupClearBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupClearBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupClearBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1967,11 +1763,8 @@ " MPU_xEventGroupSetBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSetBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSetBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2001,11 +1794,8 @@ " MPU_xEventGroupSync_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSyncImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSync ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2031,11 +1821,8 @@ " MPU_uxEventGroupGetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxEventGroupGetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxEventGroupGetNumber ) : "memory" ); } @@ -2065,11 +1852,8 @@ " MPU_vEventGroupSetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vEventGroupSetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vEventGroupSetNumber ) : "memory" ); } @@ -2101,11 +1885,8 @@ " MPU_xStreamBufferSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2135,11 +1916,8 @@ " MPU_xStreamBufferReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2163,11 +1941,8 @@ " MPU_xStreamBufferIsFull_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsFullImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsFull ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2191,11 +1966,8 @@ " MPU_xStreamBufferIsEmpty_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsEmptyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsEmpty ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2219,11 +1991,8 @@ " MPU_xStreamBufferSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2247,11 +2016,8 @@ " MPU_xStreamBufferBytesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferBytesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferBytesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2277,11 +2043,8 @@ " MPU_xStreamBufferSetTriggerLevel_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSetTriggerLevelImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSetTriggerLevel ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2305,11 +2068,8 @@ " MPU_xStreamBufferNextMessageLengthBytes_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferNextMessageLengthBytesImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferNextMessageLengthBytes ) : "memory" ); } /*-----------------------------------------------------------*/ diff --git a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33_NTZ/portasm.c b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33_NTZ/portasm.c index e533dd7e9..76ba642a0 100644 --- a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33_NTZ/portasm.c +++ b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33_NTZ/portasm.c @@ -36,6 +36,9 @@ /* Portasm includes. */ #include "portasm.h" +/* System call numbers includes. */ +#include "mpu_syscall_numbers.h" + /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the * header files. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -443,7 +446,6 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att ".syntax unified \n" ".extern vPortSVCHandler_C \n" ".extern vSystemCallEnter \n" - ".extern vSystemCallEnter_1 \n" ".extern vSystemCallExit \n" " \n" "tst lr, #4 \n" @@ -454,10 +456,8 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att "ldr r1, [r0, #24] \n" "ldrb r2, [r1, #-2] \n" "cmp r2, %0 \n" - "beq syscall_enter \n" + "blt syscall_enter \n" "cmp r2, %1 \n" - "beq syscall_enter_1 \n" - "cmp r2, %2 \n" "beq syscall_exit \n" "b vPortSVCHandler_C \n" " \n" @@ -465,16 +465,12 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att " mov r1, lr \n" " b vSystemCallEnter \n" " \n" - "syscall_enter_1: \n" - " mov r1, lr \n" - " b vSystemCallEnter_1 \n" - " \n" "syscall_exit: \n" " mov r1, lr \n" " b vSystemCallExit \n" " \n" : /* No outputs. */ - : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) + : "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "r0", "r1", "r2", "memory" ); } diff --git a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23/mpu_wrappers_v2_asm.S b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23/mpu_wrappers_v2_asm.S index 5300a99ec..419df5b1e 100644 --- a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23/mpu_wrappers_v2_asm.S +++ b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23/mpu_wrappers_v2_asm.S @@ -32,15 +32,12 @@ /*-----------------------------------------------------------*/ #include "FreeRTOSConfig.h" +#include "mpu_syscall_numbers.h" #ifndef configUSE_MPU_WRAPPERS_V1 #define configUSE_MPU_WRAPPERS_V1 0 #endif -/* These must be in sync with portmacro.h. */ -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) @@ -57,10 +54,7 @@ MPU_xTaskDelayUntil: b MPU_xTaskDelayUntilImpl MPU_xTaskDelayUntil_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskDelayUntilImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskDelayUntil /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskAbortDelay @@ -75,10 +69,7 @@ MPU_xTaskAbortDelay: b MPU_xTaskAbortDelayImpl MPU_xTaskAbortDelay_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskAbortDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskAbortDelay /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskDelay @@ -93,10 +84,7 @@ MPU_vTaskDelay: b MPU_vTaskDelayImpl MPU_vTaskDelay_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskDelay /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskPriorityGet @@ -111,10 +99,7 @@ MPU_uxTaskPriorityGet: b MPU_uxTaskPriorityGetImpl MPU_uxTaskPriorityGet_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskPriorityGetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskPriorityGet /*-----------------------------------------------------------*/ PUBLIC MPU_eTaskGetState @@ -129,10 +114,7 @@ MPU_eTaskGetState: b MPU_eTaskGetStateImpl MPU_eTaskGetState_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_eTaskGetStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_eTaskGetState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskGetInfo @@ -147,10 +129,7 @@ MPU_vTaskGetInfo: b MPU_vTaskGetInfoImpl MPU_vTaskGetInfo_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskGetInfoImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskGetInfo /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetIdleTaskHandle @@ -165,10 +144,7 @@ MPU_xTaskGetIdleTaskHandle: b MPU_xTaskGetIdleTaskHandleImpl MPU_xTaskGetIdleTaskHandle_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetIdleTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetIdleTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSuspend @@ -183,10 +159,7 @@ MPU_vTaskSuspend: b MPU_vTaskSuspendImpl MPU_vTaskSuspend_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSuspendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSuspend /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskResume @@ -201,10 +174,7 @@ MPU_vTaskResume: b MPU_vTaskResumeImpl MPU_vTaskResume_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskResumeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskResume /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetTickCount @@ -219,10 +189,7 @@ MPU_xTaskGetTickCount: b MPU_xTaskGetTickCountImpl MPU_xTaskGetTickCount_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetTickCountImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetTickCount /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetNumberOfTasks @@ -237,10 +204,7 @@ MPU_uxTaskGetNumberOfTasks: b MPU_uxTaskGetNumberOfTasksImpl MPU_uxTaskGetNumberOfTasks_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetNumberOfTasksImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetNumberOfTasks /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimeCounter @@ -255,10 +219,7 @@ MPU_ulTaskGetRunTimeCounter: b MPU_ulTaskGetRunTimeCounterImpl MPU_ulTaskGetRunTimeCounter_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimePercent @@ -273,10 +234,7 @@ MPU_ulTaskGetRunTimePercent: b MPU_ulTaskGetRunTimePercentImpl MPU_ulTaskGetRunTimePercent_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimePercent @@ -291,10 +249,7 @@ MPU_ulTaskGetIdleRunTimePercent: b MPU_ulTaskGetIdleRunTimePercentImpl MPU_ulTaskGetIdleRunTimePercent_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimeCounter @@ -309,10 +264,7 @@ MPU_ulTaskGetIdleRunTimeCounter: b MPU_ulTaskGetIdleRunTimeCounterImpl MPU_ulTaskGetIdleRunTimeCounter_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetApplicationTaskTag @@ -327,10 +279,7 @@ MPU_vTaskSetApplicationTaskTag: b MPU_vTaskSetApplicationTaskTagImpl MPU_vTaskSetApplicationTaskTag_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetApplicationTaskTag @@ -345,10 +294,7 @@ MPU_xTaskGetApplicationTaskTag: b MPU_xTaskGetApplicationTaskTagImpl MPU_xTaskGetApplicationTaskTag_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetThreadLocalStoragePointer @@ -363,10 +309,7 @@ MPU_vTaskSetThreadLocalStoragePointer: b MPU_vTaskSetThreadLocalStoragePointerImpl MPU_vTaskSetThreadLocalStoragePointer_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_pvTaskGetThreadLocalStoragePointer @@ -381,10 +324,7 @@ MPU_pvTaskGetThreadLocalStoragePointer: b MPU_pvTaskGetThreadLocalStoragePointerImpl MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTaskGetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetSystemState @@ -399,10 +339,7 @@ MPU_uxTaskGetSystemState: b MPU_uxTaskGetSystemStateImpl MPU_uxTaskGetSystemState_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetSystemStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetSystemState /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark @@ -417,10 +354,7 @@ MPU_uxTaskGetStackHighWaterMark: b MPU_uxTaskGetStackHighWaterMarkImpl MPU_uxTaskGetStackHighWaterMark_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMarkImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark2 @@ -435,10 +369,7 @@ MPU_uxTaskGetStackHighWaterMark2: b MPU_uxTaskGetStackHighWaterMark2Impl MPU_uxTaskGetStackHighWaterMark2_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMark2Impl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark2 /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetCurrentTaskHandle @@ -453,10 +384,7 @@ MPU_xTaskGetCurrentTaskHandle: b MPU_xTaskGetCurrentTaskHandleImpl MPU_xTaskGetCurrentTaskHandle_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetCurrentTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetCurrentTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetSchedulerState @@ -471,10 +399,7 @@ MPU_xTaskGetSchedulerState: b MPU_xTaskGetSchedulerStateImpl MPU_xTaskGetSchedulerState_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetSchedulerStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetSchedulerState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetTimeOutState @@ -489,10 +414,7 @@ MPU_vTaskSetTimeOutState: b MPU_vTaskSetTimeOutStateImpl MPU_vTaskSetTimeOutState_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetTimeOutStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetTimeOutState /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskCheckForTimeOut @@ -507,14 +429,11 @@ MPU_xTaskCheckForTimeOut: b MPU_xTaskCheckForTimeOutImpl MPU_xTaskCheckForTimeOut_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskCheckForTimeOutImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskCheckForTimeOut /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotify -MPU_xTaskGenericNotify: + PUBLIC MPU_xTaskGenericNotifyEntry +MPU_xTaskGenericNotifyEntry: push {r0, r1} mrs r0, control movs r1, #1 @@ -525,14 +444,11 @@ MPU_xTaskGenericNotify: b MPU_xTaskGenericNotifyImpl MPU_xTaskGenericNotify_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotify /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotifyWait -MPU_xTaskGenericNotifyWait: + PUBLIC MPU_xTaskGenericNotifyWaitEntry +MPU_xTaskGenericNotifyWaitEntry: push {r0, r1} mrs r0, control movs r1, #1 @@ -543,10 +459,7 @@ MPU_xTaskGenericNotifyWait: b MPU_xTaskGenericNotifyWaitImpl MPU_xTaskGenericNotifyWait_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyWaitImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyWait /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyTake @@ -561,10 +474,7 @@ MPU_ulTaskGenericNotifyTake: b MPU_ulTaskGenericNotifyTakeImpl MPU_ulTaskGenericNotifyTake_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyTake /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGenericNotifyStateClear @@ -579,10 +489,7 @@ MPU_xTaskGenericNotifyStateClear: b MPU_xTaskGenericNotifyStateClearImpl MPU_xTaskGenericNotifyStateClear_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGenericNotifyStateClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyStateClear /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyValueClear @@ -597,10 +504,7 @@ MPU_ulTaskGenericNotifyValueClear: b MPU_ulTaskGenericNotifyValueClearImpl MPU_ulTaskGenericNotifyValueClear_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyValueClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyValueClear /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGenericSend @@ -615,10 +519,7 @@ MPU_xQueueGenericSend: b MPU_xQueueGenericSendImpl MPU_xQueueGenericSend_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGenericSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGenericSend /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueMessagesWaiting @@ -633,10 +534,7 @@ MPU_uxQueueMessagesWaiting: b MPU_uxQueueMessagesWaitingImpl MPU_uxQueueMessagesWaiting_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueMessagesWaitingImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueMessagesWaiting /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueSpacesAvailable @@ -651,10 +549,7 @@ MPU_uxQueueSpacesAvailable: b MPU_uxQueueSpacesAvailableImpl MPU_uxQueueSpacesAvailable_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueReceive @@ -669,10 +564,7 @@ MPU_xQueueReceive: b MPU_xQueueReceiveImpl MPU_xQueueReceive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueuePeek @@ -687,10 +579,7 @@ MPU_xQueuePeek: b MPU_xQueuePeekImpl MPU_xQueuePeek_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueuePeekImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueuePeek /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSemaphoreTake @@ -705,10 +594,7 @@ MPU_xQueueSemaphoreTake: b MPU_xQueueSemaphoreTakeImpl MPU_xQueueSemaphoreTake_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSemaphoreTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSemaphoreTake /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGetMutexHolder @@ -723,10 +609,7 @@ MPU_xQueueGetMutexHolder: b MPU_xQueueGetMutexHolderImpl MPU_xQueueGetMutexHolder_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGetMutexHolderImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGetMutexHolder /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueTakeMutexRecursive @@ -741,10 +624,7 @@ MPU_xQueueTakeMutexRecursive: b MPU_xQueueTakeMutexRecursiveImpl MPU_xQueueTakeMutexRecursive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueTakeMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueTakeMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGiveMutexRecursive @@ -759,10 +639,7 @@ MPU_xQueueGiveMutexRecursive: b MPU_xQueueGiveMutexRecursiveImpl MPU_xQueueGiveMutexRecursive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGiveMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGiveMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSelectFromSet @@ -777,10 +654,7 @@ MPU_xQueueSelectFromSet: b MPU_xQueueSelectFromSetImpl MPU_xQueueSelectFromSet_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSelectFromSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSelectFromSet /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueAddToSet @@ -795,10 +669,7 @@ MPU_xQueueAddToSet: b MPU_xQueueAddToSetImpl MPU_xQueueAddToSet_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueAddToSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueAddToSet /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueAddToRegistry @@ -813,10 +684,7 @@ MPU_vQueueAddToRegistry: b MPU_vQueueAddToRegistryImpl MPU_vQueueAddToRegistry_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueAddToRegistryImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueAddToRegistry /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueUnregisterQueue @@ -831,10 +699,7 @@ MPU_vQueueUnregisterQueue: b MPU_vQueueUnregisterQueueImpl MPU_vQueueUnregisterQueue_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueUnregisterQueueImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueUnregisterQueue /*-----------------------------------------------------------*/ PUBLIC MPU_pcQueueGetName @@ -849,10 +714,7 @@ MPU_pcQueueGetName: b MPU_pcQueueGetNameImpl MPU_pcQueueGetName_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcQueueGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcQueueGetName /*-----------------------------------------------------------*/ PUBLIC MPU_pvTimerGetTimerID @@ -867,10 +729,7 @@ MPU_pvTimerGetTimerID: b MPU_pvTimerGetTimerIDImpl MPU_pvTimerGetTimerID_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTimerGetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTimerGetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetTimerID @@ -885,10 +744,7 @@ MPU_vTimerSetTimerID: b MPU_vTimerSetTimerIDImpl MPU_vTimerSetTimerID_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerIsTimerActive @@ -903,10 +759,7 @@ MPU_xTimerIsTimerActive: b MPU_xTimerIsTimerActiveImpl MPU_xTimerIsTimerActive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerIsTimerActiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerIsTimerActive /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetTimerDaemonTaskHandle @@ -921,14 +774,11 @@ MPU_xTimerGetTimerDaemonTaskHandle: b MPU_xTimerGetTimerDaemonTaskHandleImpl MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetTimerDaemonTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle /*-----------------------------------------------------------*/ - PUBLIC MPU_xTimerGenericCommandFromTask -MPU_xTimerGenericCommandFromTask: + PUBLIC MPU_xTimerGenericCommandFromTaskEntry +MPU_xTimerGenericCommandFromTaskEntry: push {r0, r1} mrs r0, control movs r1, #1 @@ -939,10 +789,7 @@ MPU_xTimerGenericCommandFromTask: b MPU_xTimerGenericCommandFromTaskImpl MPU_xTimerGenericCommandFromTask_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTimerGenericCommandFromTaskImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGenericCommandFromTask /*-----------------------------------------------------------*/ PUBLIC MPU_pcTimerGetName @@ -957,10 +804,7 @@ MPU_pcTimerGetName: b MPU_pcTimerGetNameImpl MPU_pcTimerGetName_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcTimerGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcTimerGetName /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetReloadMode @@ -975,10 +819,7 @@ MPU_vTimerSetReloadMode: b MPU_vTimerSetReloadModeImpl MPU_vTimerSetReloadMode_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetReloadMode @@ -993,10 +834,7 @@ MPU_xTimerGetReloadMode: b MPU_xTimerGetReloadModeImpl MPU_xTimerGetReloadMode_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_uxTimerGetReloadMode @@ -1011,10 +849,7 @@ MPU_uxTimerGetReloadMode: b MPU_uxTimerGetReloadModeImpl MPU_uxTimerGetReloadMode_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetPeriod @@ -1029,10 +864,7 @@ MPU_xTimerGetPeriod: b MPU_xTimerGetPeriodImpl MPU_xTimerGetPeriod_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetPeriodImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetPeriod /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetExpiryTime @@ -1047,14 +879,11 @@ MPU_xTimerGetExpiryTime: b MPU_xTimerGetExpiryTimeImpl MPU_xTimerGetExpiryTime_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetExpiryTimeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetExpiryTime /*-----------------------------------------------------------*/ - PUBLIC MPU_xEventGroupWaitBits -MPU_xEventGroupWaitBits: + PUBLIC MPU_xEventGroupWaitBitsEntry +MPU_xEventGroupWaitBitsEntry: push {r0, r1} mrs r0, control movs r1, #1 @@ -1065,10 +894,7 @@ MPU_xEventGroupWaitBits: b MPU_xEventGroupWaitBitsImpl MPU_xEventGroupWaitBits_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xEventGroupWaitBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupWaitBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupClearBits @@ -1083,10 +909,7 @@ MPU_xEventGroupClearBits: b MPU_xEventGroupClearBitsImpl MPU_xEventGroupClearBits_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupClearBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupClearBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSetBits @@ -1101,10 +924,7 @@ MPU_xEventGroupSetBits: b MPU_xEventGroupSetBitsImpl MPU_xEventGroupSetBits_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSetBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSetBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSync @@ -1119,10 +939,7 @@ MPU_xEventGroupSync: b MPU_xEventGroupSyncImpl MPU_xEventGroupSync_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSyncImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSync /*-----------------------------------------------------------*/ PUBLIC MPU_uxEventGroupGetNumber @@ -1137,10 +954,7 @@ MPU_uxEventGroupGetNumber: b MPU_uxEventGroupGetNumberImpl MPU_uxEventGroupGetNumber_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxEventGroupGetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxEventGroupGetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_vEventGroupSetNumber @@ -1155,10 +969,7 @@ MPU_vEventGroupSetNumber: b MPU_vEventGroupSetNumberImpl MPU_vEventGroupSetNumber_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vEventGroupSetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vEventGroupSetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSend @@ -1173,10 +984,7 @@ MPU_xStreamBufferSend: b MPU_xStreamBufferSendImpl MPU_xStreamBufferSend_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSend /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferReceive @@ -1191,10 +999,7 @@ MPU_xStreamBufferReceive: b MPU_xStreamBufferReceiveImpl MPU_xStreamBufferReceive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsFull @@ -1209,10 +1014,7 @@ MPU_xStreamBufferIsFull: b MPU_xStreamBufferIsFullImpl MPU_xStreamBufferIsFull_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsFullImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsFull /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsEmpty @@ -1227,10 +1029,7 @@ MPU_xStreamBufferIsEmpty: b MPU_xStreamBufferIsEmptyImpl MPU_xStreamBufferIsEmpty_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsEmptyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsEmpty /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSpacesAvailable @@ -1245,10 +1044,7 @@ MPU_xStreamBufferSpacesAvailable: b MPU_xStreamBufferSpacesAvailableImpl MPU_xStreamBufferSpacesAvailable_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferBytesAvailable @@ -1263,10 +1059,7 @@ MPU_xStreamBufferBytesAvailable: b MPU_xStreamBufferBytesAvailableImpl MPU_xStreamBufferBytesAvailable_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferBytesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferBytesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSetTriggerLevel @@ -1281,10 +1074,7 @@ MPU_xStreamBufferSetTriggerLevel: b MPU_xStreamBufferSetTriggerLevelImpl MPU_xStreamBufferSetTriggerLevel_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSetTriggerLevelImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSetTriggerLevel /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferNextMessageLengthBytes @@ -1299,10 +1089,7 @@ MPU_xStreamBufferNextMessageLengthBytes: b MPU_xStreamBufferNextMessageLengthBytesImpl MPU_xStreamBufferNextMessageLengthBytes_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferNextMessageLengthBytesImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferNextMessageLengthBytes /*-----------------------------------------------------------*/ /* Default weak implementations in case one is not available from diff --git a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23/portasm.s b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23/portasm.s index 8c7000909..06c761090 100644 --- a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23/portasm.s +++ b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23/portasm.s @@ -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 @@ -46,7 +49,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 @@ -96,7 +98,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. */ /*-----------------------------------------------------------*/ @@ -229,7 +231,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: @@ -479,21 +481,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 @@ -520,7 +518,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. */ /*-----------------------------------------------------------*/ diff --git a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23_NTZ/mpu_wrappers_v2_asm.S b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23_NTZ/mpu_wrappers_v2_asm.S index 5300a99ec..419df5b1e 100644 --- a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23_NTZ/mpu_wrappers_v2_asm.S +++ b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23_NTZ/mpu_wrappers_v2_asm.S @@ -32,15 +32,12 @@ /*-----------------------------------------------------------*/ #include "FreeRTOSConfig.h" +#include "mpu_syscall_numbers.h" #ifndef configUSE_MPU_WRAPPERS_V1 #define configUSE_MPU_WRAPPERS_V1 0 #endif -/* These must be in sync with portmacro.h. */ -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) @@ -57,10 +54,7 @@ MPU_xTaskDelayUntil: b MPU_xTaskDelayUntilImpl MPU_xTaskDelayUntil_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskDelayUntilImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskDelayUntil /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskAbortDelay @@ -75,10 +69,7 @@ MPU_xTaskAbortDelay: b MPU_xTaskAbortDelayImpl MPU_xTaskAbortDelay_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskAbortDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskAbortDelay /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskDelay @@ -93,10 +84,7 @@ MPU_vTaskDelay: b MPU_vTaskDelayImpl MPU_vTaskDelay_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskDelay /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskPriorityGet @@ -111,10 +99,7 @@ MPU_uxTaskPriorityGet: b MPU_uxTaskPriorityGetImpl MPU_uxTaskPriorityGet_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskPriorityGetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskPriorityGet /*-----------------------------------------------------------*/ PUBLIC MPU_eTaskGetState @@ -129,10 +114,7 @@ MPU_eTaskGetState: b MPU_eTaskGetStateImpl MPU_eTaskGetState_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_eTaskGetStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_eTaskGetState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskGetInfo @@ -147,10 +129,7 @@ MPU_vTaskGetInfo: b MPU_vTaskGetInfoImpl MPU_vTaskGetInfo_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskGetInfoImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskGetInfo /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetIdleTaskHandle @@ -165,10 +144,7 @@ MPU_xTaskGetIdleTaskHandle: b MPU_xTaskGetIdleTaskHandleImpl MPU_xTaskGetIdleTaskHandle_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetIdleTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetIdleTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSuspend @@ -183,10 +159,7 @@ MPU_vTaskSuspend: b MPU_vTaskSuspendImpl MPU_vTaskSuspend_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSuspendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSuspend /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskResume @@ -201,10 +174,7 @@ MPU_vTaskResume: b MPU_vTaskResumeImpl MPU_vTaskResume_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskResumeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskResume /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetTickCount @@ -219,10 +189,7 @@ MPU_xTaskGetTickCount: b MPU_xTaskGetTickCountImpl MPU_xTaskGetTickCount_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetTickCountImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetTickCount /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetNumberOfTasks @@ -237,10 +204,7 @@ MPU_uxTaskGetNumberOfTasks: b MPU_uxTaskGetNumberOfTasksImpl MPU_uxTaskGetNumberOfTasks_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetNumberOfTasksImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetNumberOfTasks /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimeCounter @@ -255,10 +219,7 @@ MPU_ulTaskGetRunTimeCounter: b MPU_ulTaskGetRunTimeCounterImpl MPU_ulTaskGetRunTimeCounter_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimePercent @@ -273,10 +234,7 @@ MPU_ulTaskGetRunTimePercent: b MPU_ulTaskGetRunTimePercentImpl MPU_ulTaskGetRunTimePercent_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimePercent @@ -291,10 +249,7 @@ MPU_ulTaskGetIdleRunTimePercent: b MPU_ulTaskGetIdleRunTimePercentImpl MPU_ulTaskGetIdleRunTimePercent_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimeCounter @@ -309,10 +264,7 @@ MPU_ulTaskGetIdleRunTimeCounter: b MPU_ulTaskGetIdleRunTimeCounterImpl MPU_ulTaskGetIdleRunTimeCounter_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetApplicationTaskTag @@ -327,10 +279,7 @@ MPU_vTaskSetApplicationTaskTag: b MPU_vTaskSetApplicationTaskTagImpl MPU_vTaskSetApplicationTaskTag_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetApplicationTaskTag @@ -345,10 +294,7 @@ MPU_xTaskGetApplicationTaskTag: b MPU_xTaskGetApplicationTaskTagImpl MPU_xTaskGetApplicationTaskTag_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetThreadLocalStoragePointer @@ -363,10 +309,7 @@ MPU_vTaskSetThreadLocalStoragePointer: b MPU_vTaskSetThreadLocalStoragePointerImpl MPU_vTaskSetThreadLocalStoragePointer_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_pvTaskGetThreadLocalStoragePointer @@ -381,10 +324,7 @@ MPU_pvTaskGetThreadLocalStoragePointer: b MPU_pvTaskGetThreadLocalStoragePointerImpl MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTaskGetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetSystemState @@ -399,10 +339,7 @@ MPU_uxTaskGetSystemState: b MPU_uxTaskGetSystemStateImpl MPU_uxTaskGetSystemState_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetSystemStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetSystemState /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark @@ -417,10 +354,7 @@ MPU_uxTaskGetStackHighWaterMark: b MPU_uxTaskGetStackHighWaterMarkImpl MPU_uxTaskGetStackHighWaterMark_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMarkImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark2 @@ -435,10 +369,7 @@ MPU_uxTaskGetStackHighWaterMark2: b MPU_uxTaskGetStackHighWaterMark2Impl MPU_uxTaskGetStackHighWaterMark2_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMark2Impl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark2 /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetCurrentTaskHandle @@ -453,10 +384,7 @@ MPU_xTaskGetCurrentTaskHandle: b MPU_xTaskGetCurrentTaskHandleImpl MPU_xTaskGetCurrentTaskHandle_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetCurrentTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetCurrentTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetSchedulerState @@ -471,10 +399,7 @@ MPU_xTaskGetSchedulerState: b MPU_xTaskGetSchedulerStateImpl MPU_xTaskGetSchedulerState_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetSchedulerStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetSchedulerState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetTimeOutState @@ -489,10 +414,7 @@ MPU_vTaskSetTimeOutState: b MPU_vTaskSetTimeOutStateImpl MPU_vTaskSetTimeOutState_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetTimeOutStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetTimeOutState /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskCheckForTimeOut @@ -507,14 +429,11 @@ MPU_xTaskCheckForTimeOut: b MPU_xTaskCheckForTimeOutImpl MPU_xTaskCheckForTimeOut_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskCheckForTimeOutImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskCheckForTimeOut /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotify -MPU_xTaskGenericNotify: + PUBLIC MPU_xTaskGenericNotifyEntry +MPU_xTaskGenericNotifyEntry: push {r0, r1} mrs r0, control movs r1, #1 @@ -525,14 +444,11 @@ MPU_xTaskGenericNotify: b MPU_xTaskGenericNotifyImpl MPU_xTaskGenericNotify_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotify /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotifyWait -MPU_xTaskGenericNotifyWait: + PUBLIC MPU_xTaskGenericNotifyWaitEntry +MPU_xTaskGenericNotifyWaitEntry: push {r0, r1} mrs r0, control movs r1, #1 @@ -543,10 +459,7 @@ MPU_xTaskGenericNotifyWait: b MPU_xTaskGenericNotifyWaitImpl MPU_xTaskGenericNotifyWait_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyWaitImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyWait /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyTake @@ -561,10 +474,7 @@ MPU_ulTaskGenericNotifyTake: b MPU_ulTaskGenericNotifyTakeImpl MPU_ulTaskGenericNotifyTake_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyTake /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGenericNotifyStateClear @@ -579,10 +489,7 @@ MPU_xTaskGenericNotifyStateClear: b MPU_xTaskGenericNotifyStateClearImpl MPU_xTaskGenericNotifyStateClear_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGenericNotifyStateClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyStateClear /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyValueClear @@ -597,10 +504,7 @@ MPU_ulTaskGenericNotifyValueClear: b MPU_ulTaskGenericNotifyValueClearImpl MPU_ulTaskGenericNotifyValueClear_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyValueClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyValueClear /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGenericSend @@ -615,10 +519,7 @@ MPU_xQueueGenericSend: b MPU_xQueueGenericSendImpl MPU_xQueueGenericSend_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGenericSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGenericSend /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueMessagesWaiting @@ -633,10 +534,7 @@ MPU_uxQueueMessagesWaiting: b MPU_uxQueueMessagesWaitingImpl MPU_uxQueueMessagesWaiting_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueMessagesWaitingImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueMessagesWaiting /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueSpacesAvailable @@ -651,10 +549,7 @@ MPU_uxQueueSpacesAvailable: b MPU_uxQueueSpacesAvailableImpl MPU_uxQueueSpacesAvailable_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueReceive @@ -669,10 +564,7 @@ MPU_xQueueReceive: b MPU_xQueueReceiveImpl MPU_xQueueReceive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueuePeek @@ -687,10 +579,7 @@ MPU_xQueuePeek: b MPU_xQueuePeekImpl MPU_xQueuePeek_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueuePeekImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueuePeek /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSemaphoreTake @@ -705,10 +594,7 @@ MPU_xQueueSemaphoreTake: b MPU_xQueueSemaphoreTakeImpl MPU_xQueueSemaphoreTake_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSemaphoreTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSemaphoreTake /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGetMutexHolder @@ -723,10 +609,7 @@ MPU_xQueueGetMutexHolder: b MPU_xQueueGetMutexHolderImpl MPU_xQueueGetMutexHolder_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGetMutexHolderImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGetMutexHolder /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueTakeMutexRecursive @@ -741,10 +624,7 @@ MPU_xQueueTakeMutexRecursive: b MPU_xQueueTakeMutexRecursiveImpl MPU_xQueueTakeMutexRecursive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueTakeMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueTakeMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGiveMutexRecursive @@ -759,10 +639,7 @@ MPU_xQueueGiveMutexRecursive: b MPU_xQueueGiveMutexRecursiveImpl MPU_xQueueGiveMutexRecursive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGiveMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGiveMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSelectFromSet @@ -777,10 +654,7 @@ MPU_xQueueSelectFromSet: b MPU_xQueueSelectFromSetImpl MPU_xQueueSelectFromSet_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSelectFromSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSelectFromSet /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueAddToSet @@ -795,10 +669,7 @@ MPU_xQueueAddToSet: b MPU_xQueueAddToSetImpl MPU_xQueueAddToSet_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueAddToSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueAddToSet /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueAddToRegistry @@ -813,10 +684,7 @@ MPU_vQueueAddToRegistry: b MPU_vQueueAddToRegistryImpl MPU_vQueueAddToRegistry_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueAddToRegistryImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueAddToRegistry /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueUnregisterQueue @@ -831,10 +699,7 @@ MPU_vQueueUnregisterQueue: b MPU_vQueueUnregisterQueueImpl MPU_vQueueUnregisterQueue_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueUnregisterQueueImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueUnregisterQueue /*-----------------------------------------------------------*/ PUBLIC MPU_pcQueueGetName @@ -849,10 +714,7 @@ MPU_pcQueueGetName: b MPU_pcQueueGetNameImpl MPU_pcQueueGetName_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcQueueGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcQueueGetName /*-----------------------------------------------------------*/ PUBLIC MPU_pvTimerGetTimerID @@ -867,10 +729,7 @@ MPU_pvTimerGetTimerID: b MPU_pvTimerGetTimerIDImpl MPU_pvTimerGetTimerID_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTimerGetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTimerGetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetTimerID @@ -885,10 +744,7 @@ MPU_vTimerSetTimerID: b MPU_vTimerSetTimerIDImpl MPU_vTimerSetTimerID_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerIsTimerActive @@ -903,10 +759,7 @@ MPU_xTimerIsTimerActive: b MPU_xTimerIsTimerActiveImpl MPU_xTimerIsTimerActive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerIsTimerActiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerIsTimerActive /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetTimerDaemonTaskHandle @@ -921,14 +774,11 @@ MPU_xTimerGetTimerDaemonTaskHandle: b MPU_xTimerGetTimerDaemonTaskHandleImpl MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetTimerDaemonTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle /*-----------------------------------------------------------*/ - PUBLIC MPU_xTimerGenericCommandFromTask -MPU_xTimerGenericCommandFromTask: + PUBLIC MPU_xTimerGenericCommandFromTaskEntry +MPU_xTimerGenericCommandFromTaskEntry: push {r0, r1} mrs r0, control movs r1, #1 @@ -939,10 +789,7 @@ MPU_xTimerGenericCommandFromTask: b MPU_xTimerGenericCommandFromTaskImpl MPU_xTimerGenericCommandFromTask_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTimerGenericCommandFromTaskImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGenericCommandFromTask /*-----------------------------------------------------------*/ PUBLIC MPU_pcTimerGetName @@ -957,10 +804,7 @@ MPU_pcTimerGetName: b MPU_pcTimerGetNameImpl MPU_pcTimerGetName_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcTimerGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcTimerGetName /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetReloadMode @@ -975,10 +819,7 @@ MPU_vTimerSetReloadMode: b MPU_vTimerSetReloadModeImpl MPU_vTimerSetReloadMode_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetReloadMode @@ -993,10 +834,7 @@ MPU_xTimerGetReloadMode: b MPU_xTimerGetReloadModeImpl MPU_xTimerGetReloadMode_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_uxTimerGetReloadMode @@ -1011,10 +849,7 @@ MPU_uxTimerGetReloadMode: b MPU_uxTimerGetReloadModeImpl MPU_uxTimerGetReloadMode_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetPeriod @@ -1029,10 +864,7 @@ MPU_xTimerGetPeriod: b MPU_xTimerGetPeriodImpl MPU_xTimerGetPeriod_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetPeriodImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetPeriod /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetExpiryTime @@ -1047,14 +879,11 @@ MPU_xTimerGetExpiryTime: b MPU_xTimerGetExpiryTimeImpl MPU_xTimerGetExpiryTime_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetExpiryTimeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetExpiryTime /*-----------------------------------------------------------*/ - PUBLIC MPU_xEventGroupWaitBits -MPU_xEventGroupWaitBits: + PUBLIC MPU_xEventGroupWaitBitsEntry +MPU_xEventGroupWaitBitsEntry: push {r0, r1} mrs r0, control movs r1, #1 @@ -1065,10 +894,7 @@ MPU_xEventGroupWaitBits: b MPU_xEventGroupWaitBitsImpl MPU_xEventGroupWaitBits_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xEventGroupWaitBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupWaitBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupClearBits @@ -1083,10 +909,7 @@ MPU_xEventGroupClearBits: b MPU_xEventGroupClearBitsImpl MPU_xEventGroupClearBits_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupClearBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupClearBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSetBits @@ -1101,10 +924,7 @@ MPU_xEventGroupSetBits: b MPU_xEventGroupSetBitsImpl MPU_xEventGroupSetBits_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSetBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSetBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSync @@ -1119,10 +939,7 @@ MPU_xEventGroupSync: b MPU_xEventGroupSyncImpl MPU_xEventGroupSync_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSyncImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSync /*-----------------------------------------------------------*/ PUBLIC MPU_uxEventGroupGetNumber @@ -1137,10 +954,7 @@ MPU_uxEventGroupGetNumber: b MPU_uxEventGroupGetNumberImpl MPU_uxEventGroupGetNumber_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxEventGroupGetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxEventGroupGetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_vEventGroupSetNumber @@ -1155,10 +969,7 @@ MPU_vEventGroupSetNumber: b MPU_vEventGroupSetNumberImpl MPU_vEventGroupSetNumber_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vEventGroupSetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vEventGroupSetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSend @@ -1173,10 +984,7 @@ MPU_xStreamBufferSend: b MPU_xStreamBufferSendImpl MPU_xStreamBufferSend_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSend /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferReceive @@ -1191,10 +999,7 @@ MPU_xStreamBufferReceive: b MPU_xStreamBufferReceiveImpl MPU_xStreamBufferReceive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsFull @@ -1209,10 +1014,7 @@ MPU_xStreamBufferIsFull: b MPU_xStreamBufferIsFullImpl MPU_xStreamBufferIsFull_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsFullImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsFull /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsEmpty @@ -1227,10 +1029,7 @@ MPU_xStreamBufferIsEmpty: b MPU_xStreamBufferIsEmptyImpl MPU_xStreamBufferIsEmpty_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsEmptyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsEmpty /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSpacesAvailable @@ -1245,10 +1044,7 @@ MPU_xStreamBufferSpacesAvailable: b MPU_xStreamBufferSpacesAvailableImpl MPU_xStreamBufferSpacesAvailable_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferBytesAvailable @@ -1263,10 +1059,7 @@ MPU_xStreamBufferBytesAvailable: b MPU_xStreamBufferBytesAvailableImpl MPU_xStreamBufferBytesAvailable_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferBytesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferBytesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSetTriggerLevel @@ -1281,10 +1074,7 @@ MPU_xStreamBufferSetTriggerLevel: b MPU_xStreamBufferSetTriggerLevelImpl MPU_xStreamBufferSetTriggerLevel_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSetTriggerLevelImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSetTriggerLevel /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferNextMessageLengthBytes @@ -1299,10 +1089,7 @@ MPU_xStreamBufferNextMessageLengthBytes: b MPU_xStreamBufferNextMessageLengthBytesImpl MPU_xStreamBufferNextMessageLengthBytes_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferNextMessageLengthBytesImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferNextMessageLengthBytes /*-----------------------------------------------------------*/ /* Default weak implementations in case one is not available from diff --git a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23_NTZ/portasm.s b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23_NTZ/portasm.s index 836a927c8..d4487dfac 100644 --- a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23_NTZ/portasm.s +++ b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23_NTZ/portasm.s @@ -32,6 +32,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 vPortSVCHandler_C #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) EXTERN vSystemCallEnter - EXTERN vSystemCallEnter_1 EXTERN vSystemCallExit #endif @@ -224,7 +226,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. */ nop /*-----------------------------------------------------------*/ @@ -421,21 +423,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 diff --git a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33/mpu_wrappers_v2_asm.S b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33/mpu_wrappers_v2_asm.S index 1005dad33..80d5a1c63 100644 --- a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33/mpu_wrappers_v2_asm.S +++ b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33/mpu_wrappers_v2_asm.S @@ -32,15 +32,12 @@ /*-----------------------------------------------------------*/ #include "FreeRTOSConfig.h" +#include "mpu_syscall_numbers.h" #ifndef configUSE_MPU_WRAPPERS_V1 #define configUSE_MPU_WRAPPERS_V1 0 #endif -/* These must be in sync with portmacro.h. */ -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) @@ -56,10 +53,7 @@ MPU_xTaskDelayUntil: b MPU_xTaskDelayUntilImpl MPU_xTaskDelayUntil_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskDelayUntilImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskDelayUntil /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskAbortDelay @@ -73,10 +67,7 @@ MPU_xTaskAbortDelay: b MPU_xTaskAbortDelayImpl MPU_xTaskAbortDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskAbortDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskAbortDelay /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskDelay @@ -90,10 +81,7 @@ MPU_vTaskDelay: b MPU_vTaskDelayImpl MPU_vTaskDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskDelay /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskPriorityGet @@ -107,10 +95,7 @@ MPU_uxTaskPriorityGet: b MPU_uxTaskPriorityGetImpl MPU_uxTaskPriorityGet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskPriorityGetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskPriorityGet /*-----------------------------------------------------------*/ PUBLIC MPU_eTaskGetState @@ -124,10 +109,7 @@ MPU_eTaskGetState: b MPU_eTaskGetStateImpl MPU_eTaskGetState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_eTaskGetStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_eTaskGetState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskGetInfo @@ -141,10 +123,7 @@ MPU_vTaskGetInfo: b MPU_vTaskGetInfoImpl MPU_vTaskGetInfo_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskGetInfoImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskGetInfo /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetIdleTaskHandle @@ -158,10 +137,7 @@ MPU_xTaskGetIdleTaskHandle: b MPU_xTaskGetIdleTaskHandleImpl MPU_xTaskGetIdleTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetIdleTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetIdleTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSuspend @@ -175,10 +151,7 @@ MPU_vTaskSuspend: b MPU_vTaskSuspendImpl MPU_vTaskSuspend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSuspendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSuspend /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskResume @@ -192,10 +165,7 @@ MPU_vTaskResume: b MPU_vTaskResumeImpl MPU_vTaskResume_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskResumeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskResume /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetTickCount @@ -209,10 +179,7 @@ MPU_xTaskGetTickCount: b MPU_xTaskGetTickCountImpl MPU_xTaskGetTickCount_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetTickCountImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetTickCount /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetNumberOfTasks @@ -226,10 +193,7 @@ MPU_uxTaskGetNumberOfTasks: b MPU_uxTaskGetNumberOfTasksImpl MPU_uxTaskGetNumberOfTasks_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetNumberOfTasksImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetNumberOfTasks /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimeCounter @@ -243,10 +207,7 @@ MPU_ulTaskGetRunTimeCounter: b MPU_ulTaskGetRunTimeCounterImpl MPU_ulTaskGetRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimePercent @@ -260,10 +221,7 @@ MPU_ulTaskGetRunTimePercent: b MPU_ulTaskGetRunTimePercentImpl MPU_ulTaskGetRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimePercent @@ -277,10 +235,7 @@ MPU_ulTaskGetIdleRunTimePercent: b MPU_ulTaskGetIdleRunTimePercentImpl MPU_ulTaskGetIdleRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimeCounter @@ -294,10 +249,7 @@ MPU_ulTaskGetIdleRunTimeCounter: b MPU_ulTaskGetIdleRunTimeCounterImpl MPU_ulTaskGetIdleRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetApplicationTaskTag @@ -311,10 +263,7 @@ MPU_vTaskSetApplicationTaskTag: b MPU_vTaskSetApplicationTaskTagImpl MPU_vTaskSetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetApplicationTaskTag @@ -328,10 +277,7 @@ MPU_xTaskGetApplicationTaskTag: b MPU_xTaskGetApplicationTaskTagImpl MPU_xTaskGetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetThreadLocalStoragePointer @@ -345,10 +291,7 @@ MPU_vTaskSetThreadLocalStoragePointer: b MPU_vTaskSetThreadLocalStoragePointerImpl MPU_vTaskSetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_pvTaskGetThreadLocalStoragePointer @@ -362,10 +305,7 @@ MPU_pvTaskGetThreadLocalStoragePointer: b MPU_pvTaskGetThreadLocalStoragePointerImpl MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTaskGetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetSystemState @@ -379,10 +319,7 @@ MPU_uxTaskGetSystemState: b MPU_uxTaskGetSystemStateImpl MPU_uxTaskGetSystemState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetSystemStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetSystemState /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark @@ -396,10 +333,7 @@ MPU_uxTaskGetStackHighWaterMark: b MPU_uxTaskGetStackHighWaterMarkImpl MPU_uxTaskGetStackHighWaterMark_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMarkImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark2 @@ -413,10 +347,7 @@ MPU_uxTaskGetStackHighWaterMark2: b MPU_uxTaskGetStackHighWaterMark2Impl MPU_uxTaskGetStackHighWaterMark2_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMark2Impl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark2 /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetCurrentTaskHandle @@ -430,10 +361,7 @@ MPU_xTaskGetCurrentTaskHandle: b MPU_xTaskGetCurrentTaskHandleImpl MPU_xTaskGetCurrentTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetCurrentTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetCurrentTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetSchedulerState @@ -447,10 +375,7 @@ MPU_xTaskGetSchedulerState: b MPU_xTaskGetSchedulerStateImpl MPU_xTaskGetSchedulerState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetSchedulerStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetSchedulerState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetTimeOutState @@ -464,10 +389,7 @@ MPU_vTaskSetTimeOutState: b MPU_vTaskSetTimeOutStateImpl MPU_vTaskSetTimeOutState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetTimeOutStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetTimeOutState /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskCheckForTimeOut @@ -481,14 +403,11 @@ MPU_xTaskCheckForTimeOut: b MPU_xTaskCheckForTimeOutImpl MPU_xTaskCheckForTimeOut_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskCheckForTimeOutImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskCheckForTimeOut /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotify -MPU_xTaskGenericNotify: + PUBLIC MPU_xTaskGenericNotifyEntry +MPU_xTaskGenericNotifyEntry: push {r0} mrs r0, control tst r0, #1 @@ -498,14 +417,11 @@ MPU_xTaskGenericNotify: b MPU_xTaskGenericNotifyImpl MPU_xTaskGenericNotify_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotify /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotifyWait -MPU_xTaskGenericNotifyWait: + PUBLIC MPU_xTaskGenericNotifyWaitEntry +MPU_xTaskGenericNotifyWaitEntry: push {r0} mrs r0, control tst r0, #1 @@ -515,10 +431,7 @@ MPU_xTaskGenericNotifyWait: b MPU_xTaskGenericNotifyWaitImpl MPU_xTaskGenericNotifyWait_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyWaitImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyWait /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyTake @@ -532,10 +445,7 @@ MPU_ulTaskGenericNotifyTake: b MPU_ulTaskGenericNotifyTakeImpl MPU_ulTaskGenericNotifyTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyTake /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGenericNotifyStateClear @@ -549,10 +459,7 @@ MPU_xTaskGenericNotifyStateClear: b MPU_xTaskGenericNotifyStateClearImpl MPU_xTaskGenericNotifyStateClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGenericNotifyStateClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyStateClear /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyValueClear @@ -566,10 +473,7 @@ MPU_ulTaskGenericNotifyValueClear: b MPU_ulTaskGenericNotifyValueClearImpl MPU_ulTaskGenericNotifyValueClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyValueClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyValueClear /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGenericSend @@ -583,10 +487,7 @@ MPU_xQueueGenericSend: b MPU_xQueueGenericSendImpl MPU_xQueueGenericSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGenericSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGenericSend /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueMessagesWaiting @@ -600,10 +501,7 @@ MPU_uxQueueMessagesWaiting: b MPU_uxQueueMessagesWaitingImpl MPU_uxQueueMessagesWaiting_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueMessagesWaitingImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueMessagesWaiting /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueSpacesAvailable @@ -617,10 +515,7 @@ MPU_uxQueueSpacesAvailable: b MPU_uxQueueSpacesAvailableImpl MPU_uxQueueSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueReceive @@ -634,10 +529,7 @@ MPU_xQueueReceive: b MPU_xQueueReceiveImpl MPU_xQueueReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueuePeek @@ -651,10 +543,7 @@ MPU_xQueuePeek: b MPU_xQueuePeekImpl MPU_xQueuePeek_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueuePeekImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueuePeek /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSemaphoreTake @@ -668,10 +557,7 @@ MPU_xQueueSemaphoreTake: b MPU_xQueueSemaphoreTakeImpl MPU_xQueueSemaphoreTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSemaphoreTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSemaphoreTake /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGetMutexHolder @@ -685,10 +571,7 @@ MPU_xQueueGetMutexHolder: b MPU_xQueueGetMutexHolderImpl MPU_xQueueGetMutexHolder_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGetMutexHolderImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGetMutexHolder /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueTakeMutexRecursive @@ -702,10 +585,7 @@ MPU_xQueueTakeMutexRecursive: b MPU_xQueueTakeMutexRecursiveImpl MPU_xQueueTakeMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueTakeMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueTakeMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGiveMutexRecursive @@ -719,10 +599,7 @@ MPU_xQueueGiveMutexRecursive: b MPU_xQueueGiveMutexRecursiveImpl MPU_xQueueGiveMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGiveMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGiveMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSelectFromSet @@ -736,10 +613,7 @@ MPU_xQueueSelectFromSet: b MPU_xQueueSelectFromSetImpl MPU_xQueueSelectFromSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSelectFromSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSelectFromSet /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueAddToSet @@ -753,10 +627,7 @@ MPU_xQueueAddToSet: b MPU_xQueueAddToSetImpl MPU_xQueueAddToSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueAddToSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueAddToSet /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueAddToRegistry @@ -770,10 +641,7 @@ MPU_vQueueAddToRegistry: b MPU_vQueueAddToRegistryImpl MPU_vQueueAddToRegistry_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueAddToRegistryImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueAddToRegistry /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueUnregisterQueue @@ -787,10 +655,7 @@ MPU_vQueueUnregisterQueue: b MPU_vQueueUnregisterQueueImpl MPU_vQueueUnregisterQueue_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueUnregisterQueueImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueUnregisterQueue /*-----------------------------------------------------------*/ PUBLIC MPU_pcQueueGetName @@ -804,10 +669,7 @@ MPU_pcQueueGetName: b MPU_pcQueueGetNameImpl MPU_pcQueueGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcQueueGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcQueueGetName /*-----------------------------------------------------------*/ PUBLIC MPU_pvTimerGetTimerID @@ -821,10 +683,7 @@ MPU_pvTimerGetTimerID: b MPU_pvTimerGetTimerIDImpl MPU_pvTimerGetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTimerGetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTimerGetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetTimerID @@ -838,10 +697,7 @@ MPU_vTimerSetTimerID: b MPU_vTimerSetTimerIDImpl MPU_vTimerSetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerIsTimerActive @@ -855,10 +711,7 @@ MPU_xTimerIsTimerActive: b MPU_xTimerIsTimerActiveImpl MPU_xTimerIsTimerActive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerIsTimerActiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerIsTimerActive /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetTimerDaemonTaskHandle @@ -872,14 +725,11 @@ MPU_xTimerGetTimerDaemonTaskHandle: b MPU_xTimerGetTimerDaemonTaskHandleImpl MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetTimerDaemonTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle /*-----------------------------------------------------------*/ - PUBLIC MPU_xTimerGenericCommandFromTask -MPU_xTimerGenericCommandFromTask: + PUBLIC MPU_xTimerGenericCommandFromTaskEntry +MPU_xTimerGenericCommandFromTaskEntry: push {r0} mrs r0, control tst r0, #1 @@ -889,10 +739,7 @@ MPU_xTimerGenericCommandFromTask: b MPU_xTimerGenericCommandFromTaskImpl MPU_xTimerGenericCommandFromTask_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTimerGenericCommandFromTaskImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGenericCommandFromTask /*-----------------------------------------------------------*/ PUBLIC MPU_pcTimerGetName @@ -906,10 +753,7 @@ MPU_pcTimerGetName: b MPU_pcTimerGetNameImpl MPU_pcTimerGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcTimerGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcTimerGetName /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetReloadMode @@ -923,10 +767,7 @@ MPU_vTimerSetReloadMode: b MPU_vTimerSetReloadModeImpl MPU_vTimerSetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetReloadMode @@ -940,10 +781,7 @@ MPU_xTimerGetReloadMode: b MPU_xTimerGetReloadModeImpl MPU_xTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_uxTimerGetReloadMode @@ -957,10 +795,7 @@ MPU_uxTimerGetReloadMode: b MPU_uxTimerGetReloadModeImpl MPU_uxTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetPeriod @@ -974,10 +809,7 @@ MPU_xTimerGetPeriod: b MPU_xTimerGetPeriodImpl MPU_xTimerGetPeriod_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetPeriodImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetPeriod /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetExpiryTime @@ -991,14 +823,11 @@ MPU_xTimerGetExpiryTime: b MPU_xTimerGetExpiryTimeImpl MPU_xTimerGetExpiryTime_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetExpiryTimeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetExpiryTime /*-----------------------------------------------------------*/ - PUBLIC MPU_xEventGroupWaitBits -MPU_xEventGroupWaitBits: + PUBLIC MPU_xEventGroupWaitBitsEntry +MPU_xEventGroupWaitBitsEntry: push {r0} mrs r0, control tst r0, #1 @@ -1008,10 +837,7 @@ MPU_xEventGroupWaitBits: b MPU_xEventGroupWaitBitsImpl MPU_xEventGroupWaitBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xEventGroupWaitBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupWaitBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupClearBits @@ -1025,10 +851,7 @@ MPU_xEventGroupClearBits: b MPU_xEventGroupClearBitsImpl MPU_xEventGroupClearBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupClearBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupClearBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSetBits @@ -1042,10 +865,7 @@ MPU_xEventGroupSetBits: b MPU_xEventGroupSetBitsImpl MPU_xEventGroupSetBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSetBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSetBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSync @@ -1059,10 +879,7 @@ MPU_xEventGroupSync: b MPU_xEventGroupSyncImpl MPU_xEventGroupSync_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSyncImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSync /*-----------------------------------------------------------*/ PUBLIC MPU_uxEventGroupGetNumber @@ -1076,10 +893,7 @@ MPU_uxEventGroupGetNumber: b MPU_uxEventGroupGetNumberImpl MPU_uxEventGroupGetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxEventGroupGetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxEventGroupGetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_vEventGroupSetNumber @@ -1093,10 +907,7 @@ MPU_vEventGroupSetNumber: b MPU_vEventGroupSetNumberImpl MPU_vEventGroupSetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vEventGroupSetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vEventGroupSetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSend @@ -1110,10 +921,7 @@ MPU_xStreamBufferSend: b MPU_xStreamBufferSendImpl MPU_xStreamBufferSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSend /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferReceive @@ -1127,10 +935,7 @@ MPU_xStreamBufferReceive: b MPU_xStreamBufferReceiveImpl MPU_xStreamBufferReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsFull @@ -1144,10 +949,7 @@ MPU_xStreamBufferIsFull: b MPU_xStreamBufferIsFullImpl MPU_xStreamBufferIsFull_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsFullImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsFull /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsEmpty @@ -1161,10 +963,7 @@ MPU_xStreamBufferIsEmpty: b MPU_xStreamBufferIsEmptyImpl MPU_xStreamBufferIsEmpty_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsEmptyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsEmpty /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSpacesAvailable @@ -1178,10 +977,7 @@ MPU_xStreamBufferSpacesAvailable: b MPU_xStreamBufferSpacesAvailableImpl MPU_xStreamBufferSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferBytesAvailable @@ -1195,10 +991,7 @@ MPU_xStreamBufferBytesAvailable: b MPU_xStreamBufferBytesAvailableImpl MPU_xStreamBufferBytesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferBytesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferBytesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSetTriggerLevel @@ -1212,10 +1005,7 @@ MPU_xStreamBufferSetTriggerLevel: b MPU_xStreamBufferSetTriggerLevelImpl MPU_xStreamBufferSetTriggerLevel_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSetTriggerLevelImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSetTriggerLevel /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferNextMessageLengthBytes @@ -1229,10 +1019,7 @@ MPU_xStreamBufferNextMessageLengthBytes: b MPU_xStreamBufferNextMessageLengthBytesImpl MPU_xStreamBufferNextMessageLengthBytes_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferNextMessageLengthBytesImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferNextMessageLengthBytes /*-----------------------------------------------------------*/ /* Default weak implementations in case one is not available from diff --git a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33/portasm.s b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33/portasm.s index 15e74ffc1..d8f1b1d9a 100644 --- a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33/portasm.s +++ b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33/portasm.s @@ -32,6 +32,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 @@ -44,7 +47,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 @@ -86,7 +88,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. */ /*-----------------------------------------------------------*/ @@ -205,7 +207,7 @@ vStartFirstTask: cpsie f 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: @@ -455,11 +457,9 @@ SVC_Handler: ldr r1, [r0, #24] ldrb r2, [r1, #-2] - cmp r2, #4 /* portSVC_SYSTEM_CALL_ENTER. */ - beq syscall_enter - cmp r2, #5 /* portSVC_SYSTEM_CALL_ENTER_1. */ - beq syscall_enter_1 - cmp r2, #6 /* portSVC_SYSTEM_CALL_EXIT. */ + cmp r2, #NUM_SYSTEM_CALLS + blt syscall_enter + cmp r2, #104 /* portSVC_SYSTEM_CALL_EXIT. */ beq syscall_exit b vPortSVCHandler_C @@ -467,10 +467,6 @@ SVC_Handler: mov r1, lr b vSystemCallEnter - syscall_enter_1: - mov r1, lr - b vSystemCallEnter_1 - syscall_exit: mov r1, lr b vSystemCallExit @@ -493,7 +489,7 @@ vPortFreeSecureContext: ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */ cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */ it ne - svcne 1 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 1. */ + svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */ bx lr /* Return. */ /*-----------------------------------------------------------*/ diff --git a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33_NTZ/mpu_wrappers_v2_asm.S b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33_NTZ/mpu_wrappers_v2_asm.S index 1005dad33..80d5a1c63 100644 --- a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33_NTZ/mpu_wrappers_v2_asm.S +++ b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33_NTZ/mpu_wrappers_v2_asm.S @@ -32,15 +32,12 @@ /*-----------------------------------------------------------*/ #include "FreeRTOSConfig.h" +#include "mpu_syscall_numbers.h" #ifndef configUSE_MPU_WRAPPERS_V1 #define configUSE_MPU_WRAPPERS_V1 0 #endif -/* These must be in sync with portmacro.h. */ -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) @@ -56,10 +53,7 @@ MPU_xTaskDelayUntil: b MPU_xTaskDelayUntilImpl MPU_xTaskDelayUntil_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskDelayUntilImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskDelayUntil /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskAbortDelay @@ -73,10 +67,7 @@ MPU_xTaskAbortDelay: b MPU_xTaskAbortDelayImpl MPU_xTaskAbortDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskAbortDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskAbortDelay /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskDelay @@ -90,10 +81,7 @@ MPU_vTaskDelay: b MPU_vTaskDelayImpl MPU_vTaskDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskDelay /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskPriorityGet @@ -107,10 +95,7 @@ MPU_uxTaskPriorityGet: b MPU_uxTaskPriorityGetImpl MPU_uxTaskPriorityGet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskPriorityGetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskPriorityGet /*-----------------------------------------------------------*/ PUBLIC MPU_eTaskGetState @@ -124,10 +109,7 @@ MPU_eTaskGetState: b MPU_eTaskGetStateImpl MPU_eTaskGetState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_eTaskGetStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_eTaskGetState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskGetInfo @@ -141,10 +123,7 @@ MPU_vTaskGetInfo: b MPU_vTaskGetInfoImpl MPU_vTaskGetInfo_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskGetInfoImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskGetInfo /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetIdleTaskHandle @@ -158,10 +137,7 @@ MPU_xTaskGetIdleTaskHandle: b MPU_xTaskGetIdleTaskHandleImpl MPU_xTaskGetIdleTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetIdleTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetIdleTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSuspend @@ -175,10 +151,7 @@ MPU_vTaskSuspend: b MPU_vTaskSuspendImpl MPU_vTaskSuspend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSuspendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSuspend /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskResume @@ -192,10 +165,7 @@ MPU_vTaskResume: b MPU_vTaskResumeImpl MPU_vTaskResume_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskResumeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskResume /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetTickCount @@ -209,10 +179,7 @@ MPU_xTaskGetTickCount: b MPU_xTaskGetTickCountImpl MPU_xTaskGetTickCount_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetTickCountImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetTickCount /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetNumberOfTasks @@ -226,10 +193,7 @@ MPU_uxTaskGetNumberOfTasks: b MPU_uxTaskGetNumberOfTasksImpl MPU_uxTaskGetNumberOfTasks_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetNumberOfTasksImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetNumberOfTasks /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimeCounter @@ -243,10 +207,7 @@ MPU_ulTaskGetRunTimeCounter: b MPU_ulTaskGetRunTimeCounterImpl MPU_ulTaskGetRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimePercent @@ -260,10 +221,7 @@ MPU_ulTaskGetRunTimePercent: b MPU_ulTaskGetRunTimePercentImpl MPU_ulTaskGetRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimePercent @@ -277,10 +235,7 @@ MPU_ulTaskGetIdleRunTimePercent: b MPU_ulTaskGetIdleRunTimePercentImpl MPU_ulTaskGetIdleRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimeCounter @@ -294,10 +249,7 @@ MPU_ulTaskGetIdleRunTimeCounter: b MPU_ulTaskGetIdleRunTimeCounterImpl MPU_ulTaskGetIdleRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetApplicationTaskTag @@ -311,10 +263,7 @@ MPU_vTaskSetApplicationTaskTag: b MPU_vTaskSetApplicationTaskTagImpl MPU_vTaskSetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetApplicationTaskTag @@ -328,10 +277,7 @@ MPU_xTaskGetApplicationTaskTag: b MPU_xTaskGetApplicationTaskTagImpl MPU_xTaskGetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetThreadLocalStoragePointer @@ -345,10 +291,7 @@ MPU_vTaskSetThreadLocalStoragePointer: b MPU_vTaskSetThreadLocalStoragePointerImpl MPU_vTaskSetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_pvTaskGetThreadLocalStoragePointer @@ -362,10 +305,7 @@ MPU_pvTaskGetThreadLocalStoragePointer: b MPU_pvTaskGetThreadLocalStoragePointerImpl MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTaskGetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetSystemState @@ -379,10 +319,7 @@ MPU_uxTaskGetSystemState: b MPU_uxTaskGetSystemStateImpl MPU_uxTaskGetSystemState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetSystemStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetSystemState /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark @@ -396,10 +333,7 @@ MPU_uxTaskGetStackHighWaterMark: b MPU_uxTaskGetStackHighWaterMarkImpl MPU_uxTaskGetStackHighWaterMark_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMarkImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark2 @@ -413,10 +347,7 @@ MPU_uxTaskGetStackHighWaterMark2: b MPU_uxTaskGetStackHighWaterMark2Impl MPU_uxTaskGetStackHighWaterMark2_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMark2Impl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark2 /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetCurrentTaskHandle @@ -430,10 +361,7 @@ MPU_xTaskGetCurrentTaskHandle: b MPU_xTaskGetCurrentTaskHandleImpl MPU_xTaskGetCurrentTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetCurrentTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetCurrentTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetSchedulerState @@ -447,10 +375,7 @@ MPU_xTaskGetSchedulerState: b MPU_xTaskGetSchedulerStateImpl MPU_xTaskGetSchedulerState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetSchedulerStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetSchedulerState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetTimeOutState @@ -464,10 +389,7 @@ MPU_vTaskSetTimeOutState: b MPU_vTaskSetTimeOutStateImpl MPU_vTaskSetTimeOutState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetTimeOutStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetTimeOutState /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskCheckForTimeOut @@ -481,14 +403,11 @@ MPU_xTaskCheckForTimeOut: b MPU_xTaskCheckForTimeOutImpl MPU_xTaskCheckForTimeOut_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskCheckForTimeOutImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskCheckForTimeOut /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotify -MPU_xTaskGenericNotify: + PUBLIC MPU_xTaskGenericNotifyEntry +MPU_xTaskGenericNotifyEntry: push {r0} mrs r0, control tst r0, #1 @@ -498,14 +417,11 @@ MPU_xTaskGenericNotify: b MPU_xTaskGenericNotifyImpl MPU_xTaskGenericNotify_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotify /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotifyWait -MPU_xTaskGenericNotifyWait: + PUBLIC MPU_xTaskGenericNotifyWaitEntry +MPU_xTaskGenericNotifyWaitEntry: push {r0} mrs r0, control tst r0, #1 @@ -515,10 +431,7 @@ MPU_xTaskGenericNotifyWait: b MPU_xTaskGenericNotifyWaitImpl MPU_xTaskGenericNotifyWait_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyWaitImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyWait /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyTake @@ -532,10 +445,7 @@ MPU_ulTaskGenericNotifyTake: b MPU_ulTaskGenericNotifyTakeImpl MPU_ulTaskGenericNotifyTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyTake /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGenericNotifyStateClear @@ -549,10 +459,7 @@ MPU_xTaskGenericNotifyStateClear: b MPU_xTaskGenericNotifyStateClearImpl MPU_xTaskGenericNotifyStateClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGenericNotifyStateClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyStateClear /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyValueClear @@ -566,10 +473,7 @@ MPU_ulTaskGenericNotifyValueClear: b MPU_ulTaskGenericNotifyValueClearImpl MPU_ulTaskGenericNotifyValueClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyValueClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyValueClear /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGenericSend @@ -583,10 +487,7 @@ MPU_xQueueGenericSend: b MPU_xQueueGenericSendImpl MPU_xQueueGenericSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGenericSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGenericSend /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueMessagesWaiting @@ -600,10 +501,7 @@ MPU_uxQueueMessagesWaiting: b MPU_uxQueueMessagesWaitingImpl MPU_uxQueueMessagesWaiting_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueMessagesWaitingImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueMessagesWaiting /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueSpacesAvailable @@ -617,10 +515,7 @@ MPU_uxQueueSpacesAvailable: b MPU_uxQueueSpacesAvailableImpl MPU_uxQueueSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueReceive @@ -634,10 +529,7 @@ MPU_xQueueReceive: b MPU_xQueueReceiveImpl MPU_xQueueReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueuePeek @@ -651,10 +543,7 @@ MPU_xQueuePeek: b MPU_xQueuePeekImpl MPU_xQueuePeek_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueuePeekImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueuePeek /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSemaphoreTake @@ -668,10 +557,7 @@ MPU_xQueueSemaphoreTake: b MPU_xQueueSemaphoreTakeImpl MPU_xQueueSemaphoreTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSemaphoreTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSemaphoreTake /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGetMutexHolder @@ -685,10 +571,7 @@ MPU_xQueueGetMutexHolder: b MPU_xQueueGetMutexHolderImpl MPU_xQueueGetMutexHolder_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGetMutexHolderImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGetMutexHolder /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueTakeMutexRecursive @@ -702,10 +585,7 @@ MPU_xQueueTakeMutexRecursive: b MPU_xQueueTakeMutexRecursiveImpl MPU_xQueueTakeMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueTakeMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueTakeMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGiveMutexRecursive @@ -719,10 +599,7 @@ MPU_xQueueGiveMutexRecursive: b MPU_xQueueGiveMutexRecursiveImpl MPU_xQueueGiveMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGiveMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGiveMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSelectFromSet @@ -736,10 +613,7 @@ MPU_xQueueSelectFromSet: b MPU_xQueueSelectFromSetImpl MPU_xQueueSelectFromSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSelectFromSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSelectFromSet /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueAddToSet @@ -753,10 +627,7 @@ MPU_xQueueAddToSet: b MPU_xQueueAddToSetImpl MPU_xQueueAddToSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueAddToSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueAddToSet /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueAddToRegistry @@ -770,10 +641,7 @@ MPU_vQueueAddToRegistry: b MPU_vQueueAddToRegistryImpl MPU_vQueueAddToRegistry_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueAddToRegistryImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueAddToRegistry /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueUnregisterQueue @@ -787,10 +655,7 @@ MPU_vQueueUnregisterQueue: b MPU_vQueueUnregisterQueueImpl MPU_vQueueUnregisterQueue_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueUnregisterQueueImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueUnregisterQueue /*-----------------------------------------------------------*/ PUBLIC MPU_pcQueueGetName @@ -804,10 +669,7 @@ MPU_pcQueueGetName: b MPU_pcQueueGetNameImpl MPU_pcQueueGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcQueueGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcQueueGetName /*-----------------------------------------------------------*/ PUBLIC MPU_pvTimerGetTimerID @@ -821,10 +683,7 @@ MPU_pvTimerGetTimerID: b MPU_pvTimerGetTimerIDImpl MPU_pvTimerGetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTimerGetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTimerGetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetTimerID @@ -838,10 +697,7 @@ MPU_vTimerSetTimerID: b MPU_vTimerSetTimerIDImpl MPU_vTimerSetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerIsTimerActive @@ -855,10 +711,7 @@ MPU_xTimerIsTimerActive: b MPU_xTimerIsTimerActiveImpl MPU_xTimerIsTimerActive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerIsTimerActiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerIsTimerActive /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetTimerDaemonTaskHandle @@ -872,14 +725,11 @@ MPU_xTimerGetTimerDaemonTaskHandle: b MPU_xTimerGetTimerDaemonTaskHandleImpl MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetTimerDaemonTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle /*-----------------------------------------------------------*/ - PUBLIC MPU_xTimerGenericCommandFromTask -MPU_xTimerGenericCommandFromTask: + PUBLIC MPU_xTimerGenericCommandFromTaskEntry +MPU_xTimerGenericCommandFromTaskEntry: push {r0} mrs r0, control tst r0, #1 @@ -889,10 +739,7 @@ MPU_xTimerGenericCommandFromTask: b MPU_xTimerGenericCommandFromTaskImpl MPU_xTimerGenericCommandFromTask_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTimerGenericCommandFromTaskImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGenericCommandFromTask /*-----------------------------------------------------------*/ PUBLIC MPU_pcTimerGetName @@ -906,10 +753,7 @@ MPU_pcTimerGetName: b MPU_pcTimerGetNameImpl MPU_pcTimerGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcTimerGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcTimerGetName /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetReloadMode @@ -923,10 +767,7 @@ MPU_vTimerSetReloadMode: b MPU_vTimerSetReloadModeImpl MPU_vTimerSetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetReloadMode @@ -940,10 +781,7 @@ MPU_xTimerGetReloadMode: b MPU_xTimerGetReloadModeImpl MPU_xTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_uxTimerGetReloadMode @@ -957,10 +795,7 @@ MPU_uxTimerGetReloadMode: b MPU_uxTimerGetReloadModeImpl MPU_uxTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetPeriod @@ -974,10 +809,7 @@ MPU_xTimerGetPeriod: b MPU_xTimerGetPeriodImpl MPU_xTimerGetPeriod_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetPeriodImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetPeriod /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetExpiryTime @@ -991,14 +823,11 @@ MPU_xTimerGetExpiryTime: b MPU_xTimerGetExpiryTimeImpl MPU_xTimerGetExpiryTime_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetExpiryTimeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetExpiryTime /*-----------------------------------------------------------*/ - PUBLIC MPU_xEventGroupWaitBits -MPU_xEventGroupWaitBits: + PUBLIC MPU_xEventGroupWaitBitsEntry +MPU_xEventGroupWaitBitsEntry: push {r0} mrs r0, control tst r0, #1 @@ -1008,10 +837,7 @@ MPU_xEventGroupWaitBits: b MPU_xEventGroupWaitBitsImpl MPU_xEventGroupWaitBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xEventGroupWaitBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupWaitBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupClearBits @@ -1025,10 +851,7 @@ MPU_xEventGroupClearBits: b MPU_xEventGroupClearBitsImpl MPU_xEventGroupClearBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupClearBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupClearBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSetBits @@ -1042,10 +865,7 @@ MPU_xEventGroupSetBits: b MPU_xEventGroupSetBitsImpl MPU_xEventGroupSetBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSetBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSetBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSync @@ -1059,10 +879,7 @@ MPU_xEventGroupSync: b MPU_xEventGroupSyncImpl MPU_xEventGroupSync_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSyncImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSync /*-----------------------------------------------------------*/ PUBLIC MPU_uxEventGroupGetNumber @@ -1076,10 +893,7 @@ MPU_uxEventGroupGetNumber: b MPU_uxEventGroupGetNumberImpl MPU_uxEventGroupGetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxEventGroupGetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxEventGroupGetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_vEventGroupSetNumber @@ -1093,10 +907,7 @@ MPU_vEventGroupSetNumber: b MPU_vEventGroupSetNumberImpl MPU_vEventGroupSetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vEventGroupSetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vEventGroupSetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSend @@ -1110,10 +921,7 @@ MPU_xStreamBufferSend: b MPU_xStreamBufferSendImpl MPU_xStreamBufferSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSend /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferReceive @@ -1127,10 +935,7 @@ MPU_xStreamBufferReceive: b MPU_xStreamBufferReceiveImpl MPU_xStreamBufferReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsFull @@ -1144,10 +949,7 @@ MPU_xStreamBufferIsFull: b MPU_xStreamBufferIsFullImpl MPU_xStreamBufferIsFull_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsFullImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsFull /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsEmpty @@ -1161,10 +963,7 @@ MPU_xStreamBufferIsEmpty: b MPU_xStreamBufferIsEmptyImpl MPU_xStreamBufferIsEmpty_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsEmptyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsEmpty /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSpacesAvailable @@ -1178,10 +977,7 @@ MPU_xStreamBufferSpacesAvailable: b MPU_xStreamBufferSpacesAvailableImpl MPU_xStreamBufferSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferBytesAvailable @@ -1195,10 +991,7 @@ MPU_xStreamBufferBytesAvailable: b MPU_xStreamBufferBytesAvailableImpl MPU_xStreamBufferBytesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferBytesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferBytesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSetTriggerLevel @@ -1212,10 +1005,7 @@ MPU_xStreamBufferSetTriggerLevel: b MPU_xStreamBufferSetTriggerLevelImpl MPU_xStreamBufferSetTriggerLevel_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSetTriggerLevelImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSetTriggerLevel /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferNextMessageLengthBytes @@ -1229,10 +1019,7 @@ MPU_xStreamBufferNextMessageLengthBytes: b MPU_xStreamBufferNextMessageLengthBytesImpl MPU_xStreamBufferNextMessageLengthBytes_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferNextMessageLengthBytesImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferNextMessageLengthBytes /*-----------------------------------------------------------*/ /* Default weak implementations in case one is not available from diff --git a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33_NTZ/portasm.s b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33_NTZ/portasm.s index ec5202527..7cf467d22 100644 --- a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33_NTZ/portasm.s +++ b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33_NTZ/portasm.s @@ -32,6 +32,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 @@ -41,7 +44,6 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler. EXTERN vPortSVCHandler_C #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) EXTERN vSystemCallEnter - EXTERN vSystemCallEnter_1 EXTERN vSystemCallExit #endif @@ -191,7 +193,7 @@ vStartFirstTask: cpsie f 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: @@ -371,11 +373,9 @@ SVC_Handler: ldr r1, [r0, #24] ldrb r2, [r1, #-2] - cmp r2, #4 /* portSVC_SYSTEM_CALL_ENTER. */ - beq syscall_enter - cmp r2, #5 /* portSVC_SYSTEM_CALL_ENTER_1. */ - beq syscall_enter_1 - cmp r2, #6 /* portSVC_SYSTEM_CALL_EXIT. */ + cmp r2, #NUM_SYSTEM_CALLS + blt syscall_enter + cmp r2, #104 /* portSVC_SYSTEM_CALL_EXIT. */ beq syscall_exit b vPortSVCHandler_C @@ -383,10 +383,6 @@ SVC_Handler: mov r1, lr b vSystemCallEnter - syscall_enter_1: - mov r1, lr - b vSystemCallEnter_1 - syscall_exit: mov r1, lr b vSystemCallExit diff --git a/portable/ARMv8M/non_secure/portmacrocommon.h b/portable/ARMv8M/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/ARMv8M/non_secure/portmacrocommon.h +++ b/portable/ARMv8M/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/Common/mpu_wrappers_v2.c b/portable/Common/mpu_wrappers_v2.c index beb21d271..832a7f844 100644 --- a/portable/Common/mpu_wrappers_v2.c +++ b/portable/Common/mpu_wrappers_v2.c @@ -44,6 +44,7 @@ #include "event_groups.h" #include "stream_buffer.h" #include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -1261,48 +1262,81 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyImpl( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) PRIVILEGED_FUNCTION; + BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, + UBaseType_t uxIndexToNotify, + uint32_t ulValue, + eNotifyAction eAction, + uint32_t * pulPreviousNotificationValue ) /* FREERTOS_SYSTEM_CALL */ + { + BaseType_t xReturn = pdFAIL; + xTaskGenericNotifyParams_t xParams; - BaseType_t MPU_xTaskGenericNotifyImpl( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* PRIVILEGED_FUNCTION */ + xParams.xTaskToNotify = xTaskToNotify; + xParams.uxIndexToNotify = uxIndexToNotify; + xParams.ulValue = ulValue; + xParams.eAction = eAction; + xParams.pulPreviousNotificationValue = pulPreviousNotificationValue; + + xReturn = MPU_xTaskGenericNotifyEntry( &( xParams ) ); + + return xReturn; + } + + BaseType_t MPU_xTaskGenericNotifyImpl( const xTaskGenericNotifyParams_t * pxParams ) PRIVILEGED_FUNCTION; + + BaseType_t MPU_xTaskGenericNotifyImpl( const xTaskGenericNotifyParams_t * pxParams ) /* PRIVILEGED_FUNCTION */ { BaseType_t xReturn = pdFAIL; int32_t lIndex; TaskHandle_t xInternalTaskHandle = NULL; BaseType_t xIsPreviousNotificationValueWriteable = pdFALSE; BaseType_t xCallingTaskIsAuthorizedToAccessTask = pdFALSE; + BaseType_t xAreParamsReadable = pdFALSE; - if( uxIndexToNotify < configTASK_NOTIFICATION_ARRAY_ENTRIES ) + if( pxParams != NULL ) { - if( pulPreviousNotificationValue != NULL ) - { - xIsPreviousNotificationValueWriteable = xPortIsAuthorizedToAccessBuffer( pulPreviousNotificationValue, - sizeof( uint32_t ), - tskMPU_WRITE_PERMISSION ); - } + xAreParamsReadable = xPortIsAuthorizedToAccessBuffer( pxParams, + sizeof( xTaskGenericNotifyParams_t ), + tskMPU_READ_PERMISSION ); + } - if( ( pulPreviousNotificationValue == NULL ) || ( xIsPreviousNotificationValueWriteable == pdTRUE ) ) + if( xAreParamsReadable == pdTRUE ) + { + if( ( pxParams->uxIndexToNotify < configTASK_NOTIFICATION_ARRAY_ENTRIES ) && + ( ( pxParams->eAction == eNoAction ) || + ( pxParams->eAction == eSetBits ) || + ( pxParams->eAction == eIncrement ) || + ( pxParams->eAction == eSetValueWithOverwrite ) || + ( pxParams->eAction == eSetValueWithoutOverwrite ) ) ) { - lIndex = ( int32_t ) xTaskToNotify; - - if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE ) + if( pxParams->pulPreviousNotificationValue != NULL ) { - xCallingTaskIsAuthorizedToAccessTask = xPortIsAuthorizedToAccessKernelObject( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); + xIsPreviousNotificationValueWriteable = xPortIsAuthorizedToAccessBuffer( pxParams->pulPreviousNotificationValue, + sizeof( uint32_t ), + tskMPU_WRITE_PERMISSION ); + } - if( xCallingTaskIsAuthorizedToAccessTask == pdTRUE ) + if( ( pxParams->pulPreviousNotificationValue == NULL ) || + ( xIsPreviousNotificationValueWriteable == pdTRUE ) ) + { + lIndex = ( int32_t ) ( pxParams->xTaskToNotify ); + + if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE ) { - xInternalTaskHandle = MPU_GetTaskHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); + xCallingTaskIsAuthorizedToAccessTask = xPortIsAuthorizedToAccessKernelObject( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); - if( xInternalTaskHandle != NULL ) + if( xCallingTaskIsAuthorizedToAccessTask == pdTRUE ) { - xReturn = xTaskGenericNotify( xInternalTaskHandle, uxIndexToNotify, ulValue, eAction, pulPreviousNotificationValue ); + xInternalTaskHandle = MPU_GetTaskHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); + + if( xInternalTaskHandle != NULL ) + { + xReturn = xTaskGenericNotify( xInternalTaskHandle, + pxParams->uxIndexToNotify, + pxParams->ulValue, + pxParams->eAction, + pxParams->pulPreviousNotificationValue ); + } } } } @@ -1317,33 +1351,61 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWaitImpl( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; + BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, + uint32_t ulBitsToClearOnEntry, + uint32_t ulBitsToClearOnExit, + uint32_t * pulNotificationValue, + TickType_t xTicksToWait ) + { + BaseType_t xReturn = pdFAIL; + xTaskGenericNotifyWaitParams_t xParams; - BaseType_t MPU_xTaskGenericNotifyWaitImpl( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* PRIVILEGED_FUNCTION */ + xParams.uxIndexToWaitOn = uxIndexToWaitOn; + xParams.ulBitsToClearOnEntry = ulBitsToClearOnEntry; + xParams.ulBitsToClearOnExit = ulBitsToClearOnExit; + xParams.pulNotificationValue = pulNotificationValue; + xParams.xTicksToWait = xTicksToWait; + + xReturn = MPU_xTaskGenericNotifyWaitEntry( &( xParams ) ); + + return xReturn; + } + + BaseType_t MPU_xTaskGenericNotifyWaitImpl( const xTaskGenericNotifyWaitParams_t * pxParams ) PRIVILEGED_FUNCTION; + + BaseType_t MPU_xTaskGenericNotifyWaitImpl( const xTaskGenericNotifyWaitParams_t * pxParams ) /* PRIVILEGED_FUNCTION */ { BaseType_t xReturn = pdFAIL; BaseType_t xIsNotificationValueWritable = pdFALSE; + BaseType_t xAreParamsReadable = pdFALSE; - if( uxIndexToWaitOn < configTASK_NOTIFICATION_ARRAY_ENTRIES ) + if( pxParams != NULL ) { - if( pulNotificationValue != NULL ) - { - xIsNotificationValueWritable = xPortIsAuthorizedToAccessBuffer( pulNotificationValue, - sizeof( uint32_t ), - tskMPU_WRITE_PERMISSION ); - } + xAreParamsReadable = xPortIsAuthorizedToAccessBuffer( pxParams, + sizeof( xTaskGenericNotifyWaitParams_t ), + tskMPU_READ_PERMISSION ); + } - if( ( pulNotificationValue == NULL ) || ( xIsNotificationValueWritable == pdTRUE ) ) + if( xAreParamsReadable == pdTRUE ) + { + if( pxParams->uxIndexToWaitOn < configTASK_NOTIFICATION_ARRAY_ENTRIES ) { - xReturn = xTaskGenericNotifyWait( uxIndexToWaitOn, ulBitsToClearOnEntry, ulBitsToClearOnExit, pulNotificationValue, xTicksToWait ); + if( pxParams->pulNotificationValue != NULL ) + { + xIsNotificationValueWritable = xPortIsAuthorizedToAccessBuffer( pxParams->pulNotificationValue, + sizeof( uint32_t ), + tskMPU_WRITE_PERMISSION ); + } + + if( ( pxParams->pulNotificationValue == NULL ) || + ( xIsNotificationValueWritable == pdTRUE ) ) + { + xReturn = xTaskGenericNotifyWait( pxParams->uxIndexToWaitOn, + pxParams->ulBitsToClearOnEntry, + pxParams->ulBitsToClearOnExit, + pxParams->pulNotificationValue, + pxParams->xTicksToWait ); + } } } @@ -2423,6 +2485,7 @@ BaseType_t xCallingTaskIsAuthorizedToAccessQueue = pdFALSE; int32_t lIndex; QueueHandle_t xInternalQueueHandle = NULL; + UBaseType_t uxQueueItemSize; lIndex = ( int32_t ) xMutex; @@ -2436,7 +2499,12 @@ if( xInternalQueueHandle != NULL ) { - xReturn = xQueueTakeMutexRecursive( xInternalQueueHandle, xBlockTime ); + uxQueueItemSize = uxQueueGetQueueItemSize( xInternalQueueHandle ); + + if( uxQueueItemSize == 0 ) + { + xReturn = xQueueTakeMutexRecursive( xInternalQueueHandle, xBlockTime ); + } } } } @@ -3366,48 +3434,76 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTaskImpl( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; + BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, + const BaseType_t xCommandID, + const TickType_t xOptionalValue, + BaseType_t * const pxHigherPriorityTaskWoken, + const TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ + { + BaseType_t xReturn = pdFALSE; + xTimerGenericCommandFromTaskParams_t xParams; - BaseType_t MPU_xTimerGenericCommandFromTaskImpl( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* PRIVILEGED_FUNCTION */ + xParams.xTimer = xTimer; + xParams.xCommandID = xCommandID; + xParams.xOptionalValue = xOptionalValue; + xParams.pxHigherPriorityTaskWoken = pxHigherPriorityTaskWoken; + xParams.xTicksToWait = xTicksToWait; + + xReturn = MPU_xTimerGenericCommandFromTaskEntry( &( xParams ) ); + + return xReturn; + } + + BaseType_t MPU_xTimerGenericCommandFromTaskImpl( const xTimerGenericCommandFromTaskParams_t * pxParams ) PRIVILEGED_FUNCTION; + + BaseType_t MPU_xTimerGenericCommandFromTaskImpl( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* PRIVILEGED_FUNCTION */ { BaseType_t xReturn = pdFALSE; TimerHandle_t xInternalTimerHandle = NULL; int32_t lIndex; BaseType_t xIsHigherPriorityTaskWokenWriteable = pdFALSE; BaseType_t xCallingTaskIsAuthorizedToAccessTimer = pdFALSE; + BaseType_t xAreParamsReadable = pdFALSE; - if( xCommandID < tmrFIRST_FROM_ISR_COMMAND ) + if( pxParams != NULL ) { - if( pxHigherPriorityTaskWoken != NULL ) - { - xIsHigherPriorityTaskWokenWriteable = xPortIsAuthorizedToAccessBuffer( pxHigherPriorityTaskWoken, - sizeof( BaseType_t ), - tskMPU_WRITE_PERMISSION ); - } + xAreParamsReadable = xPortIsAuthorizedToAccessBuffer( pxParams, + sizeof( xTimerGenericCommandFromTaskParams_t ), + tskMPU_READ_PERMISSION ); + } - if( ( pxHigherPriorityTaskWoken == NULL ) || ( xIsHigherPriorityTaskWokenWriteable == pdTRUE ) ) + if( xAreParamsReadable == pdTRUE ) + { + if( pxParams->xCommandID < tmrFIRST_FROM_ISR_COMMAND ) { - lIndex = ( int32_t ) xTimer; - - if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE ) + if( pxParams->pxHigherPriorityTaskWoken != NULL ) { - xCallingTaskIsAuthorizedToAccessTimer = xPortIsAuthorizedToAccessKernelObject( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); + xIsHigherPriorityTaskWokenWriteable = xPortIsAuthorizedToAccessBuffer( pxParams->pxHigherPriorityTaskWoken, + sizeof( BaseType_t ), + tskMPU_WRITE_PERMISSION ); + } - if( xCallingTaskIsAuthorizedToAccessTimer == pdTRUE ) + if( ( pxParams->pxHigherPriorityTaskWoken == NULL ) || + ( xIsHigherPriorityTaskWokenWriteable == pdTRUE ) ) + { + lIndex = ( int32_t ) ( pxParams->xTimer ); + + if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE ) { - xInternalTimerHandle = MPU_GetTimerHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); + xCallingTaskIsAuthorizedToAccessTimer = xPortIsAuthorizedToAccessKernelObject( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); - if( xInternalTimerHandle != NULL ) + if( xCallingTaskIsAuthorizedToAccessTimer == pdTRUE ) { - xReturn = xTimerGenericCommandFromTask( xInternalTimerHandle, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait ); + xInternalTimerHandle = MPU_GetTimerHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); + + if( xInternalTimerHandle != NULL ) + { + xReturn = xTimerGenericCommandFromTask( xInternalTimerHandle, + pxParams->xCommandID, + pxParams->xOptionalValue, + pxParams->pxHigherPriorityTaskWoken, + pxParams->xTicksToWait ); + } } } } @@ -3771,43 +3867,70 @@ /* MPU wrappers for event group APIs. */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBitsImpl( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; + EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, + const EventBits_t uxBitsToWaitFor, + const BaseType_t xClearOnExit, + const BaseType_t xWaitForAllBits, + TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ + { + EventBits_t xReturn = 0; + xEventGroupWaitBitsParams_t xParams; - EventBits_t MPU_xEventGroupWaitBitsImpl( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* PRIVILEGED_FUNCTION */ + xParams.xEventGroup = xEventGroup; + xParams.uxBitsToWaitFor = uxBitsToWaitFor; + xParams.xClearOnExit = xClearOnExit; + xParams.xWaitForAllBits = xWaitForAllBits; + xParams.xTicksToWait = xTicksToWait; + + xReturn = MPU_xEventGroupWaitBitsEntry( &( xParams ) ); + + return xReturn; + } + + EventBits_t MPU_xEventGroupWaitBitsImpl( const xEventGroupWaitBitsParams_t * pxParams ) PRIVILEGED_FUNCTION; + + EventBits_t MPU_xEventGroupWaitBitsImpl( const xEventGroupWaitBitsParams_t * pxParams ) /* PRIVILEGED_FUNCTION */ { EventBits_t xReturn = 0; EventGroupHandle_t xInternalEventGroupHandle = NULL; int32_t lIndex; BaseType_t xCallingTaskIsAuthorizedToAccessEventGroup = pdFALSE; + BaseType_t xAreParamsReadable = pdFALSE; - if( ( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 ) && - ( uxBitsToWaitFor != 0 ) - #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) - && ( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) ) - #endif - ) + if( pxParams != NULL ) { - lIndex = ( int32_t ) xEventGroup; + xAreParamsReadable = xPortIsAuthorizedToAccessBuffer( pxParams, + sizeof( xEventGroupWaitBitsParams_t ), + tskMPU_READ_PERMISSION ); + } - if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE ) + if( xAreParamsReadable == pdTRUE ) + { + if( ( ( pxParams->uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 ) && + ( pxParams->uxBitsToWaitFor != 0 ) + #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) + && ( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( pxParams->xTicksToWait != 0 ) ) ) + #endif + ) { - xCallingTaskIsAuthorizedToAccessEventGroup = xPortIsAuthorizedToAccessKernelObject( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); + lIndex = ( int32_t ) ( pxParams->xEventGroup ); - if( xCallingTaskIsAuthorizedToAccessEventGroup == pdTRUE ) + if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE ) { - xInternalEventGroupHandle = MPU_GetEventGroupHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); + xCallingTaskIsAuthorizedToAccessEventGroup = xPortIsAuthorizedToAccessKernelObject( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); - if( xInternalEventGroupHandle != NULL ) + if( xCallingTaskIsAuthorizedToAccessEventGroup == pdTRUE ) { - xReturn = xEventGroupWaitBits( xInternalEventGroupHandle, uxBitsToWaitFor, xClearOnExit, xWaitForAllBits, xTicksToWait ); + xInternalEventGroupHandle = MPU_GetEventGroupHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); + + if( xInternalEventGroupHandle != NULL ) + { + xReturn = xEventGroupWaitBits( xInternalEventGroupHandle, + pxParams->uxBitsToWaitFor, + pxParams->xClearOnExit, + pxParams->xWaitForAllBits, + pxParams->xTicksToWait ); + } } } } @@ -4764,5 +4887,245 @@ #endif /*-----------------------------------------------------------*/ +/** + * @brief Array of system call implementation functions. + * + * The index in the array MUST match the corresponding system call number + * defined in mpu_wrappers.h. + */ + PRIVILEGED_DATA UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ] = + { + #if ( configUSE_TASK_NOTIFICATIONS == 1 ) + ( UBaseType_t ) MPU_xTaskGenericNotifyImpl, /* SYSTEM_CALL_xTaskGenericNotify. */ + ( UBaseType_t ) MPU_xTaskGenericNotifyWaitImpl, /* SYSTEM_CALL_xTaskGenericNotifyWait. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_xTaskGenericNotify. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_xTaskGenericNotifyWait. */ + #endif + + #if ( configUSE_TIMERS == 1 ) + ( UBaseType_t ) MPU_xTimerGenericCommandFromTaskImpl, /* SYSTEM_CALL_xTimerGenericCommandFromTask. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_xTimerGenericCommandFromTask. */ + #endif + + ( UBaseType_t ) MPU_xEventGroupWaitBitsImpl, /* SYSTEM_CALL_xEventGroupWaitBits. */ + + /* The system calls above this line take 5 parameters. */ + + #if ( INCLUDE_xTaskDelayUntil == 1 ) + ( UBaseType_t ) MPU_xTaskDelayUntilImpl, /* SYSTEM_CALL_xTaskDelayUntil. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_xTaskDelayUntil. */ + #endif + + #if ( INCLUDE_xTaskAbortDelay == 1 ) + ( UBaseType_t ) MPU_xTaskAbortDelayImpl, /* SYSTEM_CALL_xTaskAbortDelay. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_xTaskAbortDelay. */ + #endif + + #if ( INCLUDE_vTaskDelay == 1 ) + ( UBaseType_t ) MPU_vTaskDelayImpl, /* SYSTEM_CALL_vTaskDelay. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_vTaskDelay. */ + #endif + + #if ( INCLUDE_uxTaskPriorityGet == 1 ) + ( UBaseType_t ) MPU_uxTaskPriorityGetImpl, /* SYSTEM_CALL_uxTaskPriorityGet. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_uxTaskPriorityGet. */ + #endif + + #if ( INCLUDE_eTaskGetState == 1 ) + ( UBaseType_t ) MPU_eTaskGetStateImpl, /* SYSTEM_CALL_eTaskGetState. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_eTaskGetState. */ + #endif + + #if ( configUSE_TRACE_FACILITY == 1 ) + ( UBaseType_t ) MPU_vTaskGetInfoImpl, /* SYSTEM_CALL_vTaskGetInfo. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_vTaskGetInfo. */ + #endif + + #if ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) + ( UBaseType_t ) MPU_xTaskGetIdleTaskHandleImpl, /* SYSTEM_CALL_xTaskGetIdleTaskHandle. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_xTaskGetIdleTaskHandle. */ + #endif + + #if ( INCLUDE_vTaskSuspend == 1 ) + ( UBaseType_t ) MPU_vTaskSuspendImpl, /* SYSTEM_CALL_vTaskSuspend. */ + ( UBaseType_t ) MPU_vTaskResumeImpl, /* SYSTEM_CALL_vTaskResume. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_vTaskSuspend. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_vTaskResume. */ + #endif + + ( UBaseType_t ) MPU_xTaskGetTickCountImpl, /* SYSTEM_CALL_xTaskGetTickCount. */ + ( UBaseType_t ) MPU_uxTaskGetNumberOfTasksImpl, /* SYSTEM_CALL_uxTaskGetNumberOfTasks. */ + + #if ( configGENERATE_RUN_TIME_STATS == 1 ) + ( UBaseType_t ) MPU_ulTaskGetRunTimeCounterImpl, /* SYSTEM_CALL_ulTaskGetRunTimeCounter. */ + ( UBaseType_t ) MPU_ulTaskGetRunTimePercentImpl, /* SYSTEM_CALL_ulTaskGetRunTimePercent. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_ulTaskGetRunTimeCounter. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_ulTaskGetRunTimePercent. */ + #endif + + #if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) + ( UBaseType_t ) MPU_ulTaskGetIdleRunTimePercentImpl, /* SYSTEM_CALL_ulTaskGetIdleRunTimePercent. */ + ( UBaseType_t ) MPU_ulTaskGetIdleRunTimeCounterImpl, /* SYSTEM_CALL_ulTaskGetIdleRunTimeCounter. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_ulTaskGetIdleRunTimePercent. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_ulTaskGetIdleRunTimeCounter. */ + #endif + + #if ( configUSE_APPLICATION_TASK_TAG == 1 ) + ( UBaseType_t ) MPU_vTaskSetApplicationTaskTagImpl, /* SYSTEM_CALL_vTaskSetApplicationTaskTag. */ + ( UBaseType_t ) MPU_xTaskGetApplicationTaskTagImpl, /* SYSTEM_CALL_xTaskGetApplicationTaskTag. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_vTaskSetApplicationTaskTag. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_xTaskGetApplicationTaskTag. */ + #endif + + #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 ) + ( UBaseType_t ) MPU_vTaskSetThreadLocalStoragePointerImpl, /* SYSTEM_CALL_vTaskSetThreadLocalStoragePointer. */ + ( UBaseType_t ) MPU_pvTaskGetThreadLocalStoragePointerImpl, /* SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_vTaskSetThreadLocalStoragePointer. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer. */ + #endif + + #if ( configUSE_TRACE_FACILITY == 1 ) + ( UBaseType_t ) MPU_uxTaskGetSystemStateImpl, /* SYSTEM_CALL_uxTaskGetSystemState. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_uxTaskGetSystemState. */ + #endif + + #if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) + ( UBaseType_t ) MPU_uxTaskGetStackHighWaterMarkImpl, /* SYSTEM_CALL_uxTaskGetStackHighWaterMark. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_uxTaskGetStackHighWaterMark. */ + #endif + + #if ( INCLUDE_uxTaskGetStackHighWaterMark2 == 1 ) + ( UBaseType_t ) MPU_uxTaskGetStackHighWaterMark2Impl, /* SYSTEM_CALL_uxTaskGetStackHighWaterMark2. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_uxTaskGetStackHighWaterMark2. */ + #endif + + #if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) ) + ( UBaseType_t ) MPU_xTaskGetCurrentTaskHandleImpl, /* SYSTEM_CALL_xTaskGetCurrentTaskHandle. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_xTaskGetCurrentTaskHandle. */ + #endif + + #if ( INCLUDE_xTaskGetSchedulerState == 1 ) + ( UBaseType_t ) MPU_xTaskGetSchedulerStateImpl, /* SYSTEM_CALL_xTaskGetSchedulerState. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_xTaskGetSchedulerState. */ + #endif + + ( UBaseType_t ) MPU_vTaskSetTimeOutStateImpl, /* SYSTEM_CALL_vTaskSetTimeOutState. */ + ( UBaseType_t ) MPU_xTaskCheckForTimeOutImpl, /* SYSTEM_CALL_xTaskCheckForTimeOut. */ + + #if ( configUSE_TASK_NOTIFICATIONS == 1 ) + ( UBaseType_t ) MPU_ulTaskGenericNotifyTakeImpl, /* SYSTEM_CALL_ulTaskGenericNotifyTake. */ + ( UBaseType_t ) MPU_xTaskGenericNotifyStateClearImpl, /* SYSTEM_CALL_xTaskGenericNotifyStateClear. */ + ( UBaseType_t ) MPU_ulTaskGenericNotifyValueClearImpl, /* SYSTEM_CALL_ulTaskGenericNotifyValueClear. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_ulTaskGenericNotifyTake. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_xTaskGenericNotifyStateClear. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_ulTaskGenericNotifyValueClear. */ + #endif + + ( UBaseType_t ) MPU_xQueueGenericSendImpl, /* SYSTEM_CALL_xQueueGenericSend. */ + ( UBaseType_t ) MPU_uxQueueMessagesWaitingImpl, /* SYSTEM_CALL_uxQueueMessagesWaiting. */ + ( UBaseType_t ) MPU_uxQueueSpacesAvailableImpl, /* SYSTEM_CALL_uxQueueSpacesAvailable. */ + ( UBaseType_t ) MPU_xQueueReceiveImpl, /* SYSTEM_CALL_xQueueReceive. */ + ( UBaseType_t ) MPU_xQueuePeekImpl, /* SYSTEM_CALL_xQueuePeek. */ + ( UBaseType_t ) MPU_xQueueSemaphoreTakeImpl, /* SYSTEM_CALL_xQueueSemaphoreTake. */ + + #if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) ) + ( UBaseType_t ) MPU_xQueueGetMutexHolderImpl, /* SYSTEM_CALL_xQueueGetMutexHolder. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_xQueueGetMutexHolder. */ + #endif + + #if ( configUSE_RECURSIVE_MUTEXES == 1 ) + ( UBaseType_t ) MPU_xQueueTakeMutexRecursiveImpl, /* SYSTEM_CALL_xQueueTakeMutexRecursive. */ + ( UBaseType_t ) MPU_xQueueGiveMutexRecursiveImpl, /* SYSTEM_CALL_xQueueGiveMutexRecursive. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_xQueueTakeMutexRecursive. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_xQueueGiveMutexRecursive. */ + #endif + + #if ( configUSE_QUEUE_SETS == 1 ) + ( UBaseType_t ) MPU_xQueueSelectFromSetImpl, /* SYSTEM_CALL_xQueueSelectFromSet. */ + ( UBaseType_t ) MPU_xQueueAddToSetImpl, /* SYSTEM_CALL_xQueueAddToSet. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_xQueueSelectFromSet. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_xQueueAddToSet. */ + #endif + + #if configQUEUE_REGISTRY_SIZE > 0 + ( UBaseType_t ) MPU_vQueueAddToRegistryImpl, /* SYSTEM_CALL_vQueueAddToRegistry. */ + ( UBaseType_t ) MPU_vQueueUnregisterQueueImpl, /* SYSTEM_CALL_vQueueUnregisterQueue. */ + ( UBaseType_t ) MPU_pcQueueGetNameImpl, /* SYSTEM_CALL_pcQueueGetName. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_vQueueAddToRegistry. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_vQueueUnregisterQueue. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_pcQueueGetName. */ + #endif + + #if ( configUSE_TIMERS == 1 ) + ( UBaseType_t ) MPU_pvTimerGetTimerIDImpl, /* SYSTEM_CALL_pvTimerGetTimerID. */ + ( UBaseType_t ) MPU_vTimerSetTimerIDImpl, /* SYSTEM_CALL_vTimerSetTimerID. */ + ( UBaseType_t ) MPU_xTimerIsTimerActiveImpl, /* SYSTEM_CALL_xTimerIsTimerActive. */ + ( UBaseType_t ) MPU_xTimerGetTimerDaemonTaskHandleImpl, /* SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle. */ + ( UBaseType_t ) MPU_pcTimerGetNameImpl, /* SYSTEM_CALL_pcTimerGetName. */ + ( UBaseType_t ) MPU_vTimerSetReloadModeImpl, /* SYSTEM_CALL_vTimerSetReloadMode. */ + ( UBaseType_t ) MPU_xTimerGetReloadModeImpl, /* SYSTEM_CALL_xTimerGetReloadMode. */ + ( UBaseType_t ) MPU_uxTimerGetReloadModeImpl, /* SYSTEM_CALL_uxTimerGetReloadMode. */ + ( UBaseType_t ) MPU_xTimerGetPeriodImpl, /* SYSTEM_CALL_xTimerGetPeriod. */ + ( UBaseType_t ) MPU_xTimerGetExpiryTimeImpl, /* SYSTEM_CALL_xTimerGetExpiryTime. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_pvTimerGetTimerID. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_vTimerSetTimerID. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_xTimerIsTimerActive. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_pcTimerGetName. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_vTimerSetReloadMode. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_xTimerGetReloadMode. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_uxTimerGetReloadMode. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_xTimerGetPeriod. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_xTimerGetExpiryTime. */ + #endif + + ( UBaseType_t ) MPU_xEventGroupClearBitsImpl, /* SYSTEM_CALL_xEventGroupClearBits. */ + ( UBaseType_t ) MPU_xEventGroupSetBitsImpl, /* SYSTEM_CALL_xEventGroupSetBits. */ + ( UBaseType_t ) MPU_xEventGroupSyncImpl, /* SYSTEM_CALL_xEventGroupSync. */ + + #if ( configUSE_TRACE_FACILITY == 1 ) + ( UBaseType_t ) MPU_uxEventGroupGetNumberImpl, /* SYSTEM_CALL_uxEventGroupGetNumber. */ + ( UBaseType_t ) MPU_vEventGroupSetNumberImpl, /* SYSTEM_CALL_vEventGroupSetNumber. */ + #else + ( UBaseType_t ) 0, /* SYSTEM_CALL_uxEventGroupGetNumber. */ + ( UBaseType_t ) 0, /* SYSTEM_CALL_vEventGroupSetNumber. */ + #endif + + ( UBaseType_t ) MPU_xStreamBufferSendImpl, /* SYSTEM_CALL_xStreamBufferSend. */ + ( UBaseType_t ) MPU_xStreamBufferReceiveImpl, /* SYSTEM_CALL_xStreamBufferReceive. */ + ( UBaseType_t ) MPU_xStreamBufferIsFullImpl, /* SYSTEM_CALL_xStreamBufferIsFull. */ + ( UBaseType_t ) MPU_xStreamBufferIsEmptyImpl, /* SYSTEM_CALL_xStreamBufferIsEmpty. */ + ( UBaseType_t ) MPU_xStreamBufferSpacesAvailableImpl, /* SYSTEM_CALL_xStreamBufferSpacesAvailable. */ + ( UBaseType_t ) MPU_xStreamBufferBytesAvailableImpl, /* SYSTEM_CALL_xStreamBufferBytesAvailable. */ + ( UBaseType_t ) MPU_xStreamBufferSetTriggerLevelImpl, /* SYSTEM_CALL_xStreamBufferSetTriggerLevel. */ + ( UBaseType_t ) MPU_xStreamBufferNextMessageLengthBytesImpl /* SYSTEM_CALL_xStreamBufferNextMessageLengthBytes. */ + }; +/*-----------------------------------------------------------*/ + #endif /* #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM23/non_secure/mpu_wrappers_v2_asm.c b/portable/GCC/ARM_CM23/non_secure/mpu_wrappers_v2_asm.c index 00c8bcfa8..e67f3cbae 100644 --- a/portable/GCC/ARM_CM23/non_secure/mpu_wrappers_v2_asm.c +++ b/portable/GCC/ARM_CM23/non_secure/mpu_wrappers_v2_asm.c @@ -38,6 +38,8 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -68,11 +70,8 @@ " MPU_xTaskDelayUntil_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskDelayUntilImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskDelayUntil ) : "memory" ); } @@ -101,11 +100,8 @@ " MPU_xTaskAbortDelay_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskAbortDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskAbortDelay ) : "memory" ); } @@ -134,11 +130,8 @@ " MPU_vTaskDelay_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskDelay ) : "memory" ); } @@ -167,11 +160,8 @@ " MPU_uxTaskPriorityGet_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskPriorityGetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskPriorityGet ) : "memory" ); } @@ -200,11 +190,8 @@ " MPU_eTaskGetState_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_eTaskGetStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_eTaskGetState ) : "memory" ); } @@ -239,11 +226,8 @@ " MPU_vTaskGetInfo_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskGetInfoImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskGetInfo ) : "memory" ); } @@ -272,11 +256,8 @@ " MPU_xTaskGetIdleTaskHandle_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetIdleTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetIdleTaskHandle ) : "memory" ); } @@ -305,11 +286,8 @@ " MPU_vTaskSuspend_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskSuspendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSuspend ) : "memory" ); } @@ -338,11 +316,8 @@ " MPU_vTaskResume_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskResumeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskResume ) : "memory" ); } @@ -369,11 +344,8 @@ " MPU_xTaskGetTickCount_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetTickCountImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetTickCount ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -398,11 +370,8 @@ " MPU_uxTaskGetNumberOfTasks_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskGetNumberOfTasksImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetNumberOfTasks ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -429,11 +398,8 @@ " MPU_ulTaskGetRunTimeCounter_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimeCounter ) : "memory" ); } @@ -462,11 +428,8 @@ " MPU_ulTaskGetRunTimePercent_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimePercent ) : "memory" ); } @@ -495,11 +458,8 @@ " MPU_ulTaskGetIdleRunTimePercent_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimePercent ) : "memory" ); } @@ -528,11 +488,8 @@ " MPU_ulTaskGetIdleRunTimeCounter_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimeCounter ) : "memory" ); } @@ -563,11 +520,8 @@ " MPU_vTaskSetApplicationTaskTag_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskSetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetApplicationTaskTag ) : "memory" ); } @@ -596,11 +550,8 @@ " MPU_xTaskGetApplicationTaskTag_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetApplicationTaskTag ) : "memory" ); } @@ -633,11 +584,8 @@ " MPU_vTaskSetThreadLocalStoragePointer_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskSetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetThreadLocalStoragePointer ) : "memory" ); } @@ -668,11 +616,8 @@ " MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_pvTaskGetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer ) : "memory" ); } @@ -705,11 +650,8 @@ " MPU_uxTaskGetSystemState_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskGetSystemStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetSystemState ) : "memory" ); } @@ -738,11 +680,8 @@ " MPU_uxTaskGetStackHighWaterMark_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMarkImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark ) : "memory" ); } @@ -771,11 +710,8 @@ " MPU_uxTaskGetStackHighWaterMark2_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMark2Impl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark2 ) : "memory" ); } @@ -804,11 +740,8 @@ " MPU_xTaskGetCurrentTaskHandle_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetCurrentTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetCurrentTaskHandle ) : "memory" ); } @@ -837,11 +770,8 @@ " MPU_xTaskGetSchedulerState_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetSchedulerStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetSchedulerState ) : "memory" ); } @@ -868,11 +798,8 @@ " MPU_vTaskSetTimeOutState_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskSetTimeOutStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetTimeOutState ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -899,28 +826,17 @@ " MPU_xTaskCheckForTimeOut_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskCheckForTimeOutImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskCheckForTimeOut ) : "memory" ); } /*-----------------------------------------------------------*/ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -938,11 +854,8 @@ " MPU_xTaskGenericNotify_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotify ) : "memory" ); } @@ -951,17 +864,9 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -979,11 +884,8 @@ " MPU_xTaskGenericNotifyWait_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyWaitImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyWait ) : "memory" ); } @@ -1016,11 +918,8 @@ " MPU_ulTaskGenericNotifyTake_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyTake ) : "memory" ); } @@ -1051,11 +950,8 @@ " MPU_xTaskGenericNotifyStateClear_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyStateClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyStateClear ) : "memory" ); } @@ -1088,11 +984,8 @@ " MPU_ulTaskGenericNotifyValueClear_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyValueClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyValueClear ) : "memory" ); } @@ -1125,11 +1018,8 @@ " MPU_xQueueGenericSend_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueGenericSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGenericSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1154,11 +1044,8 @@ " MPU_uxQueueMessagesWaiting_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxQueueMessagesWaitingImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueMessagesWaiting ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1183,11 +1070,8 @@ " MPU_uxQueueSpacesAvailable_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxQueueSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1216,11 +1100,8 @@ " MPU_xQueueReceive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1249,11 +1130,8 @@ " MPU_xQueuePeek_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueuePeekImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueuePeek ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1280,11 +1158,8 @@ " MPU_xQueueSemaphoreTake_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueSemaphoreTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSemaphoreTake ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1311,11 +1186,8 @@ " MPU_xQueueGetMutexHolder_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueGetMutexHolderImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGetMutexHolder ) : "memory" ); } @@ -1346,11 +1218,8 @@ " MPU_xQueueTakeMutexRecursive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueTakeMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueTakeMutexRecursive ) : "memory" ); } @@ -1379,11 +1248,8 @@ " MPU_xQueueGiveMutexRecursive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueGiveMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGiveMutexRecursive ) : "memory" ); } @@ -1414,11 +1280,8 @@ " MPU_xQueueSelectFromSet_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueSelectFromSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSelectFromSet ) : "memory" ); } @@ -1449,11 +1312,8 @@ " MPU_xQueueAddToSet_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueAddToSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueAddToSet ) : "memory" ); } @@ -1484,11 +1344,8 @@ " MPU_vQueueAddToRegistry_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vQueueAddToRegistryImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueAddToRegistry ) : "memory" ); } @@ -1517,11 +1374,8 @@ " MPU_vQueueUnregisterQueue_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vQueueUnregisterQueueImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueUnregisterQueue ) : "memory" ); } @@ -1550,11 +1404,8 @@ " MPU_pcQueueGetName_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_pcQueueGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcQueueGetName ) : "memory" ); } @@ -1583,11 +1434,8 @@ " MPU_pvTimerGetTimerID_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_pvTimerGetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTimerGetTimerID ) : "memory" ); } @@ -1618,11 +1466,8 @@ " MPU_vTimerSetTimerID_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTimerSetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetTimerID ) : "memory" ); } @@ -1651,11 +1496,8 @@ " MPU_xTimerIsTimerActive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerIsTimerActiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerIsTimerActive ) : "memory" ); } @@ -1684,11 +1526,8 @@ " MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGetTimerDaemonTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle ) : "memory" ); } @@ -1697,17 +1536,9 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1725,11 +1556,8 @@ " MPU_xTimerGenericCommandFromTask_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGenericCommandFromTaskImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGenericCommandFromTask ) : "memory" ); } @@ -1758,11 +1586,8 @@ " MPU_pcTimerGetName_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_pcTimerGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcTimerGetName ) : "memory" ); } @@ -1793,11 +1618,8 @@ " MPU_vTimerSetReloadMode_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTimerSetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetReloadMode ) : "memory" ); } @@ -1826,11 +1648,8 @@ " MPU_xTimerGetReloadMode_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetReloadMode ) : "memory" ); } @@ -1859,11 +1678,8 @@ " MPU_uxTimerGetReloadMode_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTimerGetReloadMode ) : "memory" ); } @@ -1892,11 +1708,8 @@ " MPU_xTimerGetPeriod_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGetPeriodImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetPeriod ) : "memory" ); } @@ -1925,28 +1738,17 @@ " MPU_xTimerGetExpiryTime_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGetExpiryTimeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetExpiryTime ) : "memory" ); } #endif /* if ( configUSE_TIMERS == 1 ) */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1964,11 +1766,8 @@ " MPU_xEventGroupWaitBits_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xEventGroupWaitBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupWaitBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1995,11 +1794,8 @@ " MPU_xEventGroupClearBits_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xEventGroupClearBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupClearBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2026,11 +1822,8 @@ " MPU_xEventGroupSetBits_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xEventGroupSetBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSetBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2061,11 +1854,8 @@ " MPU_xEventGroupSync_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xEventGroupSyncImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSync ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2092,11 +1882,8 @@ " MPU_uxEventGroupGetNumber_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxEventGroupGetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxEventGroupGetNumber ) : "memory" ); } @@ -2127,11 +1914,8 @@ " MPU_vEventGroupSetNumber_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vEventGroupSetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vEventGroupSetNumber ) : "memory" ); } @@ -2164,11 +1948,8 @@ " MPU_xStreamBufferSend_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2199,11 +1980,8 @@ " MPU_xStreamBufferReceive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2228,11 +2006,8 @@ " MPU_xStreamBufferIsFull_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsFullImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsFull ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2257,11 +2032,8 @@ " MPU_xStreamBufferIsEmpty_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsEmptyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsEmpty ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2286,11 +2058,8 @@ " MPU_xStreamBufferSpacesAvailable_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2315,11 +2084,8 @@ " MPU_xStreamBufferBytesAvailable_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferBytesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferBytesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2346,11 +2112,8 @@ " MPU_xStreamBufferSetTriggerLevel_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferSetTriggerLevelImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSetTriggerLevel ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2375,11 +2138,8 @@ " MPU_xStreamBufferNextMessageLengthBytes_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferNextMessageLengthBytesImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferNextMessageLengthBytes ) : "memory" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM23/non_secure/port.c b/portable/GCC/ARM_CM23/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/GCC/ARM_CM23/non_secure/port.c +++ b/portable/GCC/ARM_CM23/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM23/non_secure/portasm.c b/portable/GCC/ARM_CM23/non_secure/portasm.c index 1b41d587f..f8b37b691 100644 --- a/portable/GCC/ARM_CM23/non_secure/portasm.c +++ b/portable/GCC/ARM_CM23/non_secure/portasm.c @@ -36,6 +36,9 @@ /* Portasm includes. */ #include "portasm.h" +/* System call numbers includes. */ +#include "mpu_syscall_numbers.h" + /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the * header files. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -538,7 +541,6 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att ".syntax unified \n" ".extern vPortSVCHandler_C \n" ".extern vSystemCallEnter \n" - ".extern vSystemCallEnter_1 \n" ".extern vSystemCallExit \n" " \n" "movs r0, #4 \n" @@ -553,26 +555,22 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att " b route_svc \n" " \n" "route_svc: \n" - " ldr r2, [r0, #24] \n" - " subs r2, #2 \n" - " ldrb r3, [r2, #0] \n" - " cmp r3, %0 \n" - " beq system_call_enter \n" - " cmp r3, %1 \n" - " beq system_call_enter_1 \n" - " cmp r3, %2 \n" + " ldr r3, [r0, #24] \n" + " subs r3, #2 \n" + " ldrb r2, [r3, #0] \n" + " cmp r2, %0 \n" + " blt system_call_enter \n" + " cmp r2, %1 \n" " beq system_call_exit \n" " b vPortSVCHandler_C \n" " \n" "system_call_enter: \n" " b vSystemCallEnter \n" - "system_call_enter_1: \n" - " b vSystemCallEnter_1 \n" "system_call_exit: \n" " b vSystemCallExit \n" " \n" : /* No outputs. */ - : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) + : "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "r0", "r1", "r2", "r3", "memory" ); } diff --git a/portable/GCC/ARM_CM23/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM23/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/GCC/ARM_CM23/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM23/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM23_NTZ/non_secure/mpu_wrappers_v2_asm.c b/portable/GCC/ARM_CM23_NTZ/non_secure/mpu_wrappers_v2_asm.c index 00c8bcfa8..e67f3cbae 100644 --- a/portable/GCC/ARM_CM23_NTZ/non_secure/mpu_wrappers_v2_asm.c +++ b/portable/GCC/ARM_CM23_NTZ/non_secure/mpu_wrappers_v2_asm.c @@ -38,6 +38,8 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -68,11 +70,8 @@ " MPU_xTaskDelayUntil_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskDelayUntilImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskDelayUntil ) : "memory" ); } @@ -101,11 +100,8 @@ " MPU_xTaskAbortDelay_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskAbortDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskAbortDelay ) : "memory" ); } @@ -134,11 +130,8 @@ " MPU_vTaskDelay_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskDelay ) : "memory" ); } @@ -167,11 +160,8 @@ " MPU_uxTaskPriorityGet_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskPriorityGetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskPriorityGet ) : "memory" ); } @@ -200,11 +190,8 @@ " MPU_eTaskGetState_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_eTaskGetStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_eTaskGetState ) : "memory" ); } @@ -239,11 +226,8 @@ " MPU_vTaskGetInfo_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskGetInfoImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskGetInfo ) : "memory" ); } @@ -272,11 +256,8 @@ " MPU_xTaskGetIdleTaskHandle_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetIdleTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetIdleTaskHandle ) : "memory" ); } @@ -305,11 +286,8 @@ " MPU_vTaskSuspend_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskSuspendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSuspend ) : "memory" ); } @@ -338,11 +316,8 @@ " MPU_vTaskResume_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskResumeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskResume ) : "memory" ); } @@ -369,11 +344,8 @@ " MPU_xTaskGetTickCount_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetTickCountImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetTickCount ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -398,11 +370,8 @@ " MPU_uxTaskGetNumberOfTasks_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskGetNumberOfTasksImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetNumberOfTasks ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -429,11 +398,8 @@ " MPU_ulTaskGetRunTimeCounter_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimeCounter ) : "memory" ); } @@ -462,11 +428,8 @@ " MPU_ulTaskGetRunTimePercent_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimePercent ) : "memory" ); } @@ -495,11 +458,8 @@ " MPU_ulTaskGetIdleRunTimePercent_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimePercent ) : "memory" ); } @@ -528,11 +488,8 @@ " MPU_ulTaskGetIdleRunTimeCounter_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimeCounter ) : "memory" ); } @@ -563,11 +520,8 @@ " MPU_vTaskSetApplicationTaskTag_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskSetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetApplicationTaskTag ) : "memory" ); } @@ -596,11 +550,8 @@ " MPU_xTaskGetApplicationTaskTag_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetApplicationTaskTag ) : "memory" ); } @@ -633,11 +584,8 @@ " MPU_vTaskSetThreadLocalStoragePointer_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskSetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetThreadLocalStoragePointer ) : "memory" ); } @@ -668,11 +616,8 @@ " MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_pvTaskGetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer ) : "memory" ); } @@ -705,11 +650,8 @@ " MPU_uxTaskGetSystemState_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskGetSystemStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetSystemState ) : "memory" ); } @@ -738,11 +680,8 @@ " MPU_uxTaskGetStackHighWaterMark_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMarkImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark ) : "memory" ); } @@ -771,11 +710,8 @@ " MPU_uxTaskGetStackHighWaterMark2_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMark2Impl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark2 ) : "memory" ); } @@ -804,11 +740,8 @@ " MPU_xTaskGetCurrentTaskHandle_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetCurrentTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetCurrentTaskHandle ) : "memory" ); } @@ -837,11 +770,8 @@ " MPU_xTaskGetSchedulerState_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGetSchedulerStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetSchedulerState ) : "memory" ); } @@ -868,11 +798,8 @@ " MPU_vTaskSetTimeOutState_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTaskSetTimeOutStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetTimeOutState ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -899,28 +826,17 @@ " MPU_xTaskCheckForTimeOut_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskCheckForTimeOutImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskCheckForTimeOut ) : "memory" ); } /*-----------------------------------------------------------*/ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -938,11 +854,8 @@ " MPU_xTaskGenericNotify_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotify ) : "memory" ); } @@ -951,17 +864,9 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -979,11 +884,8 @@ " MPU_xTaskGenericNotifyWait_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyWaitImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyWait ) : "memory" ); } @@ -1016,11 +918,8 @@ " MPU_ulTaskGenericNotifyTake_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyTake ) : "memory" ); } @@ -1051,11 +950,8 @@ " MPU_xTaskGenericNotifyStateClear_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyStateClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyStateClear ) : "memory" ); } @@ -1088,11 +984,8 @@ " MPU_ulTaskGenericNotifyValueClear_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyValueClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyValueClear ) : "memory" ); } @@ -1125,11 +1018,8 @@ " MPU_xQueueGenericSend_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueGenericSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGenericSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1154,11 +1044,8 @@ " MPU_uxQueueMessagesWaiting_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxQueueMessagesWaitingImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueMessagesWaiting ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1183,11 +1070,8 @@ " MPU_uxQueueSpacesAvailable_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxQueueSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1216,11 +1100,8 @@ " MPU_xQueueReceive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1249,11 +1130,8 @@ " MPU_xQueuePeek_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueuePeekImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueuePeek ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1280,11 +1158,8 @@ " MPU_xQueueSemaphoreTake_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueSemaphoreTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSemaphoreTake ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1311,11 +1186,8 @@ " MPU_xQueueGetMutexHolder_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueGetMutexHolderImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGetMutexHolder ) : "memory" ); } @@ -1346,11 +1218,8 @@ " MPU_xQueueTakeMutexRecursive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueTakeMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueTakeMutexRecursive ) : "memory" ); } @@ -1379,11 +1248,8 @@ " MPU_xQueueGiveMutexRecursive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueGiveMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGiveMutexRecursive ) : "memory" ); } @@ -1414,11 +1280,8 @@ " MPU_xQueueSelectFromSet_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueSelectFromSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSelectFromSet ) : "memory" ); } @@ -1449,11 +1312,8 @@ " MPU_xQueueAddToSet_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xQueueAddToSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueAddToSet ) : "memory" ); } @@ -1484,11 +1344,8 @@ " MPU_vQueueAddToRegistry_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vQueueAddToRegistryImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueAddToRegistry ) : "memory" ); } @@ -1517,11 +1374,8 @@ " MPU_vQueueUnregisterQueue_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vQueueUnregisterQueueImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueUnregisterQueue ) : "memory" ); } @@ -1550,11 +1404,8 @@ " MPU_pcQueueGetName_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_pcQueueGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcQueueGetName ) : "memory" ); } @@ -1583,11 +1434,8 @@ " MPU_pvTimerGetTimerID_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_pvTimerGetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTimerGetTimerID ) : "memory" ); } @@ -1618,11 +1466,8 @@ " MPU_vTimerSetTimerID_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTimerSetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetTimerID ) : "memory" ); } @@ -1651,11 +1496,8 @@ " MPU_xTimerIsTimerActive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerIsTimerActiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerIsTimerActive ) : "memory" ); } @@ -1684,11 +1526,8 @@ " MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGetTimerDaemonTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle ) : "memory" ); } @@ -1697,17 +1536,9 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1725,11 +1556,8 @@ " MPU_xTimerGenericCommandFromTask_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGenericCommandFromTaskImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGenericCommandFromTask ) : "memory" ); } @@ -1758,11 +1586,8 @@ " MPU_pcTimerGetName_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_pcTimerGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcTimerGetName ) : "memory" ); } @@ -1793,11 +1618,8 @@ " MPU_vTimerSetReloadMode_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vTimerSetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetReloadMode ) : "memory" ); } @@ -1826,11 +1648,8 @@ " MPU_xTimerGetReloadMode_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetReloadMode ) : "memory" ); } @@ -1859,11 +1678,8 @@ " MPU_uxTimerGetReloadMode_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTimerGetReloadMode ) : "memory" ); } @@ -1892,11 +1708,8 @@ " MPU_xTimerGetPeriod_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGetPeriodImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetPeriod ) : "memory" ); } @@ -1925,28 +1738,17 @@ " MPU_xTimerGetExpiryTime_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xTimerGetExpiryTimeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetExpiryTime ) : "memory" ); } #endif /* if ( configUSE_TIMERS == 1 ) */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1964,11 +1766,8 @@ " MPU_xEventGroupWaitBits_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xEventGroupWaitBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupWaitBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1995,11 +1794,8 @@ " MPU_xEventGroupClearBits_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xEventGroupClearBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupClearBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2026,11 +1822,8 @@ " MPU_xEventGroupSetBits_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xEventGroupSetBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSetBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2061,11 +1854,8 @@ " MPU_xEventGroupSync_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xEventGroupSyncImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSync ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2092,11 +1882,8 @@ " MPU_uxEventGroupGetNumber_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_uxEventGroupGetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxEventGroupGetNumber ) : "memory" ); } @@ -2127,11 +1914,8 @@ " MPU_vEventGroupSetNumber_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_vEventGroupSetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vEventGroupSetNumber ) : "memory" ); } @@ -2164,11 +1948,8 @@ " MPU_xStreamBufferSend_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2199,11 +1980,8 @@ " MPU_xStreamBufferReceive_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2228,11 +2006,8 @@ " MPU_xStreamBufferIsFull_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsFullImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsFull ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2257,11 +2032,8 @@ " MPU_xStreamBufferIsEmpty_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsEmptyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsEmpty ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2286,11 +2058,8 @@ " MPU_xStreamBufferSpacesAvailable_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2315,11 +2084,8 @@ " MPU_xStreamBufferBytesAvailable_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferBytesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferBytesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2346,11 +2112,8 @@ " MPU_xStreamBufferSetTriggerLevel_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferSetTriggerLevelImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSetTriggerLevel ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2375,11 +2138,8 @@ " MPU_xStreamBufferNextMessageLengthBytes_Unpriv: \n" " pop {r0, r1} \n" " svc %0 \n" - " bl MPU_xStreamBufferNextMessageLengthBytesImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferNextMessageLengthBytes ) : "memory" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM23_NTZ/non_secure/port.c b/portable/GCC/ARM_CM23_NTZ/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/GCC/ARM_CM23_NTZ/non_secure/port.c +++ b/portable/GCC/ARM_CM23_NTZ/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM23_NTZ/non_secure/portasm.c b/portable/GCC/ARM_CM23_NTZ/non_secure/portasm.c index ed4933812..5fde8342e 100644 --- a/portable/GCC/ARM_CM23_NTZ/non_secure/portasm.c +++ b/portable/GCC/ARM_CM23_NTZ/non_secure/portasm.c @@ -36,6 +36,9 @@ /* Portasm includes. */ #include "portasm.h" +/* System call numbers includes. */ +#include "mpu_syscall_numbers.h" + /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the * header files. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -478,7 +481,6 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att ".syntax unified \n" ".extern vPortSVCHandler_C \n" ".extern vSystemCallEnter \n" - ".extern vSystemCallEnter_1 \n" ".extern vSystemCallExit \n" " \n" "movs r0, #4 \n" @@ -493,26 +495,22 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att " b route_svc \n" " \n" "route_svc: \n" - " ldr r2, [r0, #24] \n" - " subs r2, #2 \n" - " ldrb r3, [r2, #0] \n" - " cmp r3, %0 \n" - " beq system_call_enter \n" - " cmp r3, %1 \n" - " beq system_call_enter_1 \n" - " cmp r3, %2 \n" + " ldr r3, [r0, #24] \n" + " subs r3, #2 \n" + " ldrb r2, [r3, #0] \n" + " cmp r2, %0 \n" + " blt system_call_enter \n" + " cmp r2, %1 \n" " beq system_call_exit \n" " b vPortSVCHandler_C \n" " \n" "system_call_enter: \n" " b vSystemCallEnter \n" - "system_call_enter_1: \n" - " b vSystemCallEnter_1 \n" "system_call_exit: \n" " b vSystemCallExit \n" " \n" : /* No outputs. */ - : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) + : "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "r0", "r1", "r2", "r3", "memory" ); } diff --git a/portable/GCC/ARM_CM23_NTZ/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM23_NTZ/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/GCC/ARM_CM23_NTZ/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM23_NTZ/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM33/non_secure/mpu_wrappers_v2_asm.c b/portable/GCC/ARM_CM33/non_secure/mpu_wrappers_v2_asm.c index d1fbdc0e5..4cb310afd 100644 --- a/portable/GCC/ARM_CM33/non_secure/mpu_wrappers_v2_asm.c +++ b/portable/GCC/ARM_CM33/non_secure/mpu_wrappers_v2_asm.c @@ -38,6 +38,8 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -67,11 +69,8 @@ " MPU_xTaskDelayUntil_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskDelayUntilImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskDelayUntil ) : "memory" ); } @@ -99,11 +98,8 @@ " MPU_xTaskAbortDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskAbortDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskAbortDelay ) : "memory" ); } @@ -131,11 +127,8 @@ " MPU_vTaskDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskDelay ) : "memory" ); } @@ -163,11 +156,8 @@ " MPU_uxTaskPriorityGet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskPriorityGetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskPriorityGet ) : "memory" ); } @@ -195,11 +185,8 @@ " MPU_eTaskGetState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_eTaskGetStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_eTaskGetState ) : "memory" ); } @@ -233,11 +220,8 @@ " MPU_vTaskGetInfo_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskGetInfoImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskGetInfo ) : "memory" ); } @@ -265,11 +249,8 @@ " MPU_xTaskGetIdleTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetIdleTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetIdleTaskHandle ) : "memory" ); } @@ -297,11 +278,8 @@ " MPU_vTaskSuspend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSuspendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSuspend ) : "memory" ); } @@ -329,11 +307,8 @@ " MPU_vTaskResume_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskResumeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskResume ) : "memory" ); } @@ -359,11 +334,8 @@ " MPU_xTaskGetTickCount_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetTickCountImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetTickCount ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -387,11 +359,8 @@ " MPU_uxTaskGetNumberOfTasks_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetNumberOfTasksImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetNumberOfTasks ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -417,11 +386,8 @@ " MPU_ulTaskGetRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimeCounter ) : "memory" ); } @@ -449,11 +415,8 @@ " MPU_ulTaskGetRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimePercent ) : "memory" ); } @@ -481,11 +444,8 @@ " MPU_ulTaskGetIdleRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimePercent ) : "memory" ); } @@ -513,11 +473,8 @@ " MPU_ulTaskGetIdleRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimeCounter ) : "memory" ); } @@ -547,11 +504,8 @@ " MPU_vTaskSetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetApplicationTaskTag ) : "memory" ); } @@ -579,11 +533,8 @@ " MPU_xTaskGetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetApplicationTaskTag ) : "memory" ); } @@ -615,11 +566,8 @@ " MPU_vTaskSetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetThreadLocalStoragePointer ) : "memory" ); } @@ -649,11 +597,8 @@ " MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTaskGetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer ) : "memory" ); } @@ -685,11 +630,8 @@ " MPU_uxTaskGetSystemState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetSystemStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetSystemState ) : "memory" ); } @@ -717,11 +659,8 @@ " MPU_uxTaskGetStackHighWaterMark_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMarkImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark ) : "memory" ); } @@ -749,11 +688,8 @@ " MPU_uxTaskGetStackHighWaterMark2_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMark2Impl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark2 ) : "memory" ); } @@ -781,11 +717,8 @@ " MPU_xTaskGetCurrentTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetCurrentTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetCurrentTaskHandle ) : "memory" ); } @@ -813,11 +746,8 @@ " MPU_xTaskGetSchedulerState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetSchedulerStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetSchedulerState ) : "memory" ); } @@ -843,11 +773,8 @@ " MPU_vTaskSetTimeOutState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetTimeOutStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetTimeOutState ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -873,28 +800,17 @@ " MPU_xTaskCheckForTimeOut_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskCheckForTimeOutImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskCheckForTimeOut ) : "memory" ); } /*-----------------------------------------------------------*/ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -911,11 +827,8 @@ " MPU_xTaskGenericNotify_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotify ) : "memory" ); } @@ -924,17 +837,9 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -951,11 +856,8 @@ " MPU_xTaskGenericNotifyWait_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyWaitImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyWait ) : "memory" ); } @@ -987,11 +889,8 @@ " MPU_ulTaskGenericNotifyTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyTake ) : "memory" ); } @@ -1021,11 +920,8 @@ " MPU_xTaskGenericNotifyStateClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyStateClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyStateClear ) : "memory" ); } @@ -1057,11 +953,8 @@ " MPU_ulTaskGenericNotifyValueClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyValueClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyValueClear ) : "memory" ); } @@ -1093,11 +986,8 @@ " MPU_xQueueGenericSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGenericSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGenericSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1121,11 +1011,8 @@ " MPU_uxQueueMessagesWaiting_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueMessagesWaitingImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueMessagesWaiting ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1149,11 +1036,8 @@ " MPU_uxQueueSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1181,11 +1065,8 @@ " MPU_xQueueReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1213,11 +1094,8 @@ " MPU_xQueuePeek_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueuePeekImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueuePeek ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1243,11 +1121,8 @@ " MPU_xQueueSemaphoreTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSemaphoreTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSemaphoreTake ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1273,11 +1148,8 @@ " MPU_xQueueGetMutexHolder_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGetMutexHolderImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGetMutexHolder ) : "memory" ); } @@ -1307,11 +1179,8 @@ " MPU_xQueueTakeMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueTakeMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueTakeMutexRecursive ) : "memory" ); } @@ -1339,11 +1208,8 @@ " MPU_xQueueGiveMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGiveMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGiveMutexRecursive ) : "memory" ); } @@ -1373,11 +1239,8 @@ " MPU_xQueueSelectFromSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSelectFromSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSelectFromSet ) : "memory" ); } @@ -1407,11 +1270,8 @@ " MPU_xQueueAddToSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueAddToSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueAddToSet ) : "memory" ); } @@ -1441,11 +1301,8 @@ " MPU_vQueueAddToRegistry_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueAddToRegistryImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueAddToRegistry ) : "memory" ); } @@ -1473,11 +1330,8 @@ " MPU_vQueueUnregisterQueue_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueUnregisterQueueImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueUnregisterQueue ) : "memory" ); } @@ -1505,11 +1359,8 @@ " MPU_pcQueueGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcQueueGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcQueueGetName ) : "memory" ); } @@ -1537,11 +1388,8 @@ " MPU_pvTimerGetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTimerGetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTimerGetTimerID ) : "memory" ); } @@ -1571,11 +1419,8 @@ " MPU_vTimerSetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetTimerID ) : "memory" ); } @@ -1603,11 +1448,8 @@ " MPU_xTimerIsTimerActive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerIsTimerActiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerIsTimerActive ) : "memory" ); } @@ -1635,11 +1477,8 @@ " MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetTimerDaemonTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle ) : "memory" ); } @@ -1648,17 +1487,9 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1675,11 +1506,8 @@ " MPU_xTimerGenericCommandFromTask_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGenericCommandFromTaskImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGenericCommandFromTask ) : "memory" ); } @@ -1707,11 +1535,8 @@ " MPU_pcTimerGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcTimerGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcTimerGetName ) : "memory" ); } @@ -1741,11 +1566,8 @@ " MPU_vTimerSetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetReloadMode ) : "memory" ); } @@ -1773,11 +1595,8 @@ " MPU_xTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetReloadMode ) : "memory" ); } @@ -1805,11 +1624,8 @@ " MPU_uxTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTimerGetReloadMode ) : "memory" ); } @@ -1837,11 +1653,8 @@ " MPU_xTimerGetPeriod_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetPeriodImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetPeriod ) : "memory" ); } @@ -1869,28 +1682,17 @@ " MPU_xTimerGetExpiryTime_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetExpiryTimeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetExpiryTime ) : "memory" ); } #endif /* if ( configUSE_TIMERS == 1 ) */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1907,11 +1709,8 @@ " MPU_xEventGroupWaitBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupWaitBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupWaitBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1937,11 +1736,8 @@ " MPU_xEventGroupClearBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupClearBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupClearBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1967,11 +1763,8 @@ " MPU_xEventGroupSetBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSetBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSetBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2001,11 +1794,8 @@ " MPU_xEventGroupSync_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSyncImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSync ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2031,11 +1821,8 @@ " MPU_uxEventGroupGetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxEventGroupGetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxEventGroupGetNumber ) : "memory" ); } @@ -2065,11 +1852,8 @@ " MPU_vEventGroupSetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vEventGroupSetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vEventGroupSetNumber ) : "memory" ); } @@ -2101,11 +1885,8 @@ " MPU_xStreamBufferSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2135,11 +1916,8 @@ " MPU_xStreamBufferReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2163,11 +1941,8 @@ " MPU_xStreamBufferIsFull_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsFullImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsFull ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2191,11 +1966,8 @@ " MPU_xStreamBufferIsEmpty_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsEmptyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsEmpty ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2219,11 +1991,8 @@ " MPU_xStreamBufferSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2247,11 +2016,8 @@ " MPU_xStreamBufferBytesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferBytesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferBytesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2277,11 +2043,8 @@ " MPU_xStreamBufferSetTriggerLevel_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSetTriggerLevelImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSetTriggerLevel ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2305,11 +2068,8 @@ " MPU_xStreamBufferNextMessageLengthBytes_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferNextMessageLengthBytesImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferNextMessageLengthBytes ) : "memory" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM33/non_secure/port.c b/portable/GCC/ARM_CM33/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/GCC/ARM_CM33/non_secure/port.c +++ b/portable/GCC/ARM_CM33/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM33/non_secure/portasm.c b/portable/GCC/ARM_CM33/non_secure/portasm.c index ba8f6c62d..16c598ad7 100644 --- a/portable/GCC/ARM_CM33/non_secure/portasm.c +++ b/portable/GCC/ARM_CM33/non_secure/portasm.c @@ -36,6 +36,9 @@ /* Portasm includes. */ #include "portasm.h" +/* System call numbers includes. */ +#include "mpu_syscall_numbers.h" + /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the * header files. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -522,7 +525,6 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att ".syntax unified \n" ".extern vPortSVCHandler_C \n" ".extern vSystemCallEnter \n" - ".extern vSystemCallEnter_1 \n" ".extern vSystemCallExit \n" " \n" "tst lr, #4 \n" @@ -533,10 +535,8 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att "ldr r1, [r0, #24] \n" "ldrb r2, [r1, #-2] \n" "cmp r2, %0 \n" - "beq syscall_enter \n" + "blt syscall_enter \n" "cmp r2, %1 \n" - "beq syscall_enter_1 \n" - "cmp r2, %2 \n" "beq syscall_exit \n" "b vPortSVCHandler_C \n" " \n" @@ -544,16 +544,12 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att " mov r1, lr \n" " b vSystemCallEnter \n" " \n" - "syscall_enter_1: \n" - " mov r1, lr \n" - " b vSystemCallEnter_1 \n" - " \n" "syscall_exit: \n" " mov r1, lr \n" " b vSystemCallExit \n" " \n" : /* No outputs. */ - : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) + : "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "r0", "r1", "r2", "memory" ); } diff --git a/portable/GCC/ARM_CM33/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM33/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/GCC/ARM_CM33/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM33/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM33_NTZ/non_secure/mpu_wrappers_v2_asm.c b/portable/GCC/ARM_CM33_NTZ/non_secure/mpu_wrappers_v2_asm.c index d1fbdc0e5..4cb310afd 100644 --- a/portable/GCC/ARM_CM33_NTZ/non_secure/mpu_wrappers_v2_asm.c +++ b/portable/GCC/ARM_CM33_NTZ/non_secure/mpu_wrappers_v2_asm.c @@ -38,6 +38,8 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -67,11 +69,8 @@ " MPU_xTaskDelayUntil_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskDelayUntilImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskDelayUntil ) : "memory" ); } @@ -99,11 +98,8 @@ " MPU_xTaskAbortDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskAbortDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskAbortDelay ) : "memory" ); } @@ -131,11 +127,8 @@ " MPU_vTaskDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskDelay ) : "memory" ); } @@ -163,11 +156,8 @@ " MPU_uxTaskPriorityGet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskPriorityGetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskPriorityGet ) : "memory" ); } @@ -195,11 +185,8 @@ " MPU_eTaskGetState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_eTaskGetStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_eTaskGetState ) : "memory" ); } @@ -233,11 +220,8 @@ " MPU_vTaskGetInfo_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskGetInfoImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskGetInfo ) : "memory" ); } @@ -265,11 +249,8 @@ " MPU_xTaskGetIdleTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetIdleTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetIdleTaskHandle ) : "memory" ); } @@ -297,11 +278,8 @@ " MPU_vTaskSuspend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSuspendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSuspend ) : "memory" ); } @@ -329,11 +307,8 @@ " MPU_vTaskResume_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskResumeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskResume ) : "memory" ); } @@ -359,11 +334,8 @@ " MPU_xTaskGetTickCount_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetTickCountImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetTickCount ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -387,11 +359,8 @@ " MPU_uxTaskGetNumberOfTasks_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetNumberOfTasksImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetNumberOfTasks ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -417,11 +386,8 @@ " MPU_ulTaskGetRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimeCounter ) : "memory" ); } @@ -449,11 +415,8 @@ " MPU_ulTaskGetRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimePercent ) : "memory" ); } @@ -481,11 +444,8 @@ " MPU_ulTaskGetIdleRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimePercent ) : "memory" ); } @@ -513,11 +473,8 @@ " MPU_ulTaskGetIdleRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimeCounter ) : "memory" ); } @@ -547,11 +504,8 @@ " MPU_vTaskSetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetApplicationTaskTag ) : "memory" ); } @@ -579,11 +533,8 @@ " MPU_xTaskGetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetApplicationTaskTag ) : "memory" ); } @@ -615,11 +566,8 @@ " MPU_vTaskSetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetThreadLocalStoragePointer ) : "memory" ); } @@ -649,11 +597,8 @@ " MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTaskGetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer ) : "memory" ); } @@ -685,11 +630,8 @@ " MPU_uxTaskGetSystemState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetSystemStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetSystemState ) : "memory" ); } @@ -717,11 +659,8 @@ " MPU_uxTaskGetStackHighWaterMark_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMarkImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark ) : "memory" ); } @@ -749,11 +688,8 @@ " MPU_uxTaskGetStackHighWaterMark2_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMark2Impl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark2 ) : "memory" ); } @@ -781,11 +717,8 @@ " MPU_xTaskGetCurrentTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetCurrentTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetCurrentTaskHandle ) : "memory" ); } @@ -813,11 +746,8 @@ " MPU_xTaskGetSchedulerState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetSchedulerStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetSchedulerState ) : "memory" ); } @@ -843,11 +773,8 @@ " MPU_vTaskSetTimeOutState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetTimeOutStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetTimeOutState ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -873,28 +800,17 @@ " MPU_xTaskCheckForTimeOut_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskCheckForTimeOutImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskCheckForTimeOut ) : "memory" ); } /*-----------------------------------------------------------*/ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -911,11 +827,8 @@ " MPU_xTaskGenericNotify_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotify ) : "memory" ); } @@ -924,17 +837,9 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -951,11 +856,8 @@ " MPU_xTaskGenericNotifyWait_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyWaitImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyWait ) : "memory" ); } @@ -987,11 +889,8 @@ " MPU_ulTaskGenericNotifyTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyTake ) : "memory" ); } @@ -1021,11 +920,8 @@ " MPU_xTaskGenericNotifyStateClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyStateClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyStateClear ) : "memory" ); } @@ -1057,11 +953,8 @@ " MPU_ulTaskGenericNotifyValueClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyValueClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyValueClear ) : "memory" ); } @@ -1093,11 +986,8 @@ " MPU_xQueueGenericSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGenericSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGenericSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1121,11 +1011,8 @@ " MPU_uxQueueMessagesWaiting_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueMessagesWaitingImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueMessagesWaiting ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1149,11 +1036,8 @@ " MPU_uxQueueSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1181,11 +1065,8 @@ " MPU_xQueueReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1213,11 +1094,8 @@ " MPU_xQueuePeek_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueuePeekImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueuePeek ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1243,11 +1121,8 @@ " MPU_xQueueSemaphoreTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSemaphoreTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSemaphoreTake ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1273,11 +1148,8 @@ " MPU_xQueueGetMutexHolder_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGetMutexHolderImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGetMutexHolder ) : "memory" ); } @@ -1307,11 +1179,8 @@ " MPU_xQueueTakeMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueTakeMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueTakeMutexRecursive ) : "memory" ); } @@ -1339,11 +1208,8 @@ " MPU_xQueueGiveMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGiveMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGiveMutexRecursive ) : "memory" ); } @@ -1373,11 +1239,8 @@ " MPU_xQueueSelectFromSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSelectFromSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSelectFromSet ) : "memory" ); } @@ -1407,11 +1270,8 @@ " MPU_xQueueAddToSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueAddToSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueAddToSet ) : "memory" ); } @@ -1441,11 +1301,8 @@ " MPU_vQueueAddToRegistry_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueAddToRegistryImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueAddToRegistry ) : "memory" ); } @@ -1473,11 +1330,8 @@ " MPU_vQueueUnregisterQueue_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueUnregisterQueueImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueUnregisterQueue ) : "memory" ); } @@ -1505,11 +1359,8 @@ " MPU_pcQueueGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcQueueGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcQueueGetName ) : "memory" ); } @@ -1537,11 +1388,8 @@ " MPU_pvTimerGetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTimerGetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTimerGetTimerID ) : "memory" ); } @@ -1571,11 +1419,8 @@ " MPU_vTimerSetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetTimerID ) : "memory" ); } @@ -1603,11 +1448,8 @@ " MPU_xTimerIsTimerActive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerIsTimerActiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerIsTimerActive ) : "memory" ); } @@ -1635,11 +1477,8 @@ " MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetTimerDaemonTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle ) : "memory" ); } @@ -1648,17 +1487,9 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1675,11 +1506,8 @@ " MPU_xTimerGenericCommandFromTask_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGenericCommandFromTaskImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGenericCommandFromTask ) : "memory" ); } @@ -1707,11 +1535,8 @@ " MPU_pcTimerGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcTimerGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcTimerGetName ) : "memory" ); } @@ -1741,11 +1566,8 @@ " MPU_vTimerSetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetReloadMode ) : "memory" ); } @@ -1773,11 +1595,8 @@ " MPU_xTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetReloadMode ) : "memory" ); } @@ -1805,11 +1624,8 @@ " MPU_uxTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTimerGetReloadMode ) : "memory" ); } @@ -1837,11 +1653,8 @@ " MPU_xTimerGetPeriod_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetPeriodImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetPeriod ) : "memory" ); } @@ -1869,28 +1682,17 @@ " MPU_xTimerGetExpiryTime_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetExpiryTimeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetExpiryTime ) : "memory" ); } #endif /* if ( configUSE_TIMERS == 1 ) */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1907,11 +1709,8 @@ " MPU_xEventGroupWaitBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupWaitBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupWaitBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1937,11 +1736,8 @@ " MPU_xEventGroupClearBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupClearBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupClearBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1967,11 +1763,8 @@ " MPU_xEventGroupSetBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSetBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSetBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2001,11 +1794,8 @@ " MPU_xEventGroupSync_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSyncImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSync ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2031,11 +1821,8 @@ " MPU_uxEventGroupGetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxEventGroupGetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxEventGroupGetNumber ) : "memory" ); } @@ -2065,11 +1852,8 @@ " MPU_vEventGroupSetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vEventGroupSetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vEventGroupSetNumber ) : "memory" ); } @@ -2101,11 +1885,8 @@ " MPU_xStreamBufferSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2135,11 +1916,8 @@ " MPU_xStreamBufferReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2163,11 +1941,8 @@ " MPU_xStreamBufferIsFull_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsFullImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsFull ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2191,11 +1966,8 @@ " MPU_xStreamBufferIsEmpty_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsEmptyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsEmpty ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2219,11 +1991,8 @@ " MPU_xStreamBufferSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2247,11 +2016,8 @@ " MPU_xStreamBufferBytesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferBytesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferBytesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2277,11 +2043,8 @@ " MPU_xStreamBufferSetTriggerLevel_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSetTriggerLevelImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSetTriggerLevel ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2305,11 +2068,8 @@ " MPU_xStreamBufferNextMessageLengthBytes_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferNextMessageLengthBytesImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferNextMessageLengthBytes ) : "memory" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM33_NTZ/non_secure/port.c b/portable/GCC/ARM_CM33_NTZ/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/GCC/ARM_CM33_NTZ/non_secure/port.c +++ b/portable/GCC/ARM_CM33_NTZ/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM33_NTZ/non_secure/portasm.c b/portable/GCC/ARM_CM33_NTZ/non_secure/portasm.c index e533dd7e9..76ba642a0 100644 --- a/portable/GCC/ARM_CM33_NTZ/non_secure/portasm.c +++ b/portable/GCC/ARM_CM33_NTZ/non_secure/portasm.c @@ -36,6 +36,9 @@ /* Portasm includes. */ #include "portasm.h" +/* System call numbers includes. */ +#include "mpu_syscall_numbers.h" + /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the * header files. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -443,7 +446,6 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att ".syntax unified \n" ".extern vPortSVCHandler_C \n" ".extern vSystemCallEnter \n" - ".extern vSystemCallEnter_1 \n" ".extern vSystemCallExit \n" " \n" "tst lr, #4 \n" @@ -454,10 +456,8 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att "ldr r1, [r0, #24] \n" "ldrb r2, [r1, #-2] \n" "cmp r2, %0 \n" - "beq syscall_enter \n" + "blt syscall_enter \n" "cmp r2, %1 \n" - "beq syscall_enter_1 \n" - "cmp r2, %2 \n" "beq syscall_exit \n" "b vPortSVCHandler_C \n" " \n" @@ -465,16 +465,12 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att " mov r1, lr \n" " b vSystemCallEnter \n" " \n" - "syscall_enter_1: \n" - " mov r1, lr \n" - " b vSystemCallEnter_1 \n" - " \n" "syscall_exit: \n" " mov r1, lr \n" " b vSystemCallExit \n" " \n" : /* No outputs. */ - : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) + : "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "r0", "r1", "r2", "memory" ); } diff --git a/portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM35P/non_secure/mpu_wrappers_v2_asm.c b/portable/GCC/ARM_CM35P/non_secure/mpu_wrappers_v2_asm.c index d1fbdc0e5..4cb310afd 100644 --- a/portable/GCC/ARM_CM35P/non_secure/mpu_wrappers_v2_asm.c +++ b/portable/GCC/ARM_CM35P/non_secure/mpu_wrappers_v2_asm.c @@ -38,6 +38,8 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -67,11 +69,8 @@ " MPU_xTaskDelayUntil_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskDelayUntilImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskDelayUntil ) : "memory" ); } @@ -99,11 +98,8 @@ " MPU_xTaskAbortDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskAbortDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskAbortDelay ) : "memory" ); } @@ -131,11 +127,8 @@ " MPU_vTaskDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskDelay ) : "memory" ); } @@ -163,11 +156,8 @@ " MPU_uxTaskPriorityGet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskPriorityGetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskPriorityGet ) : "memory" ); } @@ -195,11 +185,8 @@ " MPU_eTaskGetState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_eTaskGetStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_eTaskGetState ) : "memory" ); } @@ -233,11 +220,8 @@ " MPU_vTaskGetInfo_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskGetInfoImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskGetInfo ) : "memory" ); } @@ -265,11 +249,8 @@ " MPU_xTaskGetIdleTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetIdleTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetIdleTaskHandle ) : "memory" ); } @@ -297,11 +278,8 @@ " MPU_vTaskSuspend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSuspendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSuspend ) : "memory" ); } @@ -329,11 +307,8 @@ " MPU_vTaskResume_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskResumeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskResume ) : "memory" ); } @@ -359,11 +334,8 @@ " MPU_xTaskGetTickCount_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetTickCountImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetTickCount ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -387,11 +359,8 @@ " MPU_uxTaskGetNumberOfTasks_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetNumberOfTasksImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetNumberOfTasks ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -417,11 +386,8 @@ " MPU_ulTaskGetRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimeCounter ) : "memory" ); } @@ -449,11 +415,8 @@ " MPU_ulTaskGetRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimePercent ) : "memory" ); } @@ -481,11 +444,8 @@ " MPU_ulTaskGetIdleRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimePercent ) : "memory" ); } @@ -513,11 +473,8 @@ " MPU_ulTaskGetIdleRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimeCounter ) : "memory" ); } @@ -547,11 +504,8 @@ " MPU_vTaskSetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetApplicationTaskTag ) : "memory" ); } @@ -579,11 +533,8 @@ " MPU_xTaskGetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetApplicationTaskTag ) : "memory" ); } @@ -615,11 +566,8 @@ " MPU_vTaskSetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetThreadLocalStoragePointer ) : "memory" ); } @@ -649,11 +597,8 @@ " MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTaskGetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer ) : "memory" ); } @@ -685,11 +630,8 @@ " MPU_uxTaskGetSystemState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetSystemStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetSystemState ) : "memory" ); } @@ -717,11 +659,8 @@ " MPU_uxTaskGetStackHighWaterMark_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMarkImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark ) : "memory" ); } @@ -749,11 +688,8 @@ " MPU_uxTaskGetStackHighWaterMark2_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMark2Impl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark2 ) : "memory" ); } @@ -781,11 +717,8 @@ " MPU_xTaskGetCurrentTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetCurrentTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetCurrentTaskHandle ) : "memory" ); } @@ -813,11 +746,8 @@ " MPU_xTaskGetSchedulerState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetSchedulerStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetSchedulerState ) : "memory" ); } @@ -843,11 +773,8 @@ " MPU_vTaskSetTimeOutState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetTimeOutStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetTimeOutState ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -873,28 +800,17 @@ " MPU_xTaskCheckForTimeOut_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskCheckForTimeOutImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskCheckForTimeOut ) : "memory" ); } /*-----------------------------------------------------------*/ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -911,11 +827,8 @@ " MPU_xTaskGenericNotify_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotify ) : "memory" ); } @@ -924,17 +837,9 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -951,11 +856,8 @@ " MPU_xTaskGenericNotifyWait_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyWaitImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyWait ) : "memory" ); } @@ -987,11 +889,8 @@ " MPU_ulTaskGenericNotifyTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyTake ) : "memory" ); } @@ -1021,11 +920,8 @@ " MPU_xTaskGenericNotifyStateClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyStateClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyStateClear ) : "memory" ); } @@ -1057,11 +953,8 @@ " MPU_ulTaskGenericNotifyValueClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyValueClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyValueClear ) : "memory" ); } @@ -1093,11 +986,8 @@ " MPU_xQueueGenericSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGenericSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGenericSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1121,11 +1011,8 @@ " MPU_uxQueueMessagesWaiting_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueMessagesWaitingImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueMessagesWaiting ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1149,11 +1036,8 @@ " MPU_uxQueueSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1181,11 +1065,8 @@ " MPU_xQueueReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1213,11 +1094,8 @@ " MPU_xQueuePeek_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueuePeekImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueuePeek ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1243,11 +1121,8 @@ " MPU_xQueueSemaphoreTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSemaphoreTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSemaphoreTake ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1273,11 +1148,8 @@ " MPU_xQueueGetMutexHolder_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGetMutexHolderImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGetMutexHolder ) : "memory" ); } @@ -1307,11 +1179,8 @@ " MPU_xQueueTakeMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueTakeMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueTakeMutexRecursive ) : "memory" ); } @@ -1339,11 +1208,8 @@ " MPU_xQueueGiveMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGiveMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGiveMutexRecursive ) : "memory" ); } @@ -1373,11 +1239,8 @@ " MPU_xQueueSelectFromSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSelectFromSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSelectFromSet ) : "memory" ); } @@ -1407,11 +1270,8 @@ " MPU_xQueueAddToSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueAddToSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueAddToSet ) : "memory" ); } @@ -1441,11 +1301,8 @@ " MPU_vQueueAddToRegistry_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueAddToRegistryImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueAddToRegistry ) : "memory" ); } @@ -1473,11 +1330,8 @@ " MPU_vQueueUnregisterQueue_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueUnregisterQueueImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueUnregisterQueue ) : "memory" ); } @@ -1505,11 +1359,8 @@ " MPU_pcQueueGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcQueueGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcQueueGetName ) : "memory" ); } @@ -1537,11 +1388,8 @@ " MPU_pvTimerGetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTimerGetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTimerGetTimerID ) : "memory" ); } @@ -1571,11 +1419,8 @@ " MPU_vTimerSetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetTimerID ) : "memory" ); } @@ -1603,11 +1448,8 @@ " MPU_xTimerIsTimerActive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerIsTimerActiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerIsTimerActive ) : "memory" ); } @@ -1635,11 +1477,8 @@ " MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetTimerDaemonTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle ) : "memory" ); } @@ -1648,17 +1487,9 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1675,11 +1506,8 @@ " MPU_xTimerGenericCommandFromTask_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGenericCommandFromTaskImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGenericCommandFromTask ) : "memory" ); } @@ -1707,11 +1535,8 @@ " MPU_pcTimerGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcTimerGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcTimerGetName ) : "memory" ); } @@ -1741,11 +1566,8 @@ " MPU_vTimerSetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetReloadMode ) : "memory" ); } @@ -1773,11 +1595,8 @@ " MPU_xTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetReloadMode ) : "memory" ); } @@ -1805,11 +1624,8 @@ " MPU_uxTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTimerGetReloadMode ) : "memory" ); } @@ -1837,11 +1653,8 @@ " MPU_xTimerGetPeriod_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetPeriodImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetPeriod ) : "memory" ); } @@ -1869,28 +1682,17 @@ " MPU_xTimerGetExpiryTime_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetExpiryTimeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetExpiryTime ) : "memory" ); } #endif /* if ( configUSE_TIMERS == 1 ) */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1907,11 +1709,8 @@ " MPU_xEventGroupWaitBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupWaitBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupWaitBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1937,11 +1736,8 @@ " MPU_xEventGroupClearBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupClearBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupClearBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1967,11 +1763,8 @@ " MPU_xEventGroupSetBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSetBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSetBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2001,11 +1794,8 @@ " MPU_xEventGroupSync_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSyncImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSync ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2031,11 +1821,8 @@ " MPU_uxEventGroupGetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxEventGroupGetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxEventGroupGetNumber ) : "memory" ); } @@ -2065,11 +1852,8 @@ " MPU_vEventGroupSetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vEventGroupSetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vEventGroupSetNumber ) : "memory" ); } @@ -2101,11 +1885,8 @@ " MPU_xStreamBufferSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2135,11 +1916,8 @@ " MPU_xStreamBufferReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2163,11 +1941,8 @@ " MPU_xStreamBufferIsFull_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsFullImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsFull ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2191,11 +1966,8 @@ " MPU_xStreamBufferIsEmpty_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsEmptyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsEmpty ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2219,11 +1991,8 @@ " MPU_xStreamBufferSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2247,11 +2016,8 @@ " MPU_xStreamBufferBytesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferBytesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferBytesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2277,11 +2043,8 @@ " MPU_xStreamBufferSetTriggerLevel_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSetTriggerLevelImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSetTriggerLevel ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2305,11 +2068,8 @@ " MPU_xStreamBufferNextMessageLengthBytes_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferNextMessageLengthBytesImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferNextMessageLengthBytes ) : "memory" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM35P/non_secure/port.c b/portable/GCC/ARM_CM35P/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/GCC/ARM_CM35P/non_secure/port.c +++ b/portable/GCC/ARM_CM35P/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM35P/non_secure/portasm.c b/portable/GCC/ARM_CM35P/non_secure/portasm.c index ba8f6c62d..16c598ad7 100644 --- a/portable/GCC/ARM_CM35P/non_secure/portasm.c +++ b/portable/GCC/ARM_CM35P/non_secure/portasm.c @@ -36,6 +36,9 @@ /* Portasm includes. */ #include "portasm.h" +/* System call numbers includes. */ +#include "mpu_syscall_numbers.h" + /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the * header files. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -522,7 +525,6 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att ".syntax unified \n" ".extern vPortSVCHandler_C \n" ".extern vSystemCallEnter \n" - ".extern vSystemCallEnter_1 \n" ".extern vSystemCallExit \n" " \n" "tst lr, #4 \n" @@ -533,10 +535,8 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att "ldr r1, [r0, #24] \n" "ldrb r2, [r1, #-2] \n" "cmp r2, %0 \n" - "beq syscall_enter \n" + "blt syscall_enter \n" "cmp r2, %1 \n" - "beq syscall_enter_1 \n" - "cmp r2, %2 \n" "beq syscall_exit \n" "b vPortSVCHandler_C \n" " \n" @@ -544,16 +544,12 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att " mov r1, lr \n" " b vSystemCallEnter \n" " \n" - "syscall_enter_1: \n" - " mov r1, lr \n" - " b vSystemCallEnter_1 \n" - " \n" "syscall_exit: \n" " mov r1, lr \n" " b vSystemCallExit \n" " \n" : /* No outputs. */ - : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) + : "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "r0", "r1", "r2", "memory" ); } diff --git a/portable/GCC/ARM_CM35P/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM35P/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/GCC/ARM_CM35P/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM35P/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM35P_NTZ/non_secure/mpu_wrappers_v2_asm.c b/portable/GCC/ARM_CM35P_NTZ/non_secure/mpu_wrappers_v2_asm.c index d1fbdc0e5..4cb310afd 100644 --- a/portable/GCC/ARM_CM35P_NTZ/non_secure/mpu_wrappers_v2_asm.c +++ b/portable/GCC/ARM_CM35P_NTZ/non_secure/mpu_wrappers_v2_asm.c @@ -38,6 +38,8 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -67,11 +69,8 @@ " MPU_xTaskDelayUntil_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskDelayUntilImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskDelayUntil ) : "memory" ); } @@ -99,11 +98,8 @@ " MPU_xTaskAbortDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskAbortDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskAbortDelay ) : "memory" ); } @@ -131,11 +127,8 @@ " MPU_vTaskDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskDelay ) : "memory" ); } @@ -163,11 +156,8 @@ " MPU_uxTaskPriorityGet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskPriorityGetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskPriorityGet ) : "memory" ); } @@ -195,11 +185,8 @@ " MPU_eTaskGetState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_eTaskGetStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_eTaskGetState ) : "memory" ); } @@ -233,11 +220,8 @@ " MPU_vTaskGetInfo_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskGetInfoImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskGetInfo ) : "memory" ); } @@ -265,11 +249,8 @@ " MPU_xTaskGetIdleTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetIdleTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetIdleTaskHandle ) : "memory" ); } @@ -297,11 +278,8 @@ " MPU_vTaskSuspend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSuspendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSuspend ) : "memory" ); } @@ -329,11 +307,8 @@ " MPU_vTaskResume_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskResumeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskResume ) : "memory" ); } @@ -359,11 +334,8 @@ " MPU_xTaskGetTickCount_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetTickCountImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetTickCount ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -387,11 +359,8 @@ " MPU_uxTaskGetNumberOfTasks_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetNumberOfTasksImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetNumberOfTasks ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -417,11 +386,8 @@ " MPU_ulTaskGetRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimeCounter ) : "memory" ); } @@ -449,11 +415,8 @@ " MPU_ulTaskGetRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimePercent ) : "memory" ); } @@ -481,11 +444,8 @@ " MPU_ulTaskGetIdleRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimePercent ) : "memory" ); } @@ -513,11 +473,8 @@ " MPU_ulTaskGetIdleRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimeCounter ) : "memory" ); } @@ -547,11 +504,8 @@ " MPU_vTaskSetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetApplicationTaskTag ) : "memory" ); } @@ -579,11 +533,8 @@ " MPU_xTaskGetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetApplicationTaskTag ) : "memory" ); } @@ -615,11 +566,8 @@ " MPU_vTaskSetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetThreadLocalStoragePointer ) : "memory" ); } @@ -649,11 +597,8 @@ " MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTaskGetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer ) : "memory" ); } @@ -685,11 +630,8 @@ " MPU_uxTaskGetSystemState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetSystemStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetSystemState ) : "memory" ); } @@ -717,11 +659,8 @@ " MPU_uxTaskGetStackHighWaterMark_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMarkImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark ) : "memory" ); } @@ -749,11 +688,8 @@ " MPU_uxTaskGetStackHighWaterMark2_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMark2Impl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark2 ) : "memory" ); } @@ -781,11 +717,8 @@ " MPU_xTaskGetCurrentTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetCurrentTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetCurrentTaskHandle ) : "memory" ); } @@ -813,11 +746,8 @@ " MPU_xTaskGetSchedulerState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetSchedulerStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetSchedulerState ) : "memory" ); } @@ -843,11 +773,8 @@ " MPU_vTaskSetTimeOutState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetTimeOutStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetTimeOutState ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -873,28 +800,17 @@ " MPU_xTaskCheckForTimeOut_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskCheckForTimeOutImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskCheckForTimeOut ) : "memory" ); } /*-----------------------------------------------------------*/ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -911,11 +827,8 @@ " MPU_xTaskGenericNotify_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotify ) : "memory" ); } @@ -924,17 +837,9 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -951,11 +856,8 @@ " MPU_xTaskGenericNotifyWait_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyWaitImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyWait ) : "memory" ); } @@ -987,11 +889,8 @@ " MPU_ulTaskGenericNotifyTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyTake ) : "memory" ); } @@ -1021,11 +920,8 @@ " MPU_xTaskGenericNotifyStateClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyStateClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyStateClear ) : "memory" ); } @@ -1057,11 +953,8 @@ " MPU_ulTaskGenericNotifyValueClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyValueClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyValueClear ) : "memory" ); } @@ -1093,11 +986,8 @@ " MPU_xQueueGenericSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGenericSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGenericSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1121,11 +1011,8 @@ " MPU_uxQueueMessagesWaiting_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueMessagesWaitingImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueMessagesWaiting ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1149,11 +1036,8 @@ " MPU_uxQueueSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1181,11 +1065,8 @@ " MPU_xQueueReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1213,11 +1094,8 @@ " MPU_xQueuePeek_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueuePeekImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueuePeek ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1243,11 +1121,8 @@ " MPU_xQueueSemaphoreTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSemaphoreTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSemaphoreTake ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1273,11 +1148,8 @@ " MPU_xQueueGetMutexHolder_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGetMutexHolderImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGetMutexHolder ) : "memory" ); } @@ -1307,11 +1179,8 @@ " MPU_xQueueTakeMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueTakeMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueTakeMutexRecursive ) : "memory" ); } @@ -1339,11 +1208,8 @@ " MPU_xQueueGiveMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGiveMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGiveMutexRecursive ) : "memory" ); } @@ -1373,11 +1239,8 @@ " MPU_xQueueSelectFromSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSelectFromSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSelectFromSet ) : "memory" ); } @@ -1407,11 +1270,8 @@ " MPU_xQueueAddToSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueAddToSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueAddToSet ) : "memory" ); } @@ -1441,11 +1301,8 @@ " MPU_vQueueAddToRegistry_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueAddToRegistryImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueAddToRegistry ) : "memory" ); } @@ -1473,11 +1330,8 @@ " MPU_vQueueUnregisterQueue_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueUnregisterQueueImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueUnregisterQueue ) : "memory" ); } @@ -1505,11 +1359,8 @@ " MPU_pcQueueGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcQueueGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcQueueGetName ) : "memory" ); } @@ -1537,11 +1388,8 @@ " MPU_pvTimerGetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTimerGetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTimerGetTimerID ) : "memory" ); } @@ -1571,11 +1419,8 @@ " MPU_vTimerSetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetTimerID ) : "memory" ); } @@ -1603,11 +1448,8 @@ " MPU_xTimerIsTimerActive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerIsTimerActiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerIsTimerActive ) : "memory" ); } @@ -1635,11 +1477,8 @@ " MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetTimerDaemonTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle ) : "memory" ); } @@ -1648,17 +1487,9 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1675,11 +1506,8 @@ " MPU_xTimerGenericCommandFromTask_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGenericCommandFromTaskImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGenericCommandFromTask ) : "memory" ); } @@ -1707,11 +1535,8 @@ " MPU_pcTimerGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcTimerGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcTimerGetName ) : "memory" ); } @@ -1741,11 +1566,8 @@ " MPU_vTimerSetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetReloadMode ) : "memory" ); } @@ -1773,11 +1595,8 @@ " MPU_xTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetReloadMode ) : "memory" ); } @@ -1805,11 +1624,8 @@ " MPU_uxTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTimerGetReloadMode ) : "memory" ); } @@ -1837,11 +1653,8 @@ " MPU_xTimerGetPeriod_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetPeriodImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetPeriod ) : "memory" ); } @@ -1869,28 +1682,17 @@ " MPU_xTimerGetExpiryTime_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetExpiryTimeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetExpiryTime ) : "memory" ); } #endif /* if ( configUSE_TIMERS == 1 ) */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1907,11 +1709,8 @@ " MPU_xEventGroupWaitBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupWaitBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupWaitBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1937,11 +1736,8 @@ " MPU_xEventGroupClearBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupClearBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupClearBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1967,11 +1763,8 @@ " MPU_xEventGroupSetBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSetBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSetBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2001,11 +1794,8 @@ " MPU_xEventGroupSync_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSyncImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSync ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2031,11 +1821,8 @@ " MPU_uxEventGroupGetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxEventGroupGetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxEventGroupGetNumber ) : "memory" ); } @@ -2065,11 +1852,8 @@ " MPU_vEventGroupSetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vEventGroupSetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vEventGroupSetNumber ) : "memory" ); } @@ -2101,11 +1885,8 @@ " MPU_xStreamBufferSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2135,11 +1916,8 @@ " MPU_xStreamBufferReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2163,11 +1941,8 @@ " MPU_xStreamBufferIsFull_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsFullImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsFull ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2191,11 +1966,8 @@ " MPU_xStreamBufferIsEmpty_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsEmptyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsEmpty ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2219,11 +1991,8 @@ " MPU_xStreamBufferSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2247,11 +2016,8 @@ " MPU_xStreamBufferBytesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferBytesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferBytesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2277,11 +2043,8 @@ " MPU_xStreamBufferSetTriggerLevel_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSetTriggerLevelImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSetTriggerLevel ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2305,11 +2068,8 @@ " MPU_xStreamBufferNextMessageLengthBytes_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferNextMessageLengthBytesImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferNextMessageLengthBytes ) : "memory" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM35P_NTZ/non_secure/port.c b/portable/GCC/ARM_CM35P_NTZ/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/GCC/ARM_CM35P_NTZ/non_secure/port.c +++ b/portable/GCC/ARM_CM35P_NTZ/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM35P_NTZ/non_secure/portasm.c b/portable/GCC/ARM_CM35P_NTZ/non_secure/portasm.c index e533dd7e9..76ba642a0 100644 --- a/portable/GCC/ARM_CM35P_NTZ/non_secure/portasm.c +++ b/portable/GCC/ARM_CM35P_NTZ/non_secure/portasm.c @@ -36,6 +36,9 @@ /* Portasm includes. */ #include "portasm.h" +/* System call numbers includes. */ +#include "mpu_syscall_numbers.h" + /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the * header files. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -443,7 +446,6 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att ".syntax unified \n" ".extern vPortSVCHandler_C \n" ".extern vSystemCallEnter \n" - ".extern vSystemCallEnter_1 \n" ".extern vSystemCallExit \n" " \n" "tst lr, #4 \n" @@ -454,10 +456,8 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att "ldr r1, [r0, #24] \n" "ldrb r2, [r1, #-2] \n" "cmp r2, %0 \n" - "beq syscall_enter \n" + "blt syscall_enter \n" "cmp r2, %1 \n" - "beq syscall_enter_1 \n" - "cmp r2, %2 \n" "beq syscall_exit \n" "b vPortSVCHandler_C \n" " \n" @@ -465,16 +465,12 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att " mov r1, lr \n" " b vSystemCallEnter \n" " \n" - "syscall_enter_1: \n" - " mov r1, lr \n" - " b vSystemCallEnter_1 \n" - " \n" "syscall_exit: \n" " mov r1, lr \n" " b vSystemCallExit \n" " \n" : /* No outputs. */ - : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) + : "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "r0", "r1", "r2", "memory" ); } diff --git a/portable/GCC/ARM_CM35P_NTZ/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM35P_NTZ/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/GCC/ARM_CM35P_NTZ/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM35P_NTZ/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM3_MPU/mpu_wrappers_v2_asm.c b/portable/GCC/ARM_CM3_MPU/mpu_wrappers_v2_asm.c index 9a8cf55eb..6b76b376c 100644 --- a/portable/GCC/ARM_CM3_MPU/mpu_wrappers_v2_asm.c +++ b/portable/GCC/ARM_CM3_MPU/mpu_wrappers_v2_asm.c @@ -38,6 +38,8 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -67,11 +69,8 @@ " MPU_xTaskDelayUntil_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskDelayUntilImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskDelayUntil ) : "memory" ); } @@ -99,11 +98,8 @@ " MPU_xTaskAbortDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskAbortDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskAbortDelay ) : "memory" ); } @@ -131,11 +127,8 @@ " MPU_vTaskDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskDelay ) : "memory" ); } @@ -163,11 +156,8 @@ " MPU_uxTaskPriorityGet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskPriorityGetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskPriorityGet ) : "memory" ); } @@ -195,11 +185,8 @@ " MPU_eTaskGetState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_eTaskGetStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_eTaskGetState ) : "memory" ); } @@ -233,11 +220,8 @@ " MPU_vTaskGetInfo_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskGetInfoImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskGetInfo ) : "memory" ); } @@ -265,11 +249,8 @@ " MPU_xTaskGetIdleTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetIdleTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetIdleTaskHandle ) : "memory" ); } @@ -297,11 +278,8 @@ " MPU_vTaskSuspend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSuspendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSuspend ) : "memory" ); } @@ -329,11 +307,8 @@ " MPU_vTaskResume_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskResumeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskResume ) : "memory" ); } @@ -359,11 +334,8 @@ " MPU_xTaskGetTickCount_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetTickCountImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetTickCount ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -387,11 +359,8 @@ " MPU_uxTaskGetNumberOfTasks_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetNumberOfTasksImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetNumberOfTasks ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -417,11 +386,8 @@ " MPU_ulTaskGetRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimeCounter ) : "memory" ); } @@ -449,11 +415,8 @@ " MPU_ulTaskGetRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimePercent ) : "memory" ); } @@ -481,11 +444,8 @@ " MPU_ulTaskGetIdleRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimePercent ) : "memory" ); } @@ -513,11 +473,8 @@ " MPU_ulTaskGetIdleRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimeCounter ) : "memory" ); } @@ -547,11 +504,8 @@ " MPU_vTaskSetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetApplicationTaskTag ) : "memory" ); } @@ -579,11 +533,8 @@ " MPU_xTaskGetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetApplicationTaskTag ) : "memory" ); } @@ -615,11 +566,8 @@ " MPU_vTaskSetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetThreadLocalStoragePointer ) : "memory" ); } @@ -649,11 +597,8 @@ " MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTaskGetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer ) : "memory" ); } @@ -685,11 +630,8 @@ " MPU_uxTaskGetSystemState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetSystemStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetSystemState ) : "memory" ); } @@ -717,11 +659,8 @@ " MPU_uxTaskGetStackHighWaterMark_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMarkImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark ) : "memory" ); } @@ -749,11 +688,8 @@ " MPU_uxTaskGetStackHighWaterMark2_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMark2Impl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark2 ) : "memory" ); } @@ -781,11 +717,8 @@ " MPU_xTaskGetCurrentTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetCurrentTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetCurrentTaskHandle ) : "memory" ); } @@ -813,11 +746,8 @@ " MPU_xTaskGetSchedulerState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetSchedulerStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetSchedulerState ) : "memory" ); } @@ -843,11 +773,8 @@ " MPU_vTaskSetTimeOutState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetTimeOutStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetTimeOutState ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -873,28 +800,17 @@ " MPU_xTaskCheckForTimeOut_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskCheckForTimeOutImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskCheckForTimeOut ) : "memory" ); } /*-----------------------------------------------------------*/ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -911,11 +827,8 @@ " MPU_xTaskGenericNotify_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotify ) : "memory" ); } @@ -924,17 +837,9 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -951,11 +856,8 @@ " MPU_xTaskGenericNotifyWait_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyWaitImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyWait ) : "memory" ); } @@ -987,11 +889,8 @@ " MPU_ulTaskGenericNotifyTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyTake ) : "memory" ); } @@ -1021,11 +920,8 @@ " MPU_xTaskGenericNotifyStateClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyStateClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyStateClear ) : "memory" ); } @@ -1057,11 +953,8 @@ " MPU_ulTaskGenericNotifyValueClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyValueClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyValueClear ) : "memory" ); } @@ -1093,11 +986,8 @@ " MPU_xQueueGenericSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGenericSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGenericSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1121,11 +1011,8 @@ " MPU_uxQueueMessagesWaiting_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueMessagesWaitingImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueMessagesWaiting ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1149,11 +1036,8 @@ " MPU_uxQueueSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1181,11 +1065,8 @@ " MPU_xQueueReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1213,11 +1094,8 @@ " MPU_xQueuePeek_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueuePeekImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueuePeek ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1243,11 +1121,8 @@ " MPU_xQueueSemaphoreTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSemaphoreTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSemaphoreTake ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1273,11 +1148,8 @@ " MPU_xQueueGetMutexHolder_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGetMutexHolderImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGetMutexHolder ) : "memory" ); } @@ -1307,11 +1179,8 @@ " MPU_xQueueTakeMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueTakeMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueTakeMutexRecursive ) : "memory" ); } @@ -1339,11 +1208,8 @@ " MPU_xQueueGiveMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGiveMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGiveMutexRecursive ) : "memory" ); } @@ -1373,11 +1239,8 @@ " MPU_xQueueSelectFromSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSelectFromSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSelectFromSet ) : "memory" ); } @@ -1407,11 +1270,8 @@ " MPU_xQueueAddToSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueAddToSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueAddToSet ) : "memory" ); } @@ -1441,11 +1301,8 @@ " MPU_vQueueAddToRegistry_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueAddToRegistryImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueAddToRegistry ) : "memory" ); } @@ -1473,11 +1330,8 @@ " MPU_vQueueUnregisterQueue_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueUnregisterQueueImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueUnregisterQueue ) : "memory" ); } @@ -1505,11 +1359,8 @@ " MPU_pcQueueGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcQueueGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcQueueGetName ) : "memory" ); } @@ -1537,11 +1388,8 @@ " MPU_pvTimerGetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTimerGetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTimerGetTimerID ) : "memory" ); } @@ -1571,11 +1419,8 @@ " MPU_vTimerSetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetTimerID ) : "memory" ); } @@ -1603,11 +1448,8 @@ " MPU_xTimerIsTimerActive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerIsTimerActiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerIsTimerActive ) : "memory" ); } @@ -1635,11 +1477,8 @@ " MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetTimerDaemonTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle ) : "memory" ); } @@ -1648,17 +1487,9 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1675,11 +1506,8 @@ " MPU_xTimerGenericCommandFromTask_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGenericCommandFromTaskImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGenericCommandFromTask ) : "memory" ); } @@ -1707,11 +1535,8 @@ " MPU_pcTimerGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcTimerGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcTimerGetName ) : "memory" ); } @@ -1741,11 +1566,8 @@ " MPU_vTimerSetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetReloadMode ) : "memory" ); } @@ -1773,11 +1595,8 @@ " MPU_xTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetReloadMode ) : "memory" ); } @@ -1805,11 +1624,8 @@ " MPU_uxTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTimerGetReloadMode ) : "memory" ); } @@ -1837,11 +1653,8 @@ " MPU_xTimerGetPeriod_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetPeriodImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetPeriod ) : "memory" ); } @@ -1869,28 +1682,17 @@ " MPU_xTimerGetExpiryTime_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetExpiryTimeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetExpiryTime ) : "memory" ); } #endif /* if ( configUSE_TIMERS == 1 ) */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1907,11 +1709,8 @@ " MPU_xEventGroupWaitBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupWaitBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupWaitBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1937,11 +1736,8 @@ " MPU_xEventGroupClearBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupClearBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupClearBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1967,11 +1763,8 @@ " MPU_xEventGroupSetBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSetBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSetBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2001,11 +1794,8 @@ " MPU_xEventGroupSync_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSyncImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSync ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2031,11 +1821,8 @@ " MPU_uxEventGroupGetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxEventGroupGetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxEventGroupGetNumber ) : "memory" ); } @@ -2065,11 +1852,8 @@ " MPU_vEventGroupSetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vEventGroupSetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vEventGroupSetNumber ) : "memory" ); } @@ -2101,11 +1885,8 @@ " MPU_xStreamBufferSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2135,11 +1916,8 @@ " MPU_xStreamBufferReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2163,11 +1941,8 @@ " MPU_xStreamBufferIsFull_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsFullImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsFull ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2191,11 +1966,8 @@ " MPU_xStreamBufferIsEmpty_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsEmptyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsEmpty ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2219,11 +1991,8 @@ " MPU_xStreamBufferSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2247,11 +2016,8 @@ " MPU_xStreamBufferBytesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferBytesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferBytesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2277,11 +2043,8 @@ " MPU_xStreamBufferSetTriggerLevel_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSetTriggerLevelImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSetTriggerLevel ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2305,11 +2068,8 @@ " MPU_xStreamBufferNextMessageLengthBytes_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferNextMessageLengthBytesImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferNextMessageLengthBytes ) : "memory" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM3_MPU/port.c b/portable/GCC/ARM_CM3_MPU/port.c index ea2b9355e..1b774bdc7 100644 --- a/portable/GCC/ARM_CM3_MPU/port.c +++ b/portable/GCC/ARM_CM3_MPU/port.c @@ -38,6 +38,7 @@ /* Scheduler includes. */ #include "FreeRTOS.h" #include "task.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -214,25 +215,20 @@ void vPortSwitchToUserMode( void ); * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. + * @param ucSystemCallNumber The system call number of the system call. */ - void vSystemCallEnter( uint32_t * pulTaskStack ) PRIVILEGED_FUNCTION; + void vSystemCallEnter( uint32_t * pulTaskStack, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -261,6 +257,15 @@ BaseType_t xPortIsTaskPrivileged( void ) PRIVILEGED_FUNCTION; * switches can only occur when uxCriticalNesting is zero. */ static UBaseType_t uxCriticalNesting = 0xaaaaaaaa; +#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/* + * This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /* * Used by the portASSERT_IF_INTERRUPT_PRIORITY_INVALID() macro to ensure * FreeRTOS API functions are not called from interrupts that have been assigned @@ -338,7 +343,6 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack, ".syntax unified \n" ".extern vSVCHandler_C \n" ".extern vSystemCallEnter \n" - ".extern vSystemCallEnter_1 \n" ".extern vSystemCallExit \n" " \n" "tst lr, #4 \n" @@ -346,18 +350,16 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack, "mrseq r0, msp \n" "mrsne r0, psp \n" " \n" - "ldr r1, [r0, #24] \n" - "ldrb r2, [r1, #-2] \n" - "cmp r2, %0 \n" - "beq vSystemCallEnter \n" - "cmp r2, %1 \n" - "beq vSystemCallEnter_1 \n" - "cmp r2, %2 \n" + "ldr r2, [r0, #24] \n" + "ldrb r1, [r2, #-2] \n" + "cmp r1, %0 \n" + "blt vSystemCallEnter \n" + "cmp r1, %1 \n" "beq vSystemCallExit \n" "b vSVCHandler_C \n" " \n" : /* No outputs. */ - : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) + : "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "r0", "r1", "r2", "memory" ); } @@ -390,7 +392,7 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ uint8_t ucSVCNumber; uint32_t ulPC; - #if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) + #if ( ( configUSE_MPU_WRAPPERS_V1 == 1 ) && ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) ) #if defined( __ARMCC_VERSION ) /* Declaration when these variable are defined in code instead of being @@ -402,7 +404,7 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ extern uint32_t __syscalls_flash_start__[]; extern uint32_t __syscalls_flash_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ - #endif /* #if( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ + #endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 1 ) && ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) ) */ /* The stack contains: r0, r1, r2, r3, r12, LR, PC and xPSR. The first * argument (r0) is pulParam[ 0 ]. */ @@ -428,26 +430,15 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ break; - #if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) - case portSVC_RAISE_PRIVILEGE: /* Only raise the privilege, if the - * svc was raised from any of the - * system calls. */ + #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) + #if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) + case portSVC_RAISE_PRIVILEGE: /* Only raise the privilege, if the + * svc was raised from any of the + * system calls. */ - if( ( ulPC >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulPC <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - __asm volatile - ( - " mrs r1, control \n" /* Obtain current control value. */ - " bic r1, #1 \n" /* Set privilege bit. */ - " msr control, r1 \n" /* Write back new control value. */ - ::: "r1", "memory" - ); - } - - break; - #else /* if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ - case portSVC_RAISE_PRIVILEGE: + if( ( ulPC >= ( uint32_t ) __syscalls_flash_start__ ) && + ( ulPC <= ( uint32_t ) __syscalls_flash_end__ ) ) + { __asm volatile ( " mrs r1, control \n" /* Obtain current control value. */ @@ -455,27 +446,41 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ " msr control, r1 \n" /* Write back new control value. */ ::: "r1", "memory" ); - break; - #endif /* #if( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ + } - default: /* Unknown SVC call. */ - break; + break; + #else /* if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ + case portSVC_RAISE_PRIVILEGE: + __asm volatile + ( + " mrs r1, control \n" /* Obtain current control value. */ + " bic r1, #1 \n" /* Set privilege bit. */ + " msr control, r1 \n" /* Write back new control value. */ + ::: "r1", "memory" + ); + break; + #endif /* #if( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ + #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) */ + + default: /* Unknown SVC call. */ + break; } } /*-----------------------------------------------------------*/ #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) - void vSystemCallEnter( uint32_t * pulTaskStack ) /* PRIVILEGED_FUNCTION */ + void vSystemCallEnter( uint32_t * pulTaskStack, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulSystemCallLocation, i; const uint32_t ulStackFrameSize = 8; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -487,17 +492,27 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - /* Make space on the system call stack for the stack frame. */ pulSystemCallStack = pulSystemCallStack - ulStackFrameSize; @@ -522,10 +537,18 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - /* Store the value of the Link Register before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Record if the hardware used padding to force the stack pointer * to be double word aligned. */ if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) @@ -549,92 +572,9 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) - void vSystemCallEnter_1( uint32_t * pulTaskStack ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulSystemCallLocation, i; - const uint32_t ulStackFrameSize = 8; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r1, control \n" /* Obtain current control value. */ - " bic r1, #1 \n" /* Clear nPRIV bit. */ - " msr control, r1 \n" /* Write back new control value. */ - ::: "r1", "memory" - ); - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* Store the value of the Link Register before the SVC was raised. We need to - * restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -651,24 +591,32 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ const uint32_t ulStackFrameSize = 8; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; /* Make space on the task stack for the stack frame. */ @@ -691,8 +639,10 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ ::: "r1", "memory" ); - /* Restore the stacked link register to what it was at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; /* If the hardware used padding to force the stack pointer @@ -887,6 +837,12 @@ BaseType_t xPortStartScheduler( void ) /* Initialise the critical nesting count ready for the first task. */ uxCriticalNesting = 0; + #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ __asm volatile ( " ldr r0, =0xE000ED08 \n" /* Use the NVIC offset register to locate the stack. */ @@ -1494,21 +1450,34 @@ BaseType_t xPortIsAuthorizedToAccessBuffer( const void * pvBuffer, { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; diff --git a/portable/GCC/ARM_CM3_MPU/portmacro.h b/portable/GCC/ARM_CM3_MPU/portmacro.h index d0822e144..5983c7912 100644 --- a/portable/GCC/ARM_CM3_MPU/portmacro.h +++ b/portable/GCC/ARM_CM3_MPU/portmacro.h @@ -157,12 +157,10 @@ typedef struct MPU_SETTINGS /*-----------------------------------------------------------*/ /* SVC numbers for various services. */ -#define portSVC_START_SCHEDULER 0 -#define portSVC_YIELD 1 -#define portSVC_RAISE_PRIVILEGE 2 -#define portSVC_SYSTEM_CALL_ENTER 3 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 4 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 5 +#define portSVC_START_SCHEDULER 100 +#define portSVC_YIELD 101 +#define portSVC_RAISE_PRIVILEGE 102 +#define portSVC_SYSTEM_CALL_EXIT 103 /* Scheduler utilities. */ diff --git a/portable/GCC/ARM_CM4_MPU/mpu_wrappers_v2_asm.c b/portable/GCC/ARM_CM4_MPU/mpu_wrappers_v2_asm.c index 9a8cf55eb..6b76b376c 100644 --- a/portable/GCC/ARM_CM4_MPU/mpu_wrappers_v2_asm.c +++ b/portable/GCC/ARM_CM4_MPU/mpu_wrappers_v2_asm.c @@ -38,6 +38,8 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -67,11 +69,8 @@ " MPU_xTaskDelayUntil_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskDelayUntilImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskDelayUntil ) : "memory" ); } @@ -99,11 +98,8 @@ " MPU_xTaskAbortDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskAbortDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskAbortDelay ) : "memory" ); } @@ -131,11 +127,8 @@ " MPU_vTaskDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskDelay ) : "memory" ); } @@ -163,11 +156,8 @@ " MPU_uxTaskPriorityGet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskPriorityGetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskPriorityGet ) : "memory" ); } @@ -195,11 +185,8 @@ " MPU_eTaskGetState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_eTaskGetStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_eTaskGetState ) : "memory" ); } @@ -233,11 +220,8 @@ " MPU_vTaskGetInfo_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskGetInfoImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskGetInfo ) : "memory" ); } @@ -265,11 +249,8 @@ " MPU_xTaskGetIdleTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetIdleTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetIdleTaskHandle ) : "memory" ); } @@ -297,11 +278,8 @@ " MPU_vTaskSuspend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSuspendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSuspend ) : "memory" ); } @@ -329,11 +307,8 @@ " MPU_vTaskResume_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskResumeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskResume ) : "memory" ); } @@ -359,11 +334,8 @@ " MPU_xTaskGetTickCount_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetTickCountImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetTickCount ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -387,11 +359,8 @@ " MPU_uxTaskGetNumberOfTasks_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetNumberOfTasksImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetNumberOfTasks ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -417,11 +386,8 @@ " MPU_ulTaskGetRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimeCounter ) : "memory" ); } @@ -449,11 +415,8 @@ " MPU_ulTaskGetRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimePercent ) : "memory" ); } @@ -481,11 +444,8 @@ " MPU_ulTaskGetIdleRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimePercent ) : "memory" ); } @@ -513,11 +473,8 @@ " MPU_ulTaskGetIdleRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimeCounter ) : "memory" ); } @@ -547,11 +504,8 @@ " MPU_vTaskSetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetApplicationTaskTag ) : "memory" ); } @@ -579,11 +533,8 @@ " MPU_xTaskGetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetApplicationTaskTag ) : "memory" ); } @@ -615,11 +566,8 @@ " MPU_vTaskSetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetThreadLocalStoragePointer ) : "memory" ); } @@ -649,11 +597,8 @@ " MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTaskGetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer ) : "memory" ); } @@ -685,11 +630,8 @@ " MPU_uxTaskGetSystemState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetSystemStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetSystemState ) : "memory" ); } @@ -717,11 +659,8 @@ " MPU_uxTaskGetStackHighWaterMark_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMarkImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark ) : "memory" ); } @@ -749,11 +688,8 @@ " MPU_uxTaskGetStackHighWaterMark2_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMark2Impl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark2 ) : "memory" ); } @@ -781,11 +717,8 @@ " MPU_xTaskGetCurrentTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetCurrentTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetCurrentTaskHandle ) : "memory" ); } @@ -813,11 +746,8 @@ " MPU_xTaskGetSchedulerState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetSchedulerStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetSchedulerState ) : "memory" ); } @@ -843,11 +773,8 @@ " MPU_vTaskSetTimeOutState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetTimeOutStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetTimeOutState ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -873,28 +800,17 @@ " MPU_xTaskCheckForTimeOut_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskCheckForTimeOutImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskCheckForTimeOut ) : "memory" ); } /*-----------------------------------------------------------*/ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -911,11 +827,8 @@ " MPU_xTaskGenericNotify_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotify ) : "memory" ); } @@ -924,17 +837,9 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -951,11 +856,8 @@ " MPU_xTaskGenericNotifyWait_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyWaitImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyWait ) : "memory" ); } @@ -987,11 +889,8 @@ " MPU_ulTaskGenericNotifyTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyTake ) : "memory" ); } @@ -1021,11 +920,8 @@ " MPU_xTaskGenericNotifyStateClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyStateClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyStateClear ) : "memory" ); } @@ -1057,11 +953,8 @@ " MPU_ulTaskGenericNotifyValueClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyValueClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyValueClear ) : "memory" ); } @@ -1093,11 +986,8 @@ " MPU_xQueueGenericSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGenericSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGenericSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1121,11 +1011,8 @@ " MPU_uxQueueMessagesWaiting_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueMessagesWaitingImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueMessagesWaiting ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1149,11 +1036,8 @@ " MPU_uxQueueSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1181,11 +1065,8 @@ " MPU_xQueueReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1213,11 +1094,8 @@ " MPU_xQueuePeek_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueuePeekImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueuePeek ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1243,11 +1121,8 @@ " MPU_xQueueSemaphoreTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSemaphoreTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSemaphoreTake ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1273,11 +1148,8 @@ " MPU_xQueueGetMutexHolder_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGetMutexHolderImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGetMutexHolder ) : "memory" ); } @@ -1307,11 +1179,8 @@ " MPU_xQueueTakeMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueTakeMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueTakeMutexRecursive ) : "memory" ); } @@ -1339,11 +1208,8 @@ " MPU_xQueueGiveMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGiveMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGiveMutexRecursive ) : "memory" ); } @@ -1373,11 +1239,8 @@ " MPU_xQueueSelectFromSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSelectFromSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSelectFromSet ) : "memory" ); } @@ -1407,11 +1270,8 @@ " MPU_xQueueAddToSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueAddToSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueAddToSet ) : "memory" ); } @@ -1441,11 +1301,8 @@ " MPU_vQueueAddToRegistry_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueAddToRegistryImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueAddToRegistry ) : "memory" ); } @@ -1473,11 +1330,8 @@ " MPU_vQueueUnregisterQueue_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueUnregisterQueueImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueUnregisterQueue ) : "memory" ); } @@ -1505,11 +1359,8 @@ " MPU_pcQueueGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcQueueGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcQueueGetName ) : "memory" ); } @@ -1537,11 +1388,8 @@ " MPU_pvTimerGetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTimerGetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTimerGetTimerID ) : "memory" ); } @@ -1571,11 +1419,8 @@ " MPU_vTimerSetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetTimerID ) : "memory" ); } @@ -1603,11 +1448,8 @@ " MPU_xTimerIsTimerActive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerIsTimerActiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerIsTimerActive ) : "memory" ); } @@ -1635,11 +1477,8 @@ " MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetTimerDaemonTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle ) : "memory" ); } @@ -1648,17 +1487,9 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1675,11 +1506,8 @@ " MPU_xTimerGenericCommandFromTask_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGenericCommandFromTaskImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGenericCommandFromTask ) : "memory" ); } @@ -1707,11 +1535,8 @@ " MPU_pcTimerGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcTimerGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcTimerGetName ) : "memory" ); } @@ -1741,11 +1566,8 @@ " MPU_vTimerSetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetReloadMode ) : "memory" ); } @@ -1773,11 +1595,8 @@ " MPU_xTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetReloadMode ) : "memory" ); } @@ -1805,11 +1624,8 @@ " MPU_uxTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTimerGetReloadMode ) : "memory" ); } @@ -1837,11 +1653,8 @@ " MPU_xTimerGetPeriod_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetPeriodImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetPeriod ) : "memory" ); } @@ -1869,28 +1682,17 @@ " MPU_xTimerGetExpiryTime_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetExpiryTimeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetExpiryTime ) : "memory" ); } #endif /* if ( configUSE_TIMERS == 1 ) */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1907,11 +1709,8 @@ " MPU_xEventGroupWaitBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupWaitBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupWaitBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1937,11 +1736,8 @@ " MPU_xEventGroupClearBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupClearBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupClearBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1967,11 +1763,8 @@ " MPU_xEventGroupSetBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSetBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSetBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2001,11 +1794,8 @@ " MPU_xEventGroupSync_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSyncImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSync ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2031,11 +1821,8 @@ " MPU_uxEventGroupGetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxEventGroupGetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxEventGroupGetNumber ) : "memory" ); } @@ -2065,11 +1852,8 @@ " MPU_vEventGroupSetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vEventGroupSetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vEventGroupSetNumber ) : "memory" ); } @@ -2101,11 +1885,8 @@ " MPU_xStreamBufferSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2135,11 +1916,8 @@ " MPU_xStreamBufferReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2163,11 +1941,8 @@ " MPU_xStreamBufferIsFull_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsFullImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsFull ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2191,11 +1966,8 @@ " MPU_xStreamBufferIsEmpty_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsEmptyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsEmpty ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2219,11 +1991,8 @@ " MPU_xStreamBufferSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2247,11 +2016,8 @@ " MPU_xStreamBufferBytesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferBytesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferBytesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2277,11 +2043,8 @@ " MPU_xStreamBufferSetTriggerLevel_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSetTriggerLevelImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSetTriggerLevel ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2305,11 +2068,8 @@ " MPU_xStreamBufferNextMessageLengthBytes_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferNextMessageLengthBytesImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferNextMessageLengthBytes ) : "memory" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM4_MPU/port.c b/portable/GCC/ARM_CM4_MPU/port.c index e2ef1f054..ac602caaf 100644 --- a/portable/GCC/ARM_CM4_MPU/port.c +++ b/portable/GCC/ARM_CM4_MPU/port.c @@ -38,6 +38,7 @@ /* Scheduler includes. */ #include "FreeRTOS.h" #include "task.h" +#include "mpu_syscall_numbers.h" #ifndef __VFP_FP__ #error This port can only be used when the project options are configured to enable hardware floating point support. @@ -235,29 +236,22 @@ void vPortSwitchToUserMode( void ); * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -288,6 +282,15 @@ BaseType_t xPortIsTaskPrivileged( void ) PRIVILEGED_FUNCTION; * switches can only occur when uxCriticalNesting is zero. */ static UBaseType_t uxCriticalNesting = 0xaaaaaaaa; +#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/* + * This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /* * Used by the portASSERT_IF_INTERRUPT_PRIORITY_INVALID() macro to ensure * FreeRTOS API functions are not called from interrupts that have been assigned @@ -366,7 +369,6 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack, ".syntax unified \n" ".extern vSVCHandler_C \n" ".extern vSystemCallEnter \n" - ".extern vSystemCallEnter_1 \n" ".extern vSystemCallExit \n" " \n" "tst lr, #4 \n" @@ -377,10 +379,8 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack, "ldr r1, [r0, #24] \n" "ldrb r2, [r1, #-2] \n" "cmp r2, %0 \n" - "beq syscall_enter \n" + "blt syscall_enter \n" "cmp r2, %1 \n" - "beq syscall_enter_1 \n" - "cmp r2, %2 \n" "beq syscall_exit \n" "b vSVCHandler_C \n" " \n" @@ -388,16 +388,12 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack, " mov r1, lr \n" " b vSystemCallEnter \n" " \n" - "syscall_enter_1: \n" - " mov r1, lr \n" - " b vSystemCallEnter_1 \n" - " \n" "syscall_exit: \n" " mov r1, lr \n" " b vSystemCallExit \n" " \n" : /* No outputs. */ - : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) + : "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "r0", "r1", "r2", "memory" ); } @@ -430,7 +426,7 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ uint8_t ucSVCNumber; uint32_t ulPC; - #if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) + #if ( ( configUSE_MPU_WRAPPERS_V1 == 1 ) && ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) ) #if defined( __ARMCC_VERSION ) /* Declaration when these variable are defined in code instead of being @@ -442,7 +438,7 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ extern uint32_t __syscalls_flash_start__[]; extern uint32_t __syscalls_flash_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ - #endif /* #if( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ + #endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 1 ) && ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) ) */ /* The stack contains: r0, r1, r2, r3, r12, LR, PC and xPSR. The first * argument (r0) is pulParam[ 0 ]. */ @@ -468,26 +464,15 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ break; - #if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) - case portSVC_RAISE_PRIVILEGE: /* Only raise the privilege, if the - * svc was raised from any of the - * system calls. */ + #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) + #if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) + case portSVC_RAISE_PRIVILEGE: /* Only raise the privilege, if the + * svc was raised from any of the + * system calls. */ - if( ( ulPC >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulPC <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - __asm volatile - ( - " mrs r1, control \n" /* Obtain current control value. */ - " bic r1, #1 \n" /* Set privilege bit. */ - " msr control, r1 \n" /* Write back new control value. */ - ::: "r1", "memory" - ); - } - - break; - #else /* if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ - case portSVC_RAISE_PRIVILEGE: + if( ( ulPC >= ( uint32_t ) __syscalls_flash_start__ ) && + ( ulPC <= ( uint32_t ) __syscalls_flash_end__ ) ) + { __asm volatile ( " mrs r1, control \n" /* Obtain current control value. */ @@ -495,11 +480,24 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ " msr control, r1 \n" /* Write back new control value. */ ::: "r1", "memory" ); - break; - #endif /* #if( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ + } - default: /* Unknown SVC call. */ - break; + break; + #else /* if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ + case portSVC_RAISE_PRIVILEGE: + __asm volatile + ( + " mrs r1, control \n" /* Obtain current control value. */ + " bic r1, #1 \n" /* Set privilege bit. */ + " msr control, r1 \n" /* Write back new control value. */ + ::: "r1", "memory" + ); + break; + #endif /* #if( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ + #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) */ + + default: /* Unknown SVC call. */ + break; } } /*-----------------------------------------------------------*/ @@ -507,15 +505,16 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -527,17 +526,27 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) { /* Extended frame i.e. FPU in use. */ @@ -578,10 +587,18 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - /* Store the value of the Link Register before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Record if the hardware used padding to force the stack pointer * to be double word aligned. */ if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) @@ -605,108 +622,9 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r1, control \n" /* Obtain current control value. */ - " bic r1, #1 \n" /* Clear nPRIV bit. */ - " msr control, r1 \n" /* Write back new control value. */ - ::: "r1", "memory" - ); - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* Store the value of the Link Register before the SVC was raised. We need to - * restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -723,24 +641,32 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -779,8 +705,10 @@ void vSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ ::: "r1", "memory" ); - /* Restore the stacked link register to what it was at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; /* If the hardware used padding to force the stack pointer @@ -995,6 +923,12 @@ BaseType_t xPortStartScheduler( void ) /* Initialise the critical nesting count ready for the first task. */ uxCriticalNesting = 0; + #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Ensure the VFP is enabled - it should be anyway. */ vPortEnableVFP(); @@ -1688,21 +1622,34 @@ BaseType_t xPortIsAuthorizedToAccessBuffer( const void * pvBuffer, { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; diff --git a/portable/GCC/ARM_CM4_MPU/portmacro.h b/portable/GCC/ARM_CM4_MPU/portmacro.h index 1f62279b0..4b941e6fa 100644 --- a/portable/GCC/ARM_CM4_MPU/portmacro.h +++ b/portable/GCC/ARM_CM4_MPU/portmacro.h @@ -251,12 +251,10 @@ typedef struct MPU_SETTINGS /*-----------------------------------------------------------*/ /* SVC numbers for various services. */ -#define portSVC_START_SCHEDULER 0 -#define portSVC_YIELD 1 -#define portSVC_RAISE_PRIVILEGE 2 -#define portSVC_SYSTEM_CALL_ENTER 3 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 4 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 5 +#define portSVC_START_SCHEDULER 100 +#define portSVC_YIELD 101 +#define portSVC_RAISE_PRIVILEGE 102 +#define portSVC_SYSTEM_CALL_EXIT 103 /* Scheduler utilities. */ diff --git a/portable/GCC/ARM_CM55/non_secure/mpu_wrappers_v2_asm.c b/portable/GCC/ARM_CM55/non_secure/mpu_wrappers_v2_asm.c index d1fbdc0e5..4cb310afd 100644 --- a/portable/GCC/ARM_CM55/non_secure/mpu_wrappers_v2_asm.c +++ b/portable/GCC/ARM_CM55/non_secure/mpu_wrappers_v2_asm.c @@ -38,6 +38,8 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -67,11 +69,8 @@ " MPU_xTaskDelayUntil_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskDelayUntilImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskDelayUntil ) : "memory" ); } @@ -99,11 +98,8 @@ " MPU_xTaskAbortDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskAbortDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskAbortDelay ) : "memory" ); } @@ -131,11 +127,8 @@ " MPU_vTaskDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskDelay ) : "memory" ); } @@ -163,11 +156,8 @@ " MPU_uxTaskPriorityGet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskPriorityGetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskPriorityGet ) : "memory" ); } @@ -195,11 +185,8 @@ " MPU_eTaskGetState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_eTaskGetStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_eTaskGetState ) : "memory" ); } @@ -233,11 +220,8 @@ " MPU_vTaskGetInfo_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskGetInfoImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskGetInfo ) : "memory" ); } @@ -265,11 +249,8 @@ " MPU_xTaskGetIdleTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetIdleTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetIdleTaskHandle ) : "memory" ); } @@ -297,11 +278,8 @@ " MPU_vTaskSuspend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSuspendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSuspend ) : "memory" ); } @@ -329,11 +307,8 @@ " MPU_vTaskResume_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskResumeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskResume ) : "memory" ); } @@ -359,11 +334,8 @@ " MPU_xTaskGetTickCount_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetTickCountImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetTickCount ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -387,11 +359,8 @@ " MPU_uxTaskGetNumberOfTasks_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetNumberOfTasksImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetNumberOfTasks ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -417,11 +386,8 @@ " MPU_ulTaskGetRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimeCounter ) : "memory" ); } @@ -449,11 +415,8 @@ " MPU_ulTaskGetRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimePercent ) : "memory" ); } @@ -481,11 +444,8 @@ " MPU_ulTaskGetIdleRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimePercent ) : "memory" ); } @@ -513,11 +473,8 @@ " MPU_ulTaskGetIdleRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimeCounter ) : "memory" ); } @@ -547,11 +504,8 @@ " MPU_vTaskSetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetApplicationTaskTag ) : "memory" ); } @@ -579,11 +533,8 @@ " MPU_xTaskGetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetApplicationTaskTag ) : "memory" ); } @@ -615,11 +566,8 @@ " MPU_vTaskSetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetThreadLocalStoragePointer ) : "memory" ); } @@ -649,11 +597,8 @@ " MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTaskGetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer ) : "memory" ); } @@ -685,11 +630,8 @@ " MPU_uxTaskGetSystemState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetSystemStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetSystemState ) : "memory" ); } @@ -717,11 +659,8 @@ " MPU_uxTaskGetStackHighWaterMark_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMarkImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark ) : "memory" ); } @@ -749,11 +688,8 @@ " MPU_uxTaskGetStackHighWaterMark2_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMark2Impl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark2 ) : "memory" ); } @@ -781,11 +717,8 @@ " MPU_xTaskGetCurrentTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetCurrentTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetCurrentTaskHandle ) : "memory" ); } @@ -813,11 +746,8 @@ " MPU_xTaskGetSchedulerState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetSchedulerStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetSchedulerState ) : "memory" ); } @@ -843,11 +773,8 @@ " MPU_vTaskSetTimeOutState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetTimeOutStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetTimeOutState ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -873,28 +800,17 @@ " MPU_xTaskCheckForTimeOut_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskCheckForTimeOutImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskCheckForTimeOut ) : "memory" ); } /*-----------------------------------------------------------*/ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -911,11 +827,8 @@ " MPU_xTaskGenericNotify_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotify ) : "memory" ); } @@ -924,17 +837,9 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -951,11 +856,8 @@ " MPU_xTaskGenericNotifyWait_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyWaitImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyWait ) : "memory" ); } @@ -987,11 +889,8 @@ " MPU_ulTaskGenericNotifyTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyTake ) : "memory" ); } @@ -1021,11 +920,8 @@ " MPU_xTaskGenericNotifyStateClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyStateClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyStateClear ) : "memory" ); } @@ -1057,11 +953,8 @@ " MPU_ulTaskGenericNotifyValueClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyValueClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyValueClear ) : "memory" ); } @@ -1093,11 +986,8 @@ " MPU_xQueueGenericSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGenericSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGenericSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1121,11 +1011,8 @@ " MPU_uxQueueMessagesWaiting_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueMessagesWaitingImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueMessagesWaiting ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1149,11 +1036,8 @@ " MPU_uxQueueSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1181,11 +1065,8 @@ " MPU_xQueueReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1213,11 +1094,8 @@ " MPU_xQueuePeek_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueuePeekImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueuePeek ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1243,11 +1121,8 @@ " MPU_xQueueSemaphoreTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSemaphoreTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSemaphoreTake ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1273,11 +1148,8 @@ " MPU_xQueueGetMutexHolder_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGetMutexHolderImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGetMutexHolder ) : "memory" ); } @@ -1307,11 +1179,8 @@ " MPU_xQueueTakeMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueTakeMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueTakeMutexRecursive ) : "memory" ); } @@ -1339,11 +1208,8 @@ " MPU_xQueueGiveMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGiveMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGiveMutexRecursive ) : "memory" ); } @@ -1373,11 +1239,8 @@ " MPU_xQueueSelectFromSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSelectFromSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSelectFromSet ) : "memory" ); } @@ -1407,11 +1270,8 @@ " MPU_xQueueAddToSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueAddToSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueAddToSet ) : "memory" ); } @@ -1441,11 +1301,8 @@ " MPU_vQueueAddToRegistry_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueAddToRegistryImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueAddToRegistry ) : "memory" ); } @@ -1473,11 +1330,8 @@ " MPU_vQueueUnregisterQueue_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueUnregisterQueueImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueUnregisterQueue ) : "memory" ); } @@ -1505,11 +1359,8 @@ " MPU_pcQueueGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcQueueGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcQueueGetName ) : "memory" ); } @@ -1537,11 +1388,8 @@ " MPU_pvTimerGetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTimerGetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTimerGetTimerID ) : "memory" ); } @@ -1571,11 +1419,8 @@ " MPU_vTimerSetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetTimerID ) : "memory" ); } @@ -1603,11 +1448,8 @@ " MPU_xTimerIsTimerActive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerIsTimerActiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerIsTimerActive ) : "memory" ); } @@ -1635,11 +1477,8 @@ " MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetTimerDaemonTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle ) : "memory" ); } @@ -1648,17 +1487,9 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1675,11 +1506,8 @@ " MPU_xTimerGenericCommandFromTask_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGenericCommandFromTaskImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGenericCommandFromTask ) : "memory" ); } @@ -1707,11 +1535,8 @@ " MPU_pcTimerGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcTimerGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcTimerGetName ) : "memory" ); } @@ -1741,11 +1566,8 @@ " MPU_vTimerSetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetReloadMode ) : "memory" ); } @@ -1773,11 +1595,8 @@ " MPU_xTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetReloadMode ) : "memory" ); } @@ -1805,11 +1624,8 @@ " MPU_uxTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTimerGetReloadMode ) : "memory" ); } @@ -1837,11 +1653,8 @@ " MPU_xTimerGetPeriod_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetPeriodImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetPeriod ) : "memory" ); } @@ -1869,28 +1682,17 @@ " MPU_xTimerGetExpiryTime_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetExpiryTimeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetExpiryTime ) : "memory" ); } #endif /* if ( configUSE_TIMERS == 1 ) */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1907,11 +1709,8 @@ " MPU_xEventGroupWaitBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupWaitBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupWaitBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1937,11 +1736,8 @@ " MPU_xEventGroupClearBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupClearBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupClearBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1967,11 +1763,8 @@ " MPU_xEventGroupSetBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSetBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSetBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2001,11 +1794,8 @@ " MPU_xEventGroupSync_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSyncImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSync ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2031,11 +1821,8 @@ " MPU_uxEventGroupGetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxEventGroupGetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxEventGroupGetNumber ) : "memory" ); } @@ -2065,11 +1852,8 @@ " MPU_vEventGroupSetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vEventGroupSetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vEventGroupSetNumber ) : "memory" ); } @@ -2101,11 +1885,8 @@ " MPU_xStreamBufferSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2135,11 +1916,8 @@ " MPU_xStreamBufferReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2163,11 +1941,8 @@ " MPU_xStreamBufferIsFull_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsFullImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsFull ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2191,11 +1966,8 @@ " MPU_xStreamBufferIsEmpty_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsEmptyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsEmpty ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2219,11 +1991,8 @@ " MPU_xStreamBufferSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2247,11 +2016,8 @@ " MPU_xStreamBufferBytesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferBytesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferBytesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2277,11 +2043,8 @@ " MPU_xStreamBufferSetTriggerLevel_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSetTriggerLevelImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSetTriggerLevel ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2305,11 +2068,8 @@ " MPU_xStreamBufferNextMessageLengthBytes_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferNextMessageLengthBytesImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferNextMessageLengthBytes ) : "memory" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM55/non_secure/port.c b/portable/GCC/ARM_CM55/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/GCC/ARM_CM55/non_secure/port.c +++ b/portable/GCC/ARM_CM55/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM55/non_secure/portasm.c b/portable/GCC/ARM_CM55/non_secure/portasm.c index ba8f6c62d..16c598ad7 100644 --- a/portable/GCC/ARM_CM55/non_secure/portasm.c +++ b/portable/GCC/ARM_CM55/non_secure/portasm.c @@ -36,6 +36,9 @@ /* Portasm includes. */ #include "portasm.h" +/* System call numbers includes. */ +#include "mpu_syscall_numbers.h" + /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the * header files. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -522,7 +525,6 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att ".syntax unified \n" ".extern vPortSVCHandler_C \n" ".extern vSystemCallEnter \n" - ".extern vSystemCallEnter_1 \n" ".extern vSystemCallExit \n" " \n" "tst lr, #4 \n" @@ -533,10 +535,8 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att "ldr r1, [r0, #24] \n" "ldrb r2, [r1, #-2] \n" "cmp r2, %0 \n" - "beq syscall_enter \n" + "blt syscall_enter \n" "cmp r2, %1 \n" - "beq syscall_enter_1 \n" - "cmp r2, %2 \n" "beq syscall_exit \n" "b vPortSVCHandler_C \n" " \n" @@ -544,16 +544,12 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att " mov r1, lr \n" " b vSystemCallEnter \n" " \n" - "syscall_enter_1: \n" - " mov r1, lr \n" - " b vSystemCallEnter_1 \n" - " \n" "syscall_exit: \n" " mov r1, lr \n" " b vSystemCallExit \n" " \n" : /* No outputs. */ - : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) + : "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "r0", "r1", "r2", "memory" ); } diff --git a/portable/GCC/ARM_CM55/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM55/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/GCC/ARM_CM55/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM55/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM55_NTZ/non_secure/mpu_wrappers_v2_asm.c b/portable/GCC/ARM_CM55_NTZ/non_secure/mpu_wrappers_v2_asm.c index d1fbdc0e5..4cb310afd 100644 --- a/portable/GCC/ARM_CM55_NTZ/non_secure/mpu_wrappers_v2_asm.c +++ b/portable/GCC/ARM_CM55_NTZ/non_secure/mpu_wrappers_v2_asm.c @@ -38,6 +38,8 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -67,11 +69,8 @@ " MPU_xTaskDelayUntil_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskDelayUntilImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskDelayUntil ) : "memory" ); } @@ -99,11 +98,8 @@ " MPU_xTaskAbortDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskAbortDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskAbortDelay ) : "memory" ); } @@ -131,11 +127,8 @@ " MPU_vTaskDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskDelay ) : "memory" ); } @@ -163,11 +156,8 @@ " MPU_uxTaskPriorityGet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskPriorityGetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskPriorityGet ) : "memory" ); } @@ -195,11 +185,8 @@ " MPU_eTaskGetState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_eTaskGetStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_eTaskGetState ) : "memory" ); } @@ -233,11 +220,8 @@ " MPU_vTaskGetInfo_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskGetInfoImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskGetInfo ) : "memory" ); } @@ -265,11 +249,8 @@ " MPU_xTaskGetIdleTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetIdleTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetIdleTaskHandle ) : "memory" ); } @@ -297,11 +278,8 @@ " MPU_vTaskSuspend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSuspendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSuspend ) : "memory" ); } @@ -329,11 +307,8 @@ " MPU_vTaskResume_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskResumeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskResume ) : "memory" ); } @@ -359,11 +334,8 @@ " MPU_xTaskGetTickCount_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetTickCountImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetTickCount ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -387,11 +359,8 @@ " MPU_uxTaskGetNumberOfTasks_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetNumberOfTasksImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetNumberOfTasks ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -417,11 +386,8 @@ " MPU_ulTaskGetRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimeCounter ) : "memory" ); } @@ -449,11 +415,8 @@ " MPU_ulTaskGetRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimePercent ) : "memory" ); } @@ -481,11 +444,8 @@ " MPU_ulTaskGetIdleRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimePercent ) : "memory" ); } @@ -513,11 +473,8 @@ " MPU_ulTaskGetIdleRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimeCounter ) : "memory" ); } @@ -547,11 +504,8 @@ " MPU_vTaskSetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetApplicationTaskTag ) : "memory" ); } @@ -579,11 +533,8 @@ " MPU_xTaskGetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetApplicationTaskTag ) : "memory" ); } @@ -615,11 +566,8 @@ " MPU_vTaskSetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetThreadLocalStoragePointer ) : "memory" ); } @@ -649,11 +597,8 @@ " MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTaskGetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer ) : "memory" ); } @@ -685,11 +630,8 @@ " MPU_uxTaskGetSystemState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetSystemStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetSystemState ) : "memory" ); } @@ -717,11 +659,8 @@ " MPU_uxTaskGetStackHighWaterMark_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMarkImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark ) : "memory" ); } @@ -749,11 +688,8 @@ " MPU_uxTaskGetStackHighWaterMark2_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMark2Impl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark2 ) : "memory" ); } @@ -781,11 +717,8 @@ " MPU_xTaskGetCurrentTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetCurrentTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetCurrentTaskHandle ) : "memory" ); } @@ -813,11 +746,8 @@ " MPU_xTaskGetSchedulerState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetSchedulerStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetSchedulerState ) : "memory" ); } @@ -843,11 +773,8 @@ " MPU_vTaskSetTimeOutState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetTimeOutStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetTimeOutState ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -873,28 +800,17 @@ " MPU_xTaskCheckForTimeOut_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskCheckForTimeOutImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskCheckForTimeOut ) : "memory" ); } /*-----------------------------------------------------------*/ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -911,11 +827,8 @@ " MPU_xTaskGenericNotify_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotify ) : "memory" ); } @@ -924,17 +837,9 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -951,11 +856,8 @@ " MPU_xTaskGenericNotifyWait_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyWaitImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyWait ) : "memory" ); } @@ -987,11 +889,8 @@ " MPU_ulTaskGenericNotifyTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyTake ) : "memory" ); } @@ -1021,11 +920,8 @@ " MPU_xTaskGenericNotifyStateClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyStateClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyStateClear ) : "memory" ); } @@ -1057,11 +953,8 @@ " MPU_ulTaskGenericNotifyValueClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyValueClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyValueClear ) : "memory" ); } @@ -1093,11 +986,8 @@ " MPU_xQueueGenericSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGenericSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGenericSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1121,11 +1011,8 @@ " MPU_uxQueueMessagesWaiting_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueMessagesWaitingImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueMessagesWaiting ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1149,11 +1036,8 @@ " MPU_uxQueueSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1181,11 +1065,8 @@ " MPU_xQueueReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1213,11 +1094,8 @@ " MPU_xQueuePeek_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueuePeekImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueuePeek ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1243,11 +1121,8 @@ " MPU_xQueueSemaphoreTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSemaphoreTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSemaphoreTake ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1273,11 +1148,8 @@ " MPU_xQueueGetMutexHolder_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGetMutexHolderImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGetMutexHolder ) : "memory" ); } @@ -1307,11 +1179,8 @@ " MPU_xQueueTakeMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueTakeMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueTakeMutexRecursive ) : "memory" ); } @@ -1339,11 +1208,8 @@ " MPU_xQueueGiveMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGiveMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGiveMutexRecursive ) : "memory" ); } @@ -1373,11 +1239,8 @@ " MPU_xQueueSelectFromSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSelectFromSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSelectFromSet ) : "memory" ); } @@ -1407,11 +1270,8 @@ " MPU_xQueueAddToSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueAddToSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueAddToSet ) : "memory" ); } @@ -1441,11 +1301,8 @@ " MPU_vQueueAddToRegistry_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueAddToRegistryImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueAddToRegistry ) : "memory" ); } @@ -1473,11 +1330,8 @@ " MPU_vQueueUnregisterQueue_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueUnregisterQueueImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueUnregisterQueue ) : "memory" ); } @@ -1505,11 +1359,8 @@ " MPU_pcQueueGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcQueueGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcQueueGetName ) : "memory" ); } @@ -1537,11 +1388,8 @@ " MPU_pvTimerGetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTimerGetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTimerGetTimerID ) : "memory" ); } @@ -1571,11 +1419,8 @@ " MPU_vTimerSetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetTimerID ) : "memory" ); } @@ -1603,11 +1448,8 @@ " MPU_xTimerIsTimerActive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerIsTimerActiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerIsTimerActive ) : "memory" ); } @@ -1635,11 +1477,8 @@ " MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetTimerDaemonTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle ) : "memory" ); } @@ -1648,17 +1487,9 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1675,11 +1506,8 @@ " MPU_xTimerGenericCommandFromTask_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGenericCommandFromTaskImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGenericCommandFromTask ) : "memory" ); } @@ -1707,11 +1535,8 @@ " MPU_pcTimerGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcTimerGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcTimerGetName ) : "memory" ); } @@ -1741,11 +1566,8 @@ " MPU_vTimerSetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetReloadMode ) : "memory" ); } @@ -1773,11 +1595,8 @@ " MPU_xTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetReloadMode ) : "memory" ); } @@ -1805,11 +1624,8 @@ " MPU_uxTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTimerGetReloadMode ) : "memory" ); } @@ -1837,11 +1653,8 @@ " MPU_xTimerGetPeriod_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetPeriodImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetPeriod ) : "memory" ); } @@ -1869,28 +1682,17 @@ " MPU_xTimerGetExpiryTime_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetExpiryTimeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetExpiryTime ) : "memory" ); } #endif /* if ( configUSE_TIMERS == 1 ) */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1907,11 +1709,8 @@ " MPU_xEventGroupWaitBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupWaitBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupWaitBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1937,11 +1736,8 @@ " MPU_xEventGroupClearBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupClearBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupClearBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1967,11 +1763,8 @@ " MPU_xEventGroupSetBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSetBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSetBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2001,11 +1794,8 @@ " MPU_xEventGroupSync_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSyncImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSync ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2031,11 +1821,8 @@ " MPU_uxEventGroupGetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxEventGroupGetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxEventGroupGetNumber ) : "memory" ); } @@ -2065,11 +1852,8 @@ " MPU_vEventGroupSetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vEventGroupSetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vEventGroupSetNumber ) : "memory" ); } @@ -2101,11 +1885,8 @@ " MPU_xStreamBufferSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2135,11 +1916,8 @@ " MPU_xStreamBufferReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2163,11 +1941,8 @@ " MPU_xStreamBufferIsFull_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsFullImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsFull ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2191,11 +1966,8 @@ " MPU_xStreamBufferIsEmpty_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsEmptyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsEmpty ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2219,11 +1991,8 @@ " MPU_xStreamBufferSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2247,11 +2016,8 @@ " MPU_xStreamBufferBytesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferBytesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferBytesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2277,11 +2043,8 @@ " MPU_xStreamBufferSetTriggerLevel_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSetTriggerLevelImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSetTriggerLevel ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2305,11 +2068,8 @@ " MPU_xStreamBufferNextMessageLengthBytes_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferNextMessageLengthBytesImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferNextMessageLengthBytes ) : "memory" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM55_NTZ/non_secure/port.c b/portable/GCC/ARM_CM55_NTZ/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/GCC/ARM_CM55_NTZ/non_secure/port.c +++ b/portable/GCC/ARM_CM55_NTZ/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM55_NTZ/non_secure/portasm.c b/portable/GCC/ARM_CM55_NTZ/non_secure/portasm.c index e533dd7e9..76ba642a0 100644 --- a/portable/GCC/ARM_CM55_NTZ/non_secure/portasm.c +++ b/portable/GCC/ARM_CM55_NTZ/non_secure/portasm.c @@ -36,6 +36,9 @@ /* Portasm includes. */ #include "portasm.h" +/* System call numbers includes. */ +#include "mpu_syscall_numbers.h" + /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the * header files. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -443,7 +446,6 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att ".syntax unified \n" ".extern vPortSVCHandler_C \n" ".extern vSystemCallEnter \n" - ".extern vSystemCallEnter_1 \n" ".extern vSystemCallExit \n" " \n" "tst lr, #4 \n" @@ -454,10 +456,8 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att "ldr r1, [r0, #24] \n" "ldrb r2, [r1, #-2] \n" "cmp r2, %0 \n" - "beq syscall_enter \n" + "blt syscall_enter \n" "cmp r2, %1 \n" - "beq syscall_enter_1 \n" - "cmp r2, %2 \n" "beq syscall_exit \n" "b vPortSVCHandler_C \n" " \n" @@ -465,16 +465,12 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att " mov r1, lr \n" " b vSystemCallEnter \n" " \n" - "syscall_enter_1: \n" - " mov r1, lr \n" - " b vSystemCallEnter_1 \n" - " \n" "syscall_exit: \n" " mov r1, lr \n" " b vSystemCallExit \n" " \n" : /* No outputs. */ - : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) + : "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "r0", "r1", "r2", "memory" ); } diff --git a/portable/GCC/ARM_CM55_NTZ/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM55_NTZ/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/GCC/ARM_CM55_NTZ/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM55_NTZ/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM85/non_secure/mpu_wrappers_v2_asm.c b/portable/GCC/ARM_CM85/non_secure/mpu_wrappers_v2_asm.c index d1fbdc0e5..4cb310afd 100644 --- a/portable/GCC/ARM_CM85/non_secure/mpu_wrappers_v2_asm.c +++ b/portable/GCC/ARM_CM85/non_secure/mpu_wrappers_v2_asm.c @@ -38,6 +38,8 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -67,11 +69,8 @@ " MPU_xTaskDelayUntil_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskDelayUntilImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskDelayUntil ) : "memory" ); } @@ -99,11 +98,8 @@ " MPU_xTaskAbortDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskAbortDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskAbortDelay ) : "memory" ); } @@ -131,11 +127,8 @@ " MPU_vTaskDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskDelay ) : "memory" ); } @@ -163,11 +156,8 @@ " MPU_uxTaskPriorityGet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskPriorityGetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskPriorityGet ) : "memory" ); } @@ -195,11 +185,8 @@ " MPU_eTaskGetState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_eTaskGetStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_eTaskGetState ) : "memory" ); } @@ -233,11 +220,8 @@ " MPU_vTaskGetInfo_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskGetInfoImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskGetInfo ) : "memory" ); } @@ -265,11 +249,8 @@ " MPU_xTaskGetIdleTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetIdleTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetIdleTaskHandle ) : "memory" ); } @@ -297,11 +278,8 @@ " MPU_vTaskSuspend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSuspendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSuspend ) : "memory" ); } @@ -329,11 +307,8 @@ " MPU_vTaskResume_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskResumeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskResume ) : "memory" ); } @@ -359,11 +334,8 @@ " MPU_xTaskGetTickCount_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetTickCountImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetTickCount ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -387,11 +359,8 @@ " MPU_uxTaskGetNumberOfTasks_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetNumberOfTasksImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetNumberOfTasks ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -417,11 +386,8 @@ " MPU_ulTaskGetRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimeCounter ) : "memory" ); } @@ -449,11 +415,8 @@ " MPU_ulTaskGetRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimePercent ) : "memory" ); } @@ -481,11 +444,8 @@ " MPU_ulTaskGetIdleRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimePercent ) : "memory" ); } @@ -513,11 +473,8 @@ " MPU_ulTaskGetIdleRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimeCounter ) : "memory" ); } @@ -547,11 +504,8 @@ " MPU_vTaskSetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetApplicationTaskTag ) : "memory" ); } @@ -579,11 +533,8 @@ " MPU_xTaskGetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetApplicationTaskTag ) : "memory" ); } @@ -615,11 +566,8 @@ " MPU_vTaskSetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetThreadLocalStoragePointer ) : "memory" ); } @@ -649,11 +597,8 @@ " MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTaskGetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer ) : "memory" ); } @@ -685,11 +630,8 @@ " MPU_uxTaskGetSystemState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetSystemStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetSystemState ) : "memory" ); } @@ -717,11 +659,8 @@ " MPU_uxTaskGetStackHighWaterMark_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMarkImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark ) : "memory" ); } @@ -749,11 +688,8 @@ " MPU_uxTaskGetStackHighWaterMark2_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMark2Impl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark2 ) : "memory" ); } @@ -781,11 +717,8 @@ " MPU_xTaskGetCurrentTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetCurrentTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetCurrentTaskHandle ) : "memory" ); } @@ -813,11 +746,8 @@ " MPU_xTaskGetSchedulerState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetSchedulerStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetSchedulerState ) : "memory" ); } @@ -843,11 +773,8 @@ " MPU_vTaskSetTimeOutState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetTimeOutStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetTimeOutState ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -873,28 +800,17 @@ " MPU_xTaskCheckForTimeOut_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskCheckForTimeOutImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskCheckForTimeOut ) : "memory" ); } /*-----------------------------------------------------------*/ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -911,11 +827,8 @@ " MPU_xTaskGenericNotify_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotify ) : "memory" ); } @@ -924,17 +837,9 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -951,11 +856,8 @@ " MPU_xTaskGenericNotifyWait_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyWaitImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyWait ) : "memory" ); } @@ -987,11 +889,8 @@ " MPU_ulTaskGenericNotifyTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyTake ) : "memory" ); } @@ -1021,11 +920,8 @@ " MPU_xTaskGenericNotifyStateClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyStateClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyStateClear ) : "memory" ); } @@ -1057,11 +953,8 @@ " MPU_ulTaskGenericNotifyValueClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyValueClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyValueClear ) : "memory" ); } @@ -1093,11 +986,8 @@ " MPU_xQueueGenericSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGenericSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGenericSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1121,11 +1011,8 @@ " MPU_uxQueueMessagesWaiting_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueMessagesWaitingImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueMessagesWaiting ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1149,11 +1036,8 @@ " MPU_uxQueueSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1181,11 +1065,8 @@ " MPU_xQueueReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1213,11 +1094,8 @@ " MPU_xQueuePeek_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueuePeekImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueuePeek ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1243,11 +1121,8 @@ " MPU_xQueueSemaphoreTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSemaphoreTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSemaphoreTake ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1273,11 +1148,8 @@ " MPU_xQueueGetMutexHolder_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGetMutexHolderImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGetMutexHolder ) : "memory" ); } @@ -1307,11 +1179,8 @@ " MPU_xQueueTakeMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueTakeMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueTakeMutexRecursive ) : "memory" ); } @@ -1339,11 +1208,8 @@ " MPU_xQueueGiveMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGiveMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGiveMutexRecursive ) : "memory" ); } @@ -1373,11 +1239,8 @@ " MPU_xQueueSelectFromSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSelectFromSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSelectFromSet ) : "memory" ); } @@ -1407,11 +1270,8 @@ " MPU_xQueueAddToSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueAddToSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueAddToSet ) : "memory" ); } @@ -1441,11 +1301,8 @@ " MPU_vQueueAddToRegistry_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueAddToRegistryImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueAddToRegistry ) : "memory" ); } @@ -1473,11 +1330,8 @@ " MPU_vQueueUnregisterQueue_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueUnregisterQueueImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueUnregisterQueue ) : "memory" ); } @@ -1505,11 +1359,8 @@ " MPU_pcQueueGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcQueueGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcQueueGetName ) : "memory" ); } @@ -1537,11 +1388,8 @@ " MPU_pvTimerGetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTimerGetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTimerGetTimerID ) : "memory" ); } @@ -1571,11 +1419,8 @@ " MPU_vTimerSetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetTimerID ) : "memory" ); } @@ -1603,11 +1448,8 @@ " MPU_xTimerIsTimerActive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerIsTimerActiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerIsTimerActive ) : "memory" ); } @@ -1635,11 +1477,8 @@ " MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetTimerDaemonTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle ) : "memory" ); } @@ -1648,17 +1487,9 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1675,11 +1506,8 @@ " MPU_xTimerGenericCommandFromTask_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGenericCommandFromTaskImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGenericCommandFromTask ) : "memory" ); } @@ -1707,11 +1535,8 @@ " MPU_pcTimerGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcTimerGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcTimerGetName ) : "memory" ); } @@ -1741,11 +1566,8 @@ " MPU_vTimerSetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetReloadMode ) : "memory" ); } @@ -1773,11 +1595,8 @@ " MPU_xTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetReloadMode ) : "memory" ); } @@ -1805,11 +1624,8 @@ " MPU_uxTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTimerGetReloadMode ) : "memory" ); } @@ -1837,11 +1653,8 @@ " MPU_xTimerGetPeriod_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetPeriodImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetPeriod ) : "memory" ); } @@ -1869,28 +1682,17 @@ " MPU_xTimerGetExpiryTime_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetExpiryTimeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetExpiryTime ) : "memory" ); } #endif /* if ( configUSE_TIMERS == 1 ) */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1907,11 +1709,8 @@ " MPU_xEventGroupWaitBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupWaitBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupWaitBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1937,11 +1736,8 @@ " MPU_xEventGroupClearBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupClearBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupClearBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1967,11 +1763,8 @@ " MPU_xEventGroupSetBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSetBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSetBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2001,11 +1794,8 @@ " MPU_xEventGroupSync_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSyncImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSync ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2031,11 +1821,8 @@ " MPU_uxEventGroupGetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxEventGroupGetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxEventGroupGetNumber ) : "memory" ); } @@ -2065,11 +1852,8 @@ " MPU_vEventGroupSetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vEventGroupSetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vEventGroupSetNumber ) : "memory" ); } @@ -2101,11 +1885,8 @@ " MPU_xStreamBufferSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2135,11 +1916,8 @@ " MPU_xStreamBufferReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2163,11 +1941,8 @@ " MPU_xStreamBufferIsFull_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsFullImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsFull ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2191,11 +1966,8 @@ " MPU_xStreamBufferIsEmpty_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsEmptyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsEmpty ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2219,11 +1991,8 @@ " MPU_xStreamBufferSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2247,11 +2016,8 @@ " MPU_xStreamBufferBytesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferBytesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferBytesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2277,11 +2043,8 @@ " MPU_xStreamBufferSetTriggerLevel_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSetTriggerLevelImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSetTriggerLevel ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2305,11 +2068,8 @@ " MPU_xStreamBufferNextMessageLengthBytes_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferNextMessageLengthBytesImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferNextMessageLengthBytes ) : "memory" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM85/non_secure/port.c b/portable/GCC/ARM_CM85/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/GCC/ARM_CM85/non_secure/port.c +++ b/portable/GCC/ARM_CM85/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM85/non_secure/portasm.c b/portable/GCC/ARM_CM85/non_secure/portasm.c index ba8f6c62d..16c598ad7 100644 --- a/portable/GCC/ARM_CM85/non_secure/portasm.c +++ b/portable/GCC/ARM_CM85/non_secure/portasm.c @@ -36,6 +36,9 @@ /* Portasm includes. */ #include "portasm.h" +/* System call numbers includes. */ +#include "mpu_syscall_numbers.h" + /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the * header files. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -522,7 +525,6 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att ".syntax unified \n" ".extern vPortSVCHandler_C \n" ".extern vSystemCallEnter \n" - ".extern vSystemCallEnter_1 \n" ".extern vSystemCallExit \n" " \n" "tst lr, #4 \n" @@ -533,10 +535,8 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att "ldr r1, [r0, #24] \n" "ldrb r2, [r1, #-2] \n" "cmp r2, %0 \n" - "beq syscall_enter \n" + "blt syscall_enter \n" "cmp r2, %1 \n" - "beq syscall_enter_1 \n" - "cmp r2, %2 \n" "beq syscall_exit \n" "b vPortSVCHandler_C \n" " \n" @@ -544,16 +544,12 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att " mov r1, lr \n" " b vSystemCallEnter \n" " \n" - "syscall_enter_1: \n" - " mov r1, lr \n" - " b vSystemCallEnter_1 \n" - " \n" "syscall_exit: \n" " mov r1, lr \n" " b vSystemCallExit \n" " \n" : /* No outputs. */ - : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) + : "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "r0", "r1", "r2", "memory" ); } diff --git a/portable/GCC/ARM_CM85/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM85/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/GCC/ARM_CM85/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM85/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM85_NTZ/non_secure/mpu_wrappers_v2_asm.c b/portable/GCC/ARM_CM85_NTZ/non_secure/mpu_wrappers_v2_asm.c index d1fbdc0e5..4cb310afd 100644 --- a/portable/GCC/ARM_CM85_NTZ/non_secure/mpu_wrappers_v2_asm.c +++ b/portable/GCC/ARM_CM85_NTZ/non_secure/mpu_wrappers_v2_asm.c @@ -38,6 +38,8 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ @@ -67,11 +69,8 @@ " MPU_xTaskDelayUntil_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskDelayUntilImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskDelayUntil ) : "memory" ); } @@ -99,11 +98,8 @@ " MPU_xTaskAbortDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskAbortDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskAbortDelay ) : "memory" ); } @@ -131,11 +127,8 @@ " MPU_vTaskDelay_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskDelayImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskDelay ) : "memory" ); } @@ -163,11 +156,8 @@ " MPU_uxTaskPriorityGet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskPriorityGetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskPriorityGet ) : "memory" ); } @@ -195,11 +185,8 @@ " MPU_eTaskGetState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_eTaskGetStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_eTaskGetState ) : "memory" ); } @@ -233,11 +220,8 @@ " MPU_vTaskGetInfo_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskGetInfoImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskGetInfo ) : "memory" ); } @@ -265,11 +249,8 @@ " MPU_xTaskGetIdleTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetIdleTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetIdleTaskHandle ) : "memory" ); } @@ -297,11 +278,8 @@ " MPU_vTaskSuspend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSuspendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSuspend ) : "memory" ); } @@ -329,11 +307,8 @@ " MPU_vTaskResume_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskResumeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskResume ) : "memory" ); } @@ -359,11 +334,8 @@ " MPU_xTaskGetTickCount_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetTickCountImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetTickCount ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -387,11 +359,8 @@ " MPU_uxTaskGetNumberOfTasks_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetNumberOfTasksImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetNumberOfTasks ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -417,11 +386,8 @@ " MPU_ulTaskGetRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimeCounter ) : "memory" ); } @@ -449,11 +415,8 @@ " MPU_ulTaskGetRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetRunTimePercent ) : "memory" ); } @@ -481,11 +444,8 @@ " MPU_ulTaskGetIdleRunTimePercent_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimePercentImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimePercent ) : "memory" ); } @@ -513,11 +473,8 @@ " MPU_ulTaskGetIdleRunTimeCounter_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGetIdleRunTimeCounterImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGetIdleRunTimeCounter ) : "memory" ); } @@ -547,11 +504,8 @@ " MPU_vTaskSetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetApplicationTaskTag ) : "memory" ); } @@ -579,11 +533,8 @@ " MPU_xTaskGetApplicationTaskTag_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetApplicationTaskTagImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetApplicationTaskTag ) : "memory" ); } @@ -615,11 +566,8 @@ " MPU_vTaskSetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetThreadLocalStoragePointer ) : "memory" ); } @@ -649,11 +597,8 @@ " MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTaskGetThreadLocalStoragePointerImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer ) : "memory" ); } @@ -685,11 +630,8 @@ " MPU_uxTaskGetSystemState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetSystemStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetSystemState ) : "memory" ); } @@ -717,11 +659,8 @@ " MPU_uxTaskGetStackHighWaterMark_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMarkImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark ) : "memory" ); } @@ -749,11 +688,8 @@ " MPU_uxTaskGetStackHighWaterMark2_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTaskGetStackHighWaterMark2Impl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTaskGetStackHighWaterMark2 ) : "memory" ); } @@ -781,11 +717,8 @@ " MPU_xTaskGetCurrentTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetCurrentTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetCurrentTaskHandle ) : "memory" ); } @@ -813,11 +746,8 @@ " MPU_xTaskGetSchedulerState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGetSchedulerStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGetSchedulerState ) : "memory" ); } @@ -843,11 +773,8 @@ " MPU_vTaskSetTimeOutState_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTaskSetTimeOutStateImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTaskSetTimeOutState ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -873,28 +800,17 @@ " MPU_xTaskCheckForTimeOut_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskCheckForTimeOutImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskCheckForTimeOut ) : "memory" ); } /*-----------------------------------------------------------*/ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -911,11 +827,8 @@ " MPU_xTaskGenericNotify_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotify ) : "memory" ); } @@ -924,17 +837,9 @@ #if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -951,11 +856,8 @@ " MPU_xTaskGenericNotifyWait_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyWaitImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyWait ) : "memory" ); } @@ -987,11 +889,8 @@ " MPU_ulTaskGenericNotifyTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyTake ) : "memory" ); } @@ -1021,11 +920,8 @@ " MPU_xTaskGenericNotifyStateClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTaskGenericNotifyStateClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTaskGenericNotifyStateClear ) : "memory" ); } @@ -1057,11 +953,8 @@ " MPU_ulTaskGenericNotifyValueClear_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_ulTaskGenericNotifyValueClearImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_ulTaskGenericNotifyValueClear ) : "memory" ); } @@ -1093,11 +986,8 @@ " MPU_xQueueGenericSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGenericSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGenericSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1121,11 +1011,8 @@ " MPU_uxQueueMessagesWaiting_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueMessagesWaitingImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueMessagesWaiting ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1149,11 +1036,8 @@ " MPU_uxQueueSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxQueueSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxQueueSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1181,11 +1065,8 @@ " MPU_xQueueReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1213,11 +1094,8 @@ " MPU_xQueuePeek_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueuePeekImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueuePeek ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1243,11 +1121,8 @@ " MPU_xQueueSemaphoreTake_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSemaphoreTakeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSemaphoreTake ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1273,11 +1148,8 @@ " MPU_xQueueGetMutexHolder_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGetMutexHolderImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGetMutexHolder ) : "memory" ); } @@ -1307,11 +1179,8 @@ " MPU_xQueueTakeMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueTakeMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueTakeMutexRecursive ) : "memory" ); } @@ -1339,11 +1208,8 @@ " MPU_xQueueGiveMutexRecursive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueGiveMutexRecursiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueGiveMutexRecursive ) : "memory" ); } @@ -1373,11 +1239,8 @@ " MPU_xQueueSelectFromSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueSelectFromSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueSelectFromSet ) : "memory" ); } @@ -1407,11 +1270,8 @@ " MPU_xQueueAddToSet_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xQueueAddToSetImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xQueueAddToSet ) : "memory" ); } @@ -1441,11 +1301,8 @@ " MPU_vQueueAddToRegistry_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueAddToRegistryImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueAddToRegistry ) : "memory" ); } @@ -1473,11 +1330,8 @@ " MPU_vQueueUnregisterQueue_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vQueueUnregisterQueueImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vQueueUnregisterQueue ) : "memory" ); } @@ -1505,11 +1359,8 @@ " MPU_pcQueueGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcQueueGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcQueueGetName ) : "memory" ); } @@ -1537,11 +1388,8 @@ " MPU_pvTimerGetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pvTimerGetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pvTimerGetTimerID ) : "memory" ); } @@ -1571,11 +1419,8 @@ " MPU_vTimerSetTimerID_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetTimerIDImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetTimerID ) : "memory" ); } @@ -1603,11 +1448,8 @@ " MPU_xTimerIsTimerActive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerIsTimerActiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerIsTimerActive ) : "memory" ); } @@ -1635,11 +1477,8 @@ " MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetTimerDaemonTaskHandleImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle ) : "memory" ); } @@ -1648,17 +1487,9 @@ #if ( configUSE_TIMERS == 1 ) - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1675,11 +1506,8 @@ " MPU_xTimerGenericCommandFromTask_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGenericCommandFromTaskImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGenericCommandFromTask ) : "memory" ); } @@ -1707,11 +1535,8 @@ " MPU_pcTimerGetName_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_pcTimerGetNameImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_pcTimerGetName ) : "memory" ); } @@ -1741,11 +1566,8 @@ " MPU_vTimerSetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vTimerSetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vTimerSetReloadMode ) : "memory" ); } @@ -1773,11 +1595,8 @@ " MPU_xTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetReloadMode ) : "memory" ); } @@ -1805,11 +1624,8 @@ " MPU_uxTimerGetReloadMode_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxTimerGetReloadModeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxTimerGetReloadMode ) : "memory" ); } @@ -1837,11 +1653,8 @@ " MPU_xTimerGetPeriod_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetPeriodImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetPeriod ) : "memory" ); } @@ -1869,28 +1682,17 @@ " MPU_xTimerGetExpiryTime_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xTimerGetExpiryTimeImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xTimerGetExpiryTime ) : "memory" ); } #endif /* if ( configUSE_TIMERS == 1 ) */ /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) __attribute__( ( naked ) ) FREERTOS_SYSTEM_CALL; - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, - TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ + EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */ { __asm volatile ( @@ -1907,11 +1709,8 @@ " MPU_xEventGroupWaitBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupWaitBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupWaitBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1937,11 +1736,8 @@ " MPU_xEventGroupClearBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupClearBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupClearBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -1967,11 +1763,8 @@ " MPU_xEventGroupSetBits_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSetBitsImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSetBits ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2001,11 +1794,8 @@ " MPU_xEventGroupSync_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xEventGroupSyncImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xEventGroupSync ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2031,11 +1821,8 @@ " MPU_uxEventGroupGetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_uxEventGroupGetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_uxEventGroupGetNumber ) : "memory" ); } @@ -2065,11 +1852,8 @@ " MPU_vEventGroupSetNumber_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_vEventGroupSetNumberImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_vEventGroupSetNumber ) : "memory" ); } @@ -2101,11 +1885,8 @@ " MPU_xStreamBufferSend_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSendImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSend ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2135,11 +1916,8 @@ " MPU_xStreamBufferReceive_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferReceiveImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferReceive ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2163,11 +1941,8 @@ " MPU_xStreamBufferIsFull_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsFullImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsFull ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2191,11 +1966,8 @@ " MPU_xStreamBufferIsEmpty_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferIsEmptyImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferIsEmpty ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2219,11 +1991,8 @@ " MPU_xStreamBufferSpacesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSpacesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSpacesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2247,11 +2016,8 @@ " MPU_xStreamBufferBytesAvailable_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferBytesAvailableImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferBytesAvailable ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2277,11 +2043,8 @@ " MPU_xStreamBufferSetTriggerLevel_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferSetTriggerLevelImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferSetTriggerLevel ) : "memory" ); } /*-----------------------------------------------------------*/ @@ -2305,11 +2068,8 @@ " MPU_xStreamBufferNextMessageLengthBytes_Unpriv: \n" " pop {r0} \n" " svc %0 \n" - " bl MPU_xStreamBufferNextMessageLengthBytesImpl \n" - " svc %1 \n" - " bx lr \n" " \n" - : : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" + : : "i" ( SYSTEM_CALL_xStreamBufferNextMessageLengthBytes ) : "memory" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM85_NTZ/non_secure/port.c b/portable/GCC/ARM_CM85_NTZ/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/GCC/ARM_CM85_NTZ/non_secure/port.c +++ b/portable/GCC/ARM_CM85_NTZ/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM85_NTZ/non_secure/portasm.c b/portable/GCC/ARM_CM85_NTZ/non_secure/portasm.c index e533dd7e9..76ba642a0 100644 --- a/portable/GCC/ARM_CM85_NTZ/non_secure/portasm.c +++ b/portable/GCC/ARM_CM85_NTZ/non_secure/portasm.c @@ -36,6 +36,9 @@ /* Portasm includes. */ #include "portasm.h" +/* System call numbers includes. */ +#include "mpu_syscall_numbers.h" + /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the * header files. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -443,7 +446,6 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att ".syntax unified \n" ".extern vPortSVCHandler_C \n" ".extern vSystemCallEnter \n" - ".extern vSystemCallEnter_1 \n" ".extern vSystemCallExit \n" " \n" "tst lr, #4 \n" @@ -454,10 +456,8 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att "ldr r1, [r0, #24] \n" "ldrb r2, [r1, #-2] \n" "cmp r2, %0 \n" - "beq syscall_enter \n" + "blt syscall_enter \n" "cmp r2, %1 \n" - "beq syscall_enter_1 \n" - "cmp r2, %2 \n" "beq syscall_exit \n" "b vPortSVCHandler_C \n" " \n" @@ -465,16 +465,12 @@ void vClearInterruptMask( __attribute__( ( unused ) ) uint32_t ulMask ) /* __att " mov r1, lr \n" " b vSystemCallEnter \n" " \n" - "syscall_enter_1: \n" - " mov r1, lr \n" - " b vSystemCallEnter_1 \n" - " \n" "syscall_exit: \n" " mov r1, lr \n" " b vSystemCallExit \n" " \n" : /* No outputs. */ - : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) + : "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "r0", "r1", "r2", "memory" ); } diff --git a/portable/GCC/ARM_CM85_NTZ/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM85_NTZ/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/GCC/ARM_CM85_NTZ/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM85_NTZ/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM23/non_secure/mpu_wrappers_v2_asm.S b/portable/IAR/ARM_CM23/non_secure/mpu_wrappers_v2_asm.S index 5300a99ec..419df5b1e 100644 --- a/portable/IAR/ARM_CM23/non_secure/mpu_wrappers_v2_asm.S +++ b/portable/IAR/ARM_CM23/non_secure/mpu_wrappers_v2_asm.S @@ -32,15 +32,12 @@ /*-----------------------------------------------------------*/ #include "FreeRTOSConfig.h" +#include "mpu_syscall_numbers.h" #ifndef configUSE_MPU_WRAPPERS_V1 #define configUSE_MPU_WRAPPERS_V1 0 #endif -/* These must be in sync with portmacro.h. */ -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) @@ -57,10 +54,7 @@ MPU_xTaskDelayUntil: b MPU_xTaskDelayUntilImpl MPU_xTaskDelayUntil_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskDelayUntilImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskDelayUntil /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskAbortDelay @@ -75,10 +69,7 @@ MPU_xTaskAbortDelay: b MPU_xTaskAbortDelayImpl MPU_xTaskAbortDelay_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskAbortDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskAbortDelay /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskDelay @@ -93,10 +84,7 @@ MPU_vTaskDelay: b MPU_vTaskDelayImpl MPU_vTaskDelay_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskDelay /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskPriorityGet @@ -111,10 +99,7 @@ MPU_uxTaskPriorityGet: b MPU_uxTaskPriorityGetImpl MPU_uxTaskPriorityGet_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskPriorityGetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskPriorityGet /*-----------------------------------------------------------*/ PUBLIC MPU_eTaskGetState @@ -129,10 +114,7 @@ MPU_eTaskGetState: b MPU_eTaskGetStateImpl MPU_eTaskGetState_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_eTaskGetStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_eTaskGetState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskGetInfo @@ -147,10 +129,7 @@ MPU_vTaskGetInfo: b MPU_vTaskGetInfoImpl MPU_vTaskGetInfo_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskGetInfoImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskGetInfo /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetIdleTaskHandle @@ -165,10 +144,7 @@ MPU_xTaskGetIdleTaskHandle: b MPU_xTaskGetIdleTaskHandleImpl MPU_xTaskGetIdleTaskHandle_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetIdleTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetIdleTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSuspend @@ -183,10 +159,7 @@ MPU_vTaskSuspend: b MPU_vTaskSuspendImpl MPU_vTaskSuspend_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSuspendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSuspend /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskResume @@ -201,10 +174,7 @@ MPU_vTaskResume: b MPU_vTaskResumeImpl MPU_vTaskResume_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskResumeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskResume /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetTickCount @@ -219,10 +189,7 @@ MPU_xTaskGetTickCount: b MPU_xTaskGetTickCountImpl MPU_xTaskGetTickCount_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetTickCountImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetTickCount /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetNumberOfTasks @@ -237,10 +204,7 @@ MPU_uxTaskGetNumberOfTasks: b MPU_uxTaskGetNumberOfTasksImpl MPU_uxTaskGetNumberOfTasks_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetNumberOfTasksImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetNumberOfTasks /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimeCounter @@ -255,10 +219,7 @@ MPU_ulTaskGetRunTimeCounter: b MPU_ulTaskGetRunTimeCounterImpl MPU_ulTaskGetRunTimeCounter_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimePercent @@ -273,10 +234,7 @@ MPU_ulTaskGetRunTimePercent: b MPU_ulTaskGetRunTimePercentImpl MPU_ulTaskGetRunTimePercent_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimePercent @@ -291,10 +249,7 @@ MPU_ulTaskGetIdleRunTimePercent: b MPU_ulTaskGetIdleRunTimePercentImpl MPU_ulTaskGetIdleRunTimePercent_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimeCounter @@ -309,10 +264,7 @@ MPU_ulTaskGetIdleRunTimeCounter: b MPU_ulTaskGetIdleRunTimeCounterImpl MPU_ulTaskGetIdleRunTimeCounter_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetApplicationTaskTag @@ -327,10 +279,7 @@ MPU_vTaskSetApplicationTaskTag: b MPU_vTaskSetApplicationTaskTagImpl MPU_vTaskSetApplicationTaskTag_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetApplicationTaskTag @@ -345,10 +294,7 @@ MPU_xTaskGetApplicationTaskTag: b MPU_xTaskGetApplicationTaskTagImpl MPU_xTaskGetApplicationTaskTag_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetThreadLocalStoragePointer @@ -363,10 +309,7 @@ MPU_vTaskSetThreadLocalStoragePointer: b MPU_vTaskSetThreadLocalStoragePointerImpl MPU_vTaskSetThreadLocalStoragePointer_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_pvTaskGetThreadLocalStoragePointer @@ -381,10 +324,7 @@ MPU_pvTaskGetThreadLocalStoragePointer: b MPU_pvTaskGetThreadLocalStoragePointerImpl MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTaskGetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetSystemState @@ -399,10 +339,7 @@ MPU_uxTaskGetSystemState: b MPU_uxTaskGetSystemStateImpl MPU_uxTaskGetSystemState_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetSystemStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetSystemState /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark @@ -417,10 +354,7 @@ MPU_uxTaskGetStackHighWaterMark: b MPU_uxTaskGetStackHighWaterMarkImpl MPU_uxTaskGetStackHighWaterMark_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMarkImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark2 @@ -435,10 +369,7 @@ MPU_uxTaskGetStackHighWaterMark2: b MPU_uxTaskGetStackHighWaterMark2Impl MPU_uxTaskGetStackHighWaterMark2_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMark2Impl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark2 /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetCurrentTaskHandle @@ -453,10 +384,7 @@ MPU_xTaskGetCurrentTaskHandle: b MPU_xTaskGetCurrentTaskHandleImpl MPU_xTaskGetCurrentTaskHandle_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetCurrentTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetCurrentTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetSchedulerState @@ -471,10 +399,7 @@ MPU_xTaskGetSchedulerState: b MPU_xTaskGetSchedulerStateImpl MPU_xTaskGetSchedulerState_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetSchedulerStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetSchedulerState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetTimeOutState @@ -489,10 +414,7 @@ MPU_vTaskSetTimeOutState: b MPU_vTaskSetTimeOutStateImpl MPU_vTaskSetTimeOutState_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetTimeOutStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetTimeOutState /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskCheckForTimeOut @@ -507,14 +429,11 @@ MPU_xTaskCheckForTimeOut: b MPU_xTaskCheckForTimeOutImpl MPU_xTaskCheckForTimeOut_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskCheckForTimeOutImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskCheckForTimeOut /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotify -MPU_xTaskGenericNotify: + PUBLIC MPU_xTaskGenericNotifyEntry +MPU_xTaskGenericNotifyEntry: push {r0, r1} mrs r0, control movs r1, #1 @@ -525,14 +444,11 @@ MPU_xTaskGenericNotify: b MPU_xTaskGenericNotifyImpl MPU_xTaskGenericNotify_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotify /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotifyWait -MPU_xTaskGenericNotifyWait: + PUBLIC MPU_xTaskGenericNotifyWaitEntry +MPU_xTaskGenericNotifyWaitEntry: push {r0, r1} mrs r0, control movs r1, #1 @@ -543,10 +459,7 @@ MPU_xTaskGenericNotifyWait: b MPU_xTaskGenericNotifyWaitImpl MPU_xTaskGenericNotifyWait_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyWaitImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyWait /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyTake @@ -561,10 +474,7 @@ MPU_ulTaskGenericNotifyTake: b MPU_ulTaskGenericNotifyTakeImpl MPU_ulTaskGenericNotifyTake_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyTake /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGenericNotifyStateClear @@ -579,10 +489,7 @@ MPU_xTaskGenericNotifyStateClear: b MPU_xTaskGenericNotifyStateClearImpl MPU_xTaskGenericNotifyStateClear_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGenericNotifyStateClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyStateClear /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyValueClear @@ -597,10 +504,7 @@ MPU_ulTaskGenericNotifyValueClear: b MPU_ulTaskGenericNotifyValueClearImpl MPU_ulTaskGenericNotifyValueClear_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyValueClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyValueClear /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGenericSend @@ -615,10 +519,7 @@ MPU_xQueueGenericSend: b MPU_xQueueGenericSendImpl MPU_xQueueGenericSend_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGenericSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGenericSend /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueMessagesWaiting @@ -633,10 +534,7 @@ MPU_uxQueueMessagesWaiting: b MPU_uxQueueMessagesWaitingImpl MPU_uxQueueMessagesWaiting_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueMessagesWaitingImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueMessagesWaiting /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueSpacesAvailable @@ -651,10 +549,7 @@ MPU_uxQueueSpacesAvailable: b MPU_uxQueueSpacesAvailableImpl MPU_uxQueueSpacesAvailable_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueReceive @@ -669,10 +564,7 @@ MPU_xQueueReceive: b MPU_xQueueReceiveImpl MPU_xQueueReceive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueuePeek @@ -687,10 +579,7 @@ MPU_xQueuePeek: b MPU_xQueuePeekImpl MPU_xQueuePeek_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueuePeekImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueuePeek /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSemaphoreTake @@ -705,10 +594,7 @@ MPU_xQueueSemaphoreTake: b MPU_xQueueSemaphoreTakeImpl MPU_xQueueSemaphoreTake_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSemaphoreTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSemaphoreTake /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGetMutexHolder @@ -723,10 +609,7 @@ MPU_xQueueGetMutexHolder: b MPU_xQueueGetMutexHolderImpl MPU_xQueueGetMutexHolder_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGetMutexHolderImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGetMutexHolder /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueTakeMutexRecursive @@ -741,10 +624,7 @@ MPU_xQueueTakeMutexRecursive: b MPU_xQueueTakeMutexRecursiveImpl MPU_xQueueTakeMutexRecursive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueTakeMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueTakeMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGiveMutexRecursive @@ -759,10 +639,7 @@ MPU_xQueueGiveMutexRecursive: b MPU_xQueueGiveMutexRecursiveImpl MPU_xQueueGiveMutexRecursive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGiveMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGiveMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSelectFromSet @@ -777,10 +654,7 @@ MPU_xQueueSelectFromSet: b MPU_xQueueSelectFromSetImpl MPU_xQueueSelectFromSet_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSelectFromSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSelectFromSet /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueAddToSet @@ -795,10 +669,7 @@ MPU_xQueueAddToSet: b MPU_xQueueAddToSetImpl MPU_xQueueAddToSet_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueAddToSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueAddToSet /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueAddToRegistry @@ -813,10 +684,7 @@ MPU_vQueueAddToRegistry: b MPU_vQueueAddToRegistryImpl MPU_vQueueAddToRegistry_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueAddToRegistryImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueAddToRegistry /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueUnregisterQueue @@ -831,10 +699,7 @@ MPU_vQueueUnregisterQueue: b MPU_vQueueUnregisterQueueImpl MPU_vQueueUnregisterQueue_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueUnregisterQueueImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueUnregisterQueue /*-----------------------------------------------------------*/ PUBLIC MPU_pcQueueGetName @@ -849,10 +714,7 @@ MPU_pcQueueGetName: b MPU_pcQueueGetNameImpl MPU_pcQueueGetName_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcQueueGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcQueueGetName /*-----------------------------------------------------------*/ PUBLIC MPU_pvTimerGetTimerID @@ -867,10 +729,7 @@ MPU_pvTimerGetTimerID: b MPU_pvTimerGetTimerIDImpl MPU_pvTimerGetTimerID_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTimerGetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTimerGetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetTimerID @@ -885,10 +744,7 @@ MPU_vTimerSetTimerID: b MPU_vTimerSetTimerIDImpl MPU_vTimerSetTimerID_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerIsTimerActive @@ -903,10 +759,7 @@ MPU_xTimerIsTimerActive: b MPU_xTimerIsTimerActiveImpl MPU_xTimerIsTimerActive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerIsTimerActiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerIsTimerActive /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetTimerDaemonTaskHandle @@ -921,14 +774,11 @@ MPU_xTimerGetTimerDaemonTaskHandle: b MPU_xTimerGetTimerDaemonTaskHandleImpl MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetTimerDaemonTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle /*-----------------------------------------------------------*/ - PUBLIC MPU_xTimerGenericCommandFromTask -MPU_xTimerGenericCommandFromTask: + PUBLIC MPU_xTimerGenericCommandFromTaskEntry +MPU_xTimerGenericCommandFromTaskEntry: push {r0, r1} mrs r0, control movs r1, #1 @@ -939,10 +789,7 @@ MPU_xTimerGenericCommandFromTask: b MPU_xTimerGenericCommandFromTaskImpl MPU_xTimerGenericCommandFromTask_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTimerGenericCommandFromTaskImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGenericCommandFromTask /*-----------------------------------------------------------*/ PUBLIC MPU_pcTimerGetName @@ -957,10 +804,7 @@ MPU_pcTimerGetName: b MPU_pcTimerGetNameImpl MPU_pcTimerGetName_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcTimerGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcTimerGetName /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetReloadMode @@ -975,10 +819,7 @@ MPU_vTimerSetReloadMode: b MPU_vTimerSetReloadModeImpl MPU_vTimerSetReloadMode_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetReloadMode @@ -993,10 +834,7 @@ MPU_xTimerGetReloadMode: b MPU_xTimerGetReloadModeImpl MPU_xTimerGetReloadMode_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_uxTimerGetReloadMode @@ -1011,10 +849,7 @@ MPU_uxTimerGetReloadMode: b MPU_uxTimerGetReloadModeImpl MPU_uxTimerGetReloadMode_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetPeriod @@ -1029,10 +864,7 @@ MPU_xTimerGetPeriod: b MPU_xTimerGetPeriodImpl MPU_xTimerGetPeriod_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetPeriodImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetPeriod /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetExpiryTime @@ -1047,14 +879,11 @@ MPU_xTimerGetExpiryTime: b MPU_xTimerGetExpiryTimeImpl MPU_xTimerGetExpiryTime_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetExpiryTimeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetExpiryTime /*-----------------------------------------------------------*/ - PUBLIC MPU_xEventGroupWaitBits -MPU_xEventGroupWaitBits: + PUBLIC MPU_xEventGroupWaitBitsEntry +MPU_xEventGroupWaitBitsEntry: push {r0, r1} mrs r0, control movs r1, #1 @@ -1065,10 +894,7 @@ MPU_xEventGroupWaitBits: b MPU_xEventGroupWaitBitsImpl MPU_xEventGroupWaitBits_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xEventGroupWaitBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupWaitBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupClearBits @@ -1083,10 +909,7 @@ MPU_xEventGroupClearBits: b MPU_xEventGroupClearBitsImpl MPU_xEventGroupClearBits_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupClearBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupClearBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSetBits @@ -1101,10 +924,7 @@ MPU_xEventGroupSetBits: b MPU_xEventGroupSetBitsImpl MPU_xEventGroupSetBits_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSetBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSetBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSync @@ -1119,10 +939,7 @@ MPU_xEventGroupSync: b MPU_xEventGroupSyncImpl MPU_xEventGroupSync_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSyncImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSync /*-----------------------------------------------------------*/ PUBLIC MPU_uxEventGroupGetNumber @@ -1137,10 +954,7 @@ MPU_uxEventGroupGetNumber: b MPU_uxEventGroupGetNumberImpl MPU_uxEventGroupGetNumber_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxEventGroupGetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxEventGroupGetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_vEventGroupSetNumber @@ -1155,10 +969,7 @@ MPU_vEventGroupSetNumber: b MPU_vEventGroupSetNumberImpl MPU_vEventGroupSetNumber_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vEventGroupSetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vEventGroupSetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSend @@ -1173,10 +984,7 @@ MPU_xStreamBufferSend: b MPU_xStreamBufferSendImpl MPU_xStreamBufferSend_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSend /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferReceive @@ -1191,10 +999,7 @@ MPU_xStreamBufferReceive: b MPU_xStreamBufferReceiveImpl MPU_xStreamBufferReceive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsFull @@ -1209,10 +1014,7 @@ MPU_xStreamBufferIsFull: b MPU_xStreamBufferIsFullImpl MPU_xStreamBufferIsFull_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsFullImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsFull /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsEmpty @@ -1227,10 +1029,7 @@ MPU_xStreamBufferIsEmpty: b MPU_xStreamBufferIsEmptyImpl MPU_xStreamBufferIsEmpty_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsEmptyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsEmpty /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSpacesAvailable @@ -1245,10 +1044,7 @@ MPU_xStreamBufferSpacesAvailable: b MPU_xStreamBufferSpacesAvailableImpl MPU_xStreamBufferSpacesAvailable_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferBytesAvailable @@ -1263,10 +1059,7 @@ MPU_xStreamBufferBytesAvailable: b MPU_xStreamBufferBytesAvailableImpl MPU_xStreamBufferBytesAvailable_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferBytesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferBytesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSetTriggerLevel @@ -1281,10 +1074,7 @@ MPU_xStreamBufferSetTriggerLevel: b MPU_xStreamBufferSetTriggerLevelImpl MPU_xStreamBufferSetTriggerLevel_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSetTriggerLevelImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSetTriggerLevel /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferNextMessageLengthBytes @@ -1299,10 +1089,7 @@ MPU_xStreamBufferNextMessageLengthBytes: b MPU_xStreamBufferNextMessageLengthBytesImpl MPU_xStreamBufferNextMessageLengthBytes_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferNextMessageLengthBytesImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferNextMessageLengthBytes /*-----------------------------------------------------------*/ /* Default weak implementations in case one is not available from diff --git a/portable/IAR/ARM_CM23/non_secure/port.c b/portable/IAR/ARM_CM23/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/IAR/ARM_CM23/non_secure/port.c +++ b/portable/IAR/ARM_CM23/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM23/non_secure/portasm.s b/portable/IAR/ARM_CM23/non_secure/portasm.s index 8c7000909..06c761090 100644 --- a/portable/IAR/ARM_CM23/non_secure/portasm.s +++ b/portable/IAR/ARM_CM23/non_secure/portasm.s @@ -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 @@ -46,7 +49,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 @@ -96,7 +98,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. */ /*-----------------------------------------------------------*/ @@ -229,7 +231,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: @@ -479,21 +481,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 @@ -520,7 +518,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. */ /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM23/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM23/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/IAR/ARM_CM23/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM23/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM23_NTZ/non_secure/mpu_wrappers_v2_asm.S b/portable/IAR/ARM_CM23_NTZ/non_secure/mpu_wrappers_v2_asm.S index 5300a99ec..419df5b1e 100644 --- a/portable/IAR/ARM_CM23_NTZ/non_secure/mpu_wrappers_v2_asm.S +++ b/portable/IAR/ARM_CM23_NTZ/non_secure/mpu_wrappers_v2_asm.S @@ -32,15 +32,12 @@ /*-----------------------------------------------------------*/ #include "FreeRTOSConfig.h" +#include "mpu_syscall_numbers.h" #ifndef configUSE_MPU_WRAPPERS_V1 #define configUSE_MPU_WRAPPERS_V1 0 #endif -/* These must be in sync with portmacro.h. */ -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) @@ -57,10 +54,7 @@ MPU_xTaskDelayUntil: b MPU_xTaskDelayUntilImpl MPU_xTaskDelayUntil_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskDelayUntilImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskDelayUntil /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskAbortDelay @@ -75,10 +69,7 @@ MPU_xTaskAbortDelay: b MPU_xTaskAbortDelayImpl MPU_xTaskAbortDelay_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskAbortDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskAbortDelay /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskDelay @@ -93,10 +84,7 @@ MPU_vTaskDelay: b MPU_vTaskDelayImpl MPU_vTaskDelay_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskDelay /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskPriorityGet @@ -111,10 +99,7 @@ MPU_uxTaskPriorityGet: b MPU_uxTaskPriorityGetImpl MPU_uxTaskPriorityGet_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskPriorityGetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskPriorityGet /*-----------------------------------------------------------*/ PUBLIC MPU_eTaskGetState @@ -129,10 +114,7 @@ MPU_eTaskGetState: b MPU_eTaskGetStateImpl MPU_eTaskGetState_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_eTaskGetStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_eTaskGetState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskGetInfo @@ -147,10 +129,7 @@ MPU_vTaskGetInfo: b MPU_vTaskGetInfoImpl MPU_vTaskGetInfo_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskGetInfoImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskGetInfo /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetIdleTaskHandle @@ -165,10 +144,7 @@ MPU_xTaskGetIdleTaskHandle: b MPU_xTaskGetIdleTaskHandleImpl MPU_xTaskGetIdleTaskHandle_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetIdleTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetIdleTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSuspend @@ -183,10 +159,7 @@ MPU_vTaskSuspend: b MPU_vTaskSuspendImpl MPU_vTaskSuspend_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSuspendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSuspend /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskResume @@ -201,10 +174,7 @@ MPU_vTaskResume: b MPU_vTaskResumeImpl MPU_vTaskResume_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskResumeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskResume /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetTickCount @@ -219,10 +189,7 @@ MPU_xTaskGetTickCount: b MPU_xTaskGetTickCountImpl MPU_xTaskGetTickCount_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetTickCountImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetTickCount /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetNumberOfTasks @@ -237,10 +204,7 @@ MPU_uxTaskGetNumberOfTasks: b MPU_uxTaskGetNumberOfTasksImpl MPU_uxTaskGetNumberOfTasks_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetNumberOfTasksImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetNumberOfTasks /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimeCounter @@ -255,10 +219,7 @@ MPU_ulTaskGetRunTimeCounter: b MPU_ulTaskGetRunTimeCounterImpl MPU_ulTaskGetRunTimeCounter_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimePercent @@ -273,10 +234,7 @@ MPU_ulTaskGetRunTimePercent: b MPU_ulTaskGetRunTimePercentImpl MPU_ulTaskGetRunTimePercent_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimePercent @@ -291,10 +249,7 @@ MPU_ulTaskGetIdleRunTimePercent: b MPU_ulTaskGetIdleRunTimePercentImpl MPU_ulTaskGetIdleRunTimePercent_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimeCounter @@ -309,10 +264,7 @@ MPU_ulTaskGetIdleRunTimeCounter: b MPU_ulTaskGetIdleRunTimeCounterImpl MPU_ulTaskGetIdleRunTimeCounter_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetApplicationTaskTag @@ -327,10 +279,7 @@ MPU_vTaskSetApplicationTaskTag: b MPU_vTaskSetApplicationTaskTagImpl MPU_vTaskSetApplicationTaskTag_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetApplicationTaskTag @@ -345,10 +294,7 @@ MPU_xTaskGetApplicationTaskTag: b MPU_xTaskGetApplicationTaskTagImpl MPU_xTaskGetApplicationTaskTag_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetThreadLocalStoragePointer @@ -363,10 +309,7 @@ MPU_vTaskSetThreadLocalStoragePointer: b MPU_vTaskSetThreadLocalStoragePointerImpl MPU_vTaskSetThreadLocalStoragePointer_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_pvTaskGetThreadLocalStoragePointer @@ -381,10 +324,7 @@ MPU_pvTaskGetThreadLocalStoragePointer: b MPU_pvTaskGetThreadLocalStoragePointerImpl MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTaskGetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetSystemState @@ -399,10 +339,7 @@ MPU_uxTaskGetSystemState: b MPU_uxTaskGetSystemStateImpl MPU_uxTaskGetSystemState_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetSystemStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetSystemState /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark @@ -417,10 +354,7 @@ MPU_uxTaskGetStackHighWaterMark: b MPU_uxTaskGetStackHighWaterMarkImpl MPU_uxTaskGetStackHighWaterMark_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMarkImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark2 @@ -435,10 +369,7 @@ MPU_uxTaskGetStackHighWaterMark2: b MPU_uxTaskGetStackHighWaterMark2Impl MPU_uxTaskGetStackHighWaterMark2_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMark2Impl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark2 /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetCurrentTaskHandle @@ -453,10 +384,7 @@ MPU_xTaskGetCurrentTaskHandle: b MPU_xTaskGetCurrentTaskHandleImpl MPU_xTaskGetCurrentTaskHandle_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetCurrentTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetCurrentTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetSchedulerState @@ -471,10 +399,7 @@ MPU_xTaskGetSchedulerState: b MPU_xTaskGetSchedulerStateImpl MPU_xTaskGetSchedulerState_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetSchedulerStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetSchedulerState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetTimeOutState @@ -489,10 +414,7 @@ MPU_vTaskSetTimeOutState: b MPU_vTaskSetTimeOutStateImpl MPU_vTaskSetTimeOutState_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetTimeOutStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetTimeOutState /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskCheckForTimeOut @@ -507,14 +429,11 @@ MPU_xTaskCheckForTimeOut: b MPU_xTaskCheckForTimeOutImpl MPU_xTaskCheckForTimeOut_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskCheckForTimeOutImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskCheckForTimeOut /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotify -MPU_xTaskGenericNotify: + PUBLIC MPU_xTaskGenericNotifyEntry +MPU_xTaskGenericNotifyEntry: push {r0, r1} mrs r0, control movs r1, #1 @@ -525,14 +444,11 @@ MPU_xTaskGenericNotify: b MPU_xTaskGenericNotifyImpl MPU_xTaskGenericNotify_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotify /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotifyWait -MPU_xTaskGenericNotifyWait: + PUBLIC MPU_xTaskGenericNotifyWaitEntry +MPU_xTaskGenericNotifyWaitEntry: push {r0, r1} mrs r0, control movs r1, #1 @@ -543,10 +459,7 @@ MPU_xTaskGenericNotifyWait: b MPU_xTaskGenericNotifyWaitImpl MPU_xTaskGenericNotifyWait_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyWaitImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyWait /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyTake @@ -561,10 +474,7 @@ MPU_ulTaskGenericNotifyTake: b MPU_ulTaskGenericNotifyTakeImpl MPU_ulTaskGenericNotifyTake_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyTake /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGenericNotifyStateClear @@ -579,10 +489,7 @@ MPU_xTaskGenericNotifyStateClear: b MPU_xTaskGenericNotifyStateClearImpl MPU_xTaskGenericNotifyStateClear_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGenericNotifyStateClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyStateClear /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyValueClear @@ -597,10 +504,7 @@ MPU_ulTaskGenericNotifyValueClear: b MPU_ulTaskGenericNotifyValueClearImpl MPU_ulTaskGenericNotifyValueClear_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyValueClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyValueClear /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGenericSend @@ -615,10 +519,7 @@ MPU_xQueueGenericSend: b MPU_xQueueGenericSendImpl MPU_xQueueGenericSend_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGenericSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGenericSend /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueMessagesWaiting @@ -633,10 +534,7 @@ MPU_uxQueueMessagesWaiting: b MPU_uxQueueMessagesWaitingImpl MPU_uxQueueMessagesWaiting_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueMessagesWaitingImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueMessagesWaiting /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueSpacesAvailable @@ -651,10 +549,7 @@ MPU_uxQueueSpacesAvailable: b MPU_uxQueueSpacesAvailableImpl MPU_uxQueueSpacesAvailable_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueReceive @@ -669,10 +564,7 @@ MPU_xQueueReceive: b MPU_xQueueReceiveImpl MPU_xQueueReceive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueuePeek @@ -687,10 +579,7 @@ MPU_xQueuePeek: b MPU_xQueuePeekImpl MPU_xQueuePeek_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueuePeekImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueuePeek /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSemaphoreTake @@ -705,10 +594,7 @@ MPU_xQueueSemaphoreTake: b MPU_xQueueSemaphoreTakeImpl MPU_xQueueSemaphoreTake_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSemaphoreTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSemaphoreTake /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGetMutexHolder @@ -723,10 +609,7 @@ MPU_xQueueGetMutexHolder: b MPU_xQueueGetMutexHolderImpl MPU_xQueueGetMutexHolder_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGetMutexHolderImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGetMutexHolder /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueTakeMutexRecursive @@ -741,10 +624,7 @@ MPU_xQueueTakeMutexRecursive: b MPU_xQueueTakeMutexRecursiveImpl MPU_xQueueTakeMutexRecursive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueTakeMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueTakeMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGiveMutexRecursive @@ -759,10 +639,7 @@ MPU_xQueueGiveMutexRecursive: b MPU_xQueueGiveMutexRecursiveImpl MPU_xQueueGiveMutexRecursive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGiveMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGiveMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSelectFromSet @@ -777,10 +654,7 @@ MPU_xQueueSelectFromSet: b MPU_xQueueSelectFromSetImpl MPU_xQueueSelectFromSet_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSelectFromSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSelectFromSet /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueAddToSet @@ -795,10 +669,7 @@ MPU_xQueueAddToSet: b MPU_xQueueAddToSetImpl MPU_xQueueAddToSet_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueAddToSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueAddToSet /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueAddToRegistry @@ -813,10 +684,7 @@ MPU_vQueueAddToRegistry: b MPU_vQueueAddToRegistryImpl MPU_vQueueAddToRegistry_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueAddToRegistryImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueAddToRegistry /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueUnregisterQueue @@ -831,10 +699,7 @@ MPU_vQueueUnregisterQueue: b MPU_vQueueUnregisterQueueImpl MPU_vQueueUnregisterQueue_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueUnregisterQueueImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueUnregisterQueue /*-----------------------------------------------------------*/ PUBLIC MPU_pcQueueGetName @@ -849,10 +714,7 @@ MPU_pcQueueGetName: b MPU_pcQueueGetNameImpl MPU_pcQueueGetName_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcQueueGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcQueueGetName /*-----------------------------------------------------------*/ PUBLIC MPU_pvTimerGetTimerID @@ -867,10 +729,7 @@ MPU_pvTimerGetTimerID: b MPU_pvTimerGetTimerIDImpl MPU_pvTimerGetTimerID_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTimerGetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTimerGetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetTimerID @@ -885,10 +744,7 @@ MPU_vTimerSetTimerID: b MPU_vTimerSetTimerIDImpl MPU_vTimerSetTimerID_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerIsTimerActive @@ -903,10 +759,7 @@ MPU_xTimerIsTimerActive: b MPU_xTimerIsTimerActiveImpl MPU_xTimerIsTimerActive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerIsTimerActiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerIsTimerActive /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetTimerDaemonTaskHandle @@ -921,14 +774,11 @@ MPU_xTimerGetTimerDaemonTaskHandle: b MPU_xTimerGetTimerDaemonTaskHandleImpl MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetTimerDaemonTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle /*-----------------------------------------------------------*/ - PUBLIC MPU_xTimerGenericCommandFromTask -MPU_xTimerGenericCommandFromTask: + PUBLIC MPU_xTimerGenericCommandFromTaskEntry +MPU_xTimerGenericCommandFromTaskEntry: push {r0, r1} mrs r0, control movs r1, #1 @@ -939,10 +789,7 @@ MPU_xTimerGenericCommandFromTask: b MPU_xTimerGenericCommandFromTaskImpl MPU_xTimerGenericCommandFromTask_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTimerGenericCommandFromTaskImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGenericCommandFromTask /*-----------------------------------------------------------*/ PUBLIC MPU_pcTimerGetName @@ -957,10 +804,7 @@ MPU_pcTimerGetName: b MPU_pcTimerGetNameImpl MPU_pcTimerGetName_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcTimerGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcTimerGetName /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetReloadMode @@ -975,10 +819,7 @@ MPU_vTimerSetReloadMode: b MPU_vTimerSetReloadModeImpl MPU_vTimerSetReloadMode_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetReloadMode @@ -993,10 +834,7 @@ MPU_xTimerGetReloadMode: b MPU_xTimerGetReloadModeImpl MPU_xTimerGetReloadMode_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_uxTimerGetReloadMode @@ -1011,10 +849,7 @@ MPU_uxTimerGetReloadMode: b MPU_uxTimerGetReloadModeImpl MPU_uxTimerGetReloadMode_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetPeriod @@ -1029,10 +864,7 @@ MPU_xTimerGetPeriod: b MPU_xTimerGetPeriodImpl MPU_xTimerGetPeriod_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetPeriodImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetPeriod /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetExpiryTime @@ -1047,14 +879,11 @@ MPU_xTimerGetExpiryTime: b MPU_xTimerGetExpiryTimeImpl MPU_xTimerGetExpiryTime_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetExpiryTimeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetExpiryTime /*-----------------------------------------------------------*/ - PUBLIC MPU_xEventGroupWaitBits -MPU_xEventGroupWaitBits: + PUBLIC MPU_xEventGroupWaitBitsEntry +MPU_xEventGroupWaitBitsEntry: push {r0, r1} mrs r0, control movs r1, #1 @@ -1065,10 +894,7 @@ MPU_xEventGroupWaitBits: b MPU_xEventGroupWaitBitsImpl MPU_xEventGroupWaitBits_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xEventGroupWaitBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupWaitBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupClearBits @@ -1083,10 +909,7 @@ MPU_xEventGroupClearBits: b MPU_xEventGroupClearBitsImpl MPU_xEventGroupClearBits_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupClearBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupClearBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSetBits @@ -1101,10 +924,7 @@ MPU_xEventGroupSetBits: b MPU_xEventGroupSetBitsImpl MPU_xEventGroupSetBits_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSetBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSetBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSync @@ -1119,10 +939,7 @@ MPU_xEventGroupSync: b MPU_xEventGroupSyncImpl MPU_xEventGroupSync_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSyncImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSync /*-----------------------------------------------------------*/ PUBLIC MPU_uxEventGroupGetNumber @@ -1137,10 +954,7 @@ MPU_uxEventGroupGetNumber: b MPU_uxEventGroupGetNumberImpl MPU_uxEventGroupGetNumber_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxEventGroupGetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxEventGroupGetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_vEventGroupSetNumber @@ -1155,10 +969,7 @@ MPU_vEventGroupSetNumber: b MPU_vEventGroupSetNumberImpl MPU_vEventGroupSetNumber_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vEventGroupSetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vEventGroupSetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSend @@ -1173,10 +984,7 @@ MPU_xStreamBufferSend: b MPU_xStreamBufferSendImpl MPU_xStreamBufferSend_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSend /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferReceive @@ -1191,10 +999,7 @@ MPU_xStreamBufferReceive: b MPU_xStreamBufferReceiveImpl MPU_xStreamBufferReceive_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsFull @@ -1209,10 +1014,7 @@ MPU_xStreamBufferIsFull: b MPU_xStreamBufferIsFullImpl MPU_xStreamBufferIsFull_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsFullImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsFull /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsEmpty @@ -1227,10 +1029,7 @@ MPU_xStreamBufferIsEmpty: b MPU_xStreamBufferIsEmptyImpl MPU_xStreamBufferIsEmpty_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsEmptyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsEmpty /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSpacesAvailable @@ -1245,10 +1044,7 @@ MPU_xStreamBufferSpacesAvailable: b MPU_xStreamBufferSpacesAvailableImpl MPU_xStreamBufferSpacesAvailable_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferBytesAvailable @@ -1263,10 +1059,7 @@ MPU_xStreamBufferBytesAvailable: b MPU_xStreamBufferBytesAvailableImpl MPU_xStreamBufferBytesAvailable_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferBytesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferBytesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSetTriggerLevel @@ -1281,10 +1074,7 @@ MPU_xStreamBufferSetTriggerLevel: b MPU_xStreamBufferSetTriggerLevelImpl MPU_xStreamBufferSetTriggerLevel_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSetTriggerLevelImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSetTriggerLevel /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferNextMessageLengthBytes @@ -1299,10 +1089,7 @@ MPU_xStreamBufferNextMessageLengthBytes: b MPU_xStreamBufferNextMessageLengthBytesImpl MPU_xStreamBufferNextMessageLengthBytes_Unpriv: pop {r0, r1} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferNextMessageLengthBytesImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferNextMessageLengthBytes /*-----------------------------------------------------------*/ /* Default weak implementations in case one is not available from diff --git a/portable/IAR/ARM_CM23_NTZ/non_secure/port.c b/portable/IAR/ARM_CM23_NTZ/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/IAR/ARM_CM23_NTZ/non_secure/port.c +++ b/portable/IAR/ARM_CM23_NTZ/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM23_NTZ/non_secure/portasm.s b/portable/IAR/ARM_CM23_NTZ/non_secure/portasm.s index 836a927c8..d4487dfac 100644 --- a/portable/IAR/ARM_CM23_NTZ/non_secure/portasm.s +++ b/portable/IAR/ARM_CM23_NTZ/non_secure/portasm.s @@ -32,6 +32,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 vPortSVCHandler_C #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) EXTERN vSystemCallEnter - EXTERN vSystemCallEnter_1 EXTERN vSystemCallExit #endif @@ -224,7 +226,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. */ nop /*-----------------------------------------------------------*/ @@ -421,21 +423,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 diff --git a/portable/IAR/ARM_CM23_NTZ/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM23_NTZ/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/IAR/ARM_CM23_NTZ/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM23_NTZ/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM33/non_secure/mpu_wrappers_v2_asm.S b/portable/IAR/ARM_CM33/non_secure/mpu_wrappers_v2_asm.S index 1005dad33..80d5a1c63 100644 --- a/portable/IAR/ARM_CM33/non_secure/mpu_wrappers_v2_asm.S +++ b/portable/IAR/ARM_CM33/non_secure/mpu_wrappers_v2_asm.S @@ -32,15 +32,12 @@ /*-----------------------------------------------------------*/ #include "FreeRTOSConfig.h" +#include "mpu_syscall_numbers.h" #ifndef configUSE_MPU_WRAPPERS_V1 #define configUSE_MPU_WRAPPERS_V1 0 #endif -/* These must be in sync with portmacro.h. */ -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) @@ -56,10 +53,7 @@ MPU_xTaskDelayUntil: b MPU_xTaskDelayUntilImpl MPU_xTaskDelayUntil_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskDelayUntilImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskDelayUntil /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskAbortDelay @@ -73,10 +67,7 @@ MPU_xTaskAbortDelay: b MPU_xTaskAbortDelayImpl MPU_xTaskAbortDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskAbortDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskAbortDelay /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskDelay @@ -90,10 +81,7 @@ MPU_vTaskDelay: b MPU_vTaskDelayImpl MPU_vTaskDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskDelay /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskPriorityGet @@ -107,10 +95,7 @@ MPU_uxTaskPriorityGet: b MPU_uxTaskPriorityGetImpl MPU_uxTaskPriorityGet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskPriorityGetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskPriorityGet /*-----------------------------------------------------------*/ PUBLIC MPU_eTaskGetState @@ -124,10 +109,7 @@ MPU_eTaskGetState: b MPU_eTaskGetStateImpl MPU_eTaskGetState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_eTaskGetStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_eTaskGetState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskGetInfo @@ -141,10 +123,7 @@ MPU_vTaskGetInfo: b MPU_vTaskGetInfoImpl MPU_vTaskGetInfo_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskGetInfoImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskGetInfo /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetIdleTaskHandle @@ -158,10 +137,7 @@ MPU_xTaskGetIdleTaskHandle: b MPU_xTaskGetIdleTaskHandleImpl MPU_xTaskGetIdleTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetIdleTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetIdleTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSuspend @@ -175,10 +151,7 @@ MPU_vTaskSuspend: b MPU_vTaskSuspendImpl MPU_vTaskSuspend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSuspendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSuspend /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskResume @@ -192,10 +165,7 @@ MPU_vTaskResume: b MPU_vTaskResumeImpl MPU_vTaskResume_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskResumeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskResume /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetTickCount @@ -209,10 +179,7 @@ MPU_xTaskGetTickCount: b MPU_xTaskGetTickCountImpl MPU_xTaskGetTickCount_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetTickCountImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetTickCount /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetNumberOfTasks @@ -226,10 +193,7 @@ MPU_uxTaskGetNumberOfTasks: b MPU_uxTaskGetNumberOfTasksImpl MPU_uxTaskGetNumberOfTasks_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetNumberOfTasksImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetNumberOfTasks /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimeCounter @@ -243,10 +207,7 @@ MPU_ulTaskGetRunTimeCounter: b MPU_ulTaskGetRunTimeCounterImpl MPU_ulTaskGetRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimePercent @@ -260,10 +221,7 @@ MPU_ulTaskGetRunTimePercent: b MPU_ulTaskGetRunTimePercentImpl MPU_ulTaskGetRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimePercent @@ -277,10 +235,7 @@ MPU_ulTaskGetIdleRunTimePercent: b MPU_ulTaskGetIdleRunTimePercentImpl MPU_ulTaskGetIdleRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimeCounter @@ -294,10 +249,7 @@ MPU_ulTaskGetIdleRunTimeCounter: b MPU_ulTaskGetIdleRunTimeCounterImpl MPU_ulTaskGetIdleRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetApplicationTaskTag @@ -311,10 +263,7 @@ MPU_vTaskSetApplicationTaskTag: b MPU_vTaskSetApplicationTaskTagImpl MPU_vTaskSetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetApplicationTaskTag @@ -328,10 +277,7 @@ MPU_xTaskGetApplicationTaskTag: b MPU_xTaskGetApplicationTaskTagImpl MPU_xTaskGetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetThreadLocalStoragePointer @@ -345,10 +291,7 @@ MPU_vTaskSetThreadLocalStoragePointer: b MPU_vTaskSetThreadLocalStoragePointerImpl MPU_vTaskSetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_pvTaskGetThreadLocalStoragePointer @@ -362,10 +305,7 @@ MPU_pvTaskGetThreadLocalStoragePointer: b MPU_pvTaskGetThreadLocalStoragePointerImpl MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTaskGetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetSystemState @@ -379,10 +319,7 @@ MPU_uxTaskGetSystemState: b MPU_uxTaskGetSystemStateImpl MPU_uxTaskGetSystemState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetSystemStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetSystemState /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark @@ -396,10 +333,7 @@ MPU_uxTaskGetStackHighWaterMark: b MPU_uxTaskGetStackHighWaterMarkImpl MPU_uxTaskGetStackHighWaterMark_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMarkImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark2 @@ -413,10 +347,7 @@ MPU_uxTaskGetStackHighWaterMark2: b MPU_uxTaskGetStackHighWaterMark2Impl MPU_uxTaskGetStackHighWaterMark2_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMark2Impl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark2 /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetCurrentTaskHandle @@ -430,10 +361,7 @@ MPU_xTaskGetCurrentTaskHandle: b MPU_xTaskGetCurrentTaskHandleImpl MPU_xTaskGetCurrentTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetCurrentTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetCurrentTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetSchedulerState @@ -447,10 +375,7 @@ MPU_xTaskGetSchedulerState: b MPU_xTaskGetSchedulerStateImpl MPU_xTaskGetSchedulerState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetSchedulerStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetSchedulerState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetTimeOutState @@ -464,10 +389,7 @@ MPU_vTaskSetTimeOutState: b MPU_vTaskSetTimeOutStateImpl MPU_vTaskSetTimeOutState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetTimeOutStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetTimeOutState /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskCheckForTimeOut @@ -481,14 +403,11 @@ MPU_xTaskCheckForTimeOut: b MPU_xTaskCheckForTimeOutImpl MPU_xTaskCheckForTimeOut_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskCheckForTimeOutImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskCheckForTimeOut /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotify -MPU_xTaskGenericNotify: + PUBLIC MPU_xTaskGenericNotifyEntry +MPU_xTaskGenericNotifyEntry: push {r0} mrs r0, control tst r0, #1 @@ -498,14 +417,11 @@ MPU_xTaskGenericNotify: b MPU_xTaskGenericNotifyImpl MPU_xTaskGenericNotify_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotify /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotifyWait -MPU_xTaskGenericNotifyWait: + PUBLIC MPU_xTaskGenericNotifyWaitEntry +MPU_xTaskGenericNotifyWaitEntry: push {r0} mrs r0, control tst r0, #1 @@ -515,10 +431,7 @@ MPU_xTaskGenericNotifyWait: b MPU_xTaskGenericNotifyWaitImpl MPU_xTaskGenericNotifyWait_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyWaitImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyWait /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyTake @@ -532,10 +445,7 @@ MPU_ulTaskGenericNotifyTake: b MPU_ulTaskGenericNotifyTakeImpl MPU_ulTaskGenericNotifyTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyTake /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGenericNotifyStateClear @@ -549,10 +459,7 @@ MPU_xTaskGenericNotifyStateClear: b MPU_xTaskGenericNotifyStateClearImpl MPU_xTaskGenericNotifyStateClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGenericNotifyStateClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyStateClear /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyValueClear @@ -566,10 +473,7 @@ MPU_ulTaskGenericNotifyValueClear: b MPU_ulTaskGenericNotifyValueClearImpl MPU_ulTaskGenericNotifyValueClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyValueClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyValueClear /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGenericSend @@ -583,10 +487,7 @@ MPU_xQueueGenericSend: b MPU_xQueueGenericSendImpl MPU_xQueueGenericSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGenericSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGenericSend /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueMessagesWaiting @@ -600,10 +501,7 @@ MPU_uxQueueMessagesWaiting: b MPU_uxQueueMessagesWaitingImpl MPU_uxQueueMessagesWaiting_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueMessagesWaitingImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueMessagesWaiting /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueSpacesAvailable @@ -617,10 +515,7 @@ MPU_uxQueueSpacesAvailable: b MPU_uxQueueSpacesAvailableImpl MPU_uxQueueSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueReceive @@ -634,10 +529,7 @@ MPU_xQueueReceive: b MPU_xQueueReceiveImpl MPU_xQueueReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueuePeek @@ -651,10 +543,7 @@ MPU_xQueuePeek: b MPU_xQueuePeekImpl MPU_xQueuePeek_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueuePeekImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueuePeek /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSemaphoreTake @@ -668,10 +557,7 @@ MPU_xQueueSemaphoreTake: b MPU_xQueueSemaphoreTakeImpl MPU_xQueueSemaphoreTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSemaphoreTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSemaphoreTake /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGetMutexHolder @@ -685,10 +571,7 @@ MPU_xQueueGetMutexHolder: b MPU_xQueueGetMutexHolderImpl MPU_xQueueGetMutexHolder_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGetMutexHolderImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGetMutexHolder /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueTakeMutexRecursive @@ -702,10 +585,7 @@ MPU_xQueueTakeMutexRecursive: b MPU_xQueueTakeMutexRecursiveImpl MPU_xQueueTakeMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueTakeMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueTakeMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGiveMutexRecursive @@ -719,10 +599,7 @@ MPU_xQueueGiveMutexRecursive: b MPU_xQueueGiveMutexRecursiveImpl MPU_xQueueGiveMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGiveMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGiveMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSelectFromSet @@ -736,10 +613,7 @@ MPU_xQueueSelectFromSet: b MPU_xQueueSelectFromSetImpl MPU_xQueueSelectFromSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSelectFromSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSelectFromSet /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueAddToSet @@ -753,10 +627,7 @@ MPU_xQueueAddToSet: b MPU_xQueueAddToSetImpl MPU_xQueueAddToSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueAddToSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueAddToSet /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueAddToRegistry @@ -770,10 +641,7 @@ MPU_vQueueAddToRegistry: b MPU_vQueueAddToRegistryImpl MPU_vQueueAddToRegistry_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueAddToRegistryImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueAddToRegistry /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueUnregisterQueue @@ -787,10 +655,7 @@ MPU_vQueueUnregisterQueue: b MPU_vQueueUnregisterQueueImpl MPU_vQueueUnregisterQueue_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueUnregisterQueueImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueUnregisterQueue /*-----------------------------------------------------------*/ PUBLIC MPU_pcQueueGetName @@ -804,10 +669,7 @@ MPU_pcQueueGetName: b MPU_pcQueueGetNameImpl MPU_pcQueueGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcQueueGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcQueueGetName /*-----------------------------------------------------------*/ PUBLIC MPU_pvTimerGetTimerID @@ -821,10 +683,7 @@ MPU_pvTimerGetTimerID: b MPU_pvTimerGetTimerIDImpl MPU_pvTimerGetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTimerGetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTimerGetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetTimerID @@ -838,10 +697,7 @@ MPU_vTimerSetTimerID: b MPU_vTimerSetTimerIDImpl MPU_vTimerSetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerIsTimerActive @@ -855,10 +711,7 @@ MPU_xTimerIsTimerActive: b MPU_xTimerIsTimerActiveImpl MPU_xTimerIsTimerActive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerIsTimerActiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerIsTimerActive /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetTimerDaemonTaskHandle @@ -872,14 +725,11 @@ MPU_xTimerGetTimerDaemonTaskHandle: b MPU_xTimerGetTimerDaemonTaskHandleImpl MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetTimerDaemonTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle /*-----------------------------------------------------------*/ - PUBLIC MPU_xTimerGenericCommandFromTask -MPU_xTimerGenericCommandFromTask: + PUBLIC MPU_xTimerGenericCommandFromTaskEntry +MPU_xTimerGenericCommandFromTaskEntry: push {r0} mrs r0, control tst r0, #1 @@ -889,10 +739,7 @@ MPU_xTimerGenericCommandFromTask: b MPU_xTimerGenericCommandFromTaskImpl MPU_xTimerGenericCommandFromTask_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTimerGenericCommandFromTaskImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGenericCommandFromTask /*-----------------------------------------------------------*/ PUBLIC MPU_pcTimerGetName @@ -906,10 +753,7 @@ MPU_pcTimerGetName: b MPU_pcTimerGetNameImpl MPU_pcTimerGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcTimerGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcTimerGetName /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetReloadMode @@ -923,10 +767,7 @@ MPU_vTimerSetReloadMode: b MPU_vTimerSetReloadModeImpl MPU_vTimerSetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetReloadMode @@ -940,10 +781,7 @@ MPU_xTimerGetReloadMode: b MPU_xTimerGetReloadModeImpl MPU_xTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_uxTimerGetReloadMode @@ -957,10 +795,7 @@ MPU_uxTimerGetReloadMode: b MPU_uxTimerGetReloadModeImpl MPU_uxTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetPeriod @@ -974,10 +809,7 @@ MPU_xTimerGetPeriod: b MPU_xTimerGetPeriodImpl MPU_xTimerGetPeriod_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetPeriodImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetPeriod /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetExpiryTime @@ -991,14 +823,11 @@ MPU_xTimerGetExpiryTime: b MPU_xTimerGetExpiryTimeImpl MPU_xTimerGetExpiryTime_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetExpiryTimeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetExpiryTime /*-----------------------------------------------------------*/ - PUBLIC MPU_xEventGroupWaitBits -MPU_xEventGroupWaitBits: + PUBLIC MPU_xEventGroupWaitBitsEntry +MPU_xEventGroupWaitBitsEntry: push {r0} mrs r0, control tst r0, #1 @@ -1008,10 +837,7 @@ MPU_xEventGroupWaitBits: b MPU_xEventGroupWaitBitsImpl MPU_xEventGroupWaitBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xEventGroupWaitBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupWaitBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupClearBits @@ -1025,10 +851,7 @@ MPU_xEventGroupClearBits: b MPU_xEventGroupClearBitsImpl MPU_xEventGroupClearBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupClearBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupClearBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSetBits @@ -1042,10 +865,7 @@ MPU_xEventGroupSetBits: b MPU_xEventGroupSetBitsImpl MPU_xEventGroupSetBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSetBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSetBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSync @@ -1059,10 +879,7 @@ MPU_xEventGroupSync: b MPU_xEventGroupSyncImpl MPU_xEventGroupSync_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSyncImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSync /*-----------------------------------------------------------*/ PUBLIC MPU_uxEventGroupGetNumber @@ -1076,10 +893,7 @@ MPU_uxEventGroupGetNumber: b MPU_uxEventGroupGetNumberImpl MPU_uxEventGroupGetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxEventGroupGetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxEventGroupGetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_vEventGroupSetNumber @@ -1093,10 +907,7 @@ MPU_vEventGroupSetNumber: b MPU_vEventGroupSetNumberImpl MPU_vEventGroupSetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vEventGroupSetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vEventGroupSetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSend @@ -1110,10 +921,7 @@ MPU_xStreamBufferSend: b MPU_xStreamBufferSendImpl MPU_xStreamBufferSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSend /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferReceive @@ -1127,10 +935,7 @@ MPU_xStreamBufferReceive: b MPU_xStreamBufferReceiveImpl MPU_xStreamBufferReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsFull @@ -1144,10 +949,7 @@ MPU_xStreamBufferIsFull: b MPU_xStreamBufferIsFullImpl MPU_xStreamBufferIsFull_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsFullImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsFull /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsEmpty @@ -1161,10 +963,7 @@ MPU_xStreamBufferIsEmpty: b MPU_xStreamBufferIsEmptyImpl MPU_xStreamBufferIsEmpty_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsEmptyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsEmpty /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSpacesAvailable @@ -1178,10 +977,7 @@ MPU_xStreamBufferSpacesAvailable: b MPU_xStreamBufferSpacesAvailableImpl MPU_xStreamBufferSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferBytesAvailable @@ -1195,10 +991,7 @@ MPU_xStreamBufferBytesAvailable: b MPU_xStreamBufferBytesAvailableImpl MPU_xStreamBufferBytesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferBytesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferBytesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSetTriggerLevel @@ -1212,10 +1005,7 @@ MPU_xStreamBufferSetTriggerLevel: b MPU_xStreamBufferSetTriggerLevelImpl MPU_xStreamBufferSetTriggerLevel_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSetTriggerLevelImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSetTriggerLevel /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferNextMessageLengthBytes @@ -1229,10 +1019,7 @@ MPU_xStreamBufferNextMessageLengthBytes: b MPU_xStreamBufferNextMessageLengthBytesImpl MPU_xStreamBufferNextMessageLengthBytes_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferNextMessageLengthBytesImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferNextMessageLengthBytes /*-----------------------------------------------------------*/ /* Default weak implementations in case one is not available from diff --git a/portable/IAR/ARM_CM33/non_secure/port.c b/portable/IAR/ARM_CM33/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/IAR/ARM_CM33/non_secure/port.c +++ b/portable/IAR/ARM_CM33/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM33/non_secure/portasm.s b/portable/IAR/ARM_CM33/non_secure/portasm.s index 15e74ffc1..d8f1b1d9a 100644 --- a/portable/IAR/ARM_CM33/non_secure/portasm.s +++ b/portable/IAR/ARM_CM33/non_secure/portasm.s @@ -32,6 +32,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 @@ -44,7 +47,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 @@ -86,7 +88,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. */ /*-----------------------------------------------------------*/ @@ -205,7 +207,7 @@ vStartFirstTask: cpsie f 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: @@ -455,11 +457,9 @@ SVC_Handler: ldr r1, [r0, #24] ldrb r2, [r1, #-2] - cmp r2, #4 /* portSVC_SYSTEM_CALL_ENTER. */ - beq syscall_enter - cmp r2, #5 /* portSVC_SYSTEM_CALL_ENTER_1. */ - beq syscall_enter_1 - cmp r2, #6 /* portSVC_SYSTEM_CALL_EXIT. */ + cmp r2, #NUM_SYSTEM_CALLS + blt syscall_enter + cmp r2, #104 /* portSVC_SYSTEM_CALL_EXIT. */ beq syscall_exit b vPortSVCHandler_C @@ -467,10 +467,6 @@ SVC_Handler: mov r1, lr b vSystemCallEnter - syscall_enter_1: - mov r1, lr - b vSystemCallEnter_1 - syscall_exit: mov r1, lr b vSystemCallExit @@ -493,7 +489,7 @@ vPortFreeSecureContext: ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */ cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */ it ne - svcne 1 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 1. */ + svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */ bx lr /* Return. */ /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM33/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM33/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/IAR/ARM_CM33/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM33/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM33_NTZ/non_secure/mpu_wrappers_v2_asm.S b/portable/IAR/ARM_CM33_NTZ/non_secure/mpu_wrappers_v2_asm.S index 1005dad33..80d5a1c63 100644 --- a/portable/IAR/ARM_CM33_NTZ/non_secure/mpu_wrappers_v2_asm.S +++ b/portable/IAR/ARM_CM33_NTZ/non_secure/mpu_wrappers_v2_asm.S @@ -32,15 +32,12 @@ /*-----------------------------------------------------------*/ #include "FreeRTOSConfig.h" +#include "mpu_syscall_numbers.h" #ifndef configUSE_MPU_WRAPPERS_V1 #define configUSE_MPU_WRAPPERS_V1 0 #endif -/* These must be in sync with portmacro.h. */ -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) @@ -56,10 +53,7 @@ MPU_xTaskDelayUntil: b MPU_xTaskDelayUntilImpl MPU_xTaskDelayUntil_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskDelayUntilImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskDelayUntil /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskAbortDelay @@ -73,10 +67,7 @@ MPU_xTaskAbortDelay: b MPU_xTaskAbortDelayImpl MPU_xTaskAbortDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskAbortDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskAbortDelay /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskDelay @@ -90,10 +81,7 @@ MPU_vTaskDelay: b MPU_vTaskDelayImpl MPU_vTaskDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskDelay /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskPriorityGet @@ -107,10 +95,7 @@ MPU_uxTaskPriorityGet: b MPU_uxTaskPriorityGetImpl MPU_uxTaskPriorityGet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskPriorityGetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskPriorityGet /*-----------------------------------------------------------*/ PUBLIC MPU_eTaskGetState @@ -124,10 +109,7 @@ MPU_eTaskGetState: b MPU_eTaskGetStateImpl MPU_eTaskGetState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_eTaskGetStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_eTaskGetState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskGetInfo @@ -141,10 +123,7 @@ MPU_vTaskGetInfo: b MPU_vTaskGetInfoImpl MPU_vTaskGetInfo_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskGetInfoImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskGetInfo /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetIdleTaskHandle @@ -158,10 +137,7 @@ MPU_xTaskGetIdleTaskHandle: b MPU_xTaskGetIdleTaskHandleImpl MPU_xTaskGetIdleTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetIdleTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetIdleTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSuspend @@ -175,10 +151,7 @@ MPU_vTaskSuspend: b MPU_vTaskSuspendImpl MPU_vTaskSuspend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSuspendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSuspend /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskResume @@ -192,10 +165,7 @@ MPU_vTaskResume: b MPU_vTaskResumeImpl MPU_vTaskResume_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskResumeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskResume /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetTickCount @@ -209,10 +179,7 @@ MPU_xTaskGetTickCount: b MPU_xTaskGetTickCountImpl MPU_xTaskGetTickCount_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetTickCountImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetTickCount /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetNumberOfTasks @@ -226,10 +193,7 @@ MPU_uxTaskGetNumberOfTasks: b MPU_uxTaskGetNumberOfTasksImpl MPU_uxTaskGetNumberOfTasks_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetNumberOfTasksImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetNumberOfTasks /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimeCounter @@ -243,10 +207,7 @@ MPU_ulTaskGetRunTimeCounter: b MPU_ulTaskGetRunTimeCounterImpl MPU_ulTaskGetRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimePercent @@ -260,10 +221,7 @@ MPU_ulTaskGetRunTimePercent: b MPU_ulTaskGetRunTimePercentImpl MPU_ulTaskGetRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimePercent @@ -277,10 +235,7 @@ MPU_ulTaskGetIdleRunTimePercent: b MPU_ulTaskGetIdleRunTimePercentImpl MPU_ulTaskGetIdleRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimeCounter @@ -294,10 +249,7 @@ MPU_ulTaskGetIdleRunTimeCounter: b MPU_ulTaskGetIdleRunTimeCounterImpl MPU_ulTaskGetIdleRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetApplicationTaskTag @@ -311,10 +263,7 @@ MPU_vTaskSetApplicationTaskTag: b MPU_vTaskSetApplicationTaskTagImpl MPU_vTaskSetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetApplicationTaskTag @@ -328,10 +277,7 @@ MPU_xTaskGetApplicationTaskTag: b MPU_xTaskGetApplicationTaskTagImpl MPU_xTaskGetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetThreadLocalStoragePointer @@ -345,10 +291,7 @@ MPU_vTaskSetThreadLocalStoragePointer: b MPU_vTaskSetThreadLocalStoragePointerImpl MPU_vTaskSetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_pvTaskGetThreadLocalStoragePointer @@ -362,10 +305,7 @@ MPU_pvTaskGetThreadLocalStoragePointer: b MPU_pvTaskGetThreadLocalStoragePointerImpl MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTaskGetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetSystemState @@ -379,10 +319,7 @@ MPU_uxTaskGetSystemState: b MPU_uxTaskGetSystemStateImpl MPU_uxTaskGetSystemState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetSystemStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetSystemState /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark @@ -396,10 +333,7 @@ MPU_uxTaskGetStackHighWaterMark: b MPU_uxTaskGetStackHighWaterMarkImpl MPU_uxTaskGetStackHighWaterMark_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMarkImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark2 @@ -413,10 +347,7 @@ MPU_uxTaskGetStackHighWaterMark2: b MPU_uxTaskGetStackHighWaterMark2Impl MPU_uxTaskGetStackHighWaterMark2_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMark2Impl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark2 /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetCurrentTaskHandle @@ -430,10 +361,7 @@ MPU_xTaskGetCurrentTaskHandle: b MPU_xTaskGetCurrentTaskHandleImpl MPU_xTaskGetCurrentTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetCurrentTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetCurrentTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetSchedulerState @@ -447,10 +375,7 @@ MPU_xTaskGetSchedulerState: b MPU_xTaskGetSchedulerStateImpl MPU_xTaskGetSchedulerState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetSchedulerStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetSchedulerState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetTimeOutState @@ -464,10 +389,7 @@ MPU_vTaskSetTimeOutState: b MPU_vTaskSetTimeOutStateImpl MPU_vTaskSetTimeOutState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetTimeOutStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetTimeOutState /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskCheckForTimeOut @@ -481,14 +403,11 @@ MPU_xTaskCheckForTimeOut: b MPU_xTaskCheckForTimeOutImpl MPU_xTaskCheckForTimeOut_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskCheckForTimeOutImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskCheckForTimeOut /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotify -MPU_xTaskGenericNotify: + PUBLIC MPU_xTaskGenericNotifyEntry +MPU_xTaskGenericNotifyEntry: push {r0} mrs r0, control tst r0, #1 @@ -498,14 +417,11 @@ MPU_xTaskGenericNotify: b MPU_xTaskGenericNotifyImpl MPU_xTaskGenericNotify_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotify /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotifyWait -MPU_xTaskGenericNotifyWait: + PUBLIC MPU_xTaskGenericNotifyWaitEntry +MPU_xTaskGenericNotifyWaitEntry: push {r0} mrs r0, control tst r0, #1 @@ -515,10 +431,7 @@ MPU_xTaskGenericNotifyWait: b MPU_xTaskGenericNotifyWaitImpl MPU_xTaskGenericNotifyWait_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyWaitImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyWait /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyTake @@ -532,10 +445,7 @@ MPU_ulTaskGenericNotifyTake: b MPU_ulTaskGenericNotifyTakeImpl MPU_ulTaskGenericNotifyTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyTake /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGenericNotifyStateClear @@ -549,10 +459,7 @@ MPU_xTaskGenericNotifyStateClear: b MPU_xTaskGenericNotifyStateClearImpl MPU_xTaskGenericNotifyStateClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGenericNotifyStateClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyStateClear /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyValueClear @@ -566,10 +473,7 @@ MPU_ulTaskGenericNotifyValueClear: b MPU_ulTaskGenericNotifyValueClearImpl MPU_ulTaskGenericNotifyValueClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyValueClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyValueClear /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGenericSend @@ -583,10 +487,7 @@ MPU_xQueueGenericSend: b MPU_xQueueGenericSendImpl MPU_xQueueGenericSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGenericSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGenericSend /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueMessagesWaiting @@ -600,10 +501,7 @@ MPU_uxQueueMessagesWaiting: b MPU_uxQueueMessagesWaitingImpl MPU_uxQueueMessagesWaiting_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueMessagesWaitingImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueMessagesWaiting /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueSpacesAvailable @@ -617,10 +515,7 @@ MPU_uxQueueSpacesAvailable: b MPU_uxQueueSpacesAvailableImpl MPU_uxQueueSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueReceive @@ -634,10 +529,7 @@ MPU_xQueueReceive: b MPU_xQueueReceiveImpl MPU_xQueueReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueuePeek @@ -651,10 +543,7 @@ MPU_xQueuePeek: b MPU_xQueuePeekImpl MPU_xQueuePeek_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueuePeekImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueuePeek /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSemaphoreTake @@ -668,10 +557,7 @@ MPU_xQueueSemaphoreTake: b MPU_xQueueSemaphoreTakeImpl MPU_xQueueSemaphoreTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSemaphoreTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSemaphoreTake /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGetMutexHolder @@ -685,10 +571,7 @@ MPU_xQueueGetMutexHolder: b MPU_xQueueGetMutexHolderImpl MPU_xQueueGetMutexHolder_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGetMutexHolderImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGetMutexHolder /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueTakeMutexRecursive @@ -702,10 +585,7 @@ MPU_xQueueTakeMutexRecursive: b MPU_xQueueTakeMutexRecursiveImpl MPU_xQueueTakeMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueTakeMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueTakeMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGiveMutexRecursive @@ -719,10 +599,7 @@ MPU_xQueueGiveMutexRecursive: b MPU_xQueueGiveMutexRecursiveImpl MPU_xQueueGiveMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGiveMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGiveMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSelectFromSet @@ -736,10 +613,7 @@ MPU_xQueueSelectFromSet: b MPU_xQueueSelectFromSetImpl MPU_xQueueSelectFromSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSelectFromSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSelectFromSet /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueAddToSet @@ -753,10 +627,7 @@ MPU_xQueueAddToSet: b MPU_xQueueAddToSetImpl MPU_xQueueAddToSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueAddToSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueAddToSet /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueAddToRegistry @@ -770,10 +641,7 @@ MPU_vQueueAddToRegistry: b MPU_vQueueAddToRegistryImpl MPU_vQueueAddToRegistry_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueAddToRegistryImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueAddToRegistry /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueUnregisterQueue @@ -787,10 +655,7 @@ MPU_vQueueUnregisterQueue: b MPU_vQueueUnregisterQueueImpl MPU_vQueueUnregisterQueue_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueUnregisterQueueImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueUnregisterQueue /*-----------------------------------------------------------*/ PUBLIC MPU_pcQueueGetName @@ -804,10 +669,7 @@ MPU_pcQueueGetName: b MPU_pcQueueGetNameImpl MPU_pcQueueGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcQueueGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcQueueGetName /*-----------------------------------------------------------*/ PUBLIC MPU_pvTimerGetTimerID @@ -821,10 +683,7 @@ MPU_pvTimerGetTimerID: b MPU_pvTimerGetTimerIDImpl MPU_pvTimerGetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTimerGetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTimerGetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetTimerID @@ -838,10 +697,7 @@ MPU_vTimerSetTimerID: b MPU_vTimerSetTimerIDImpl MPU_vTimerSetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerIsTimerActive @@ -855,10 +711,7 @@ MPU_xTimerIsTimerActive: b MPU_xTimerIsTimerActiveImpl MPU_xTimerIsTimerActive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerIsTimerActiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerIsTimerActive /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetTimerDaemonTaskHandle @@ -872,14 +725,11 @@ MPU_xTimerGetTimerDaemonTaskHandle: b MPU_xTimerGetTimerDaemonTaskHandleImpl MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetTimerDaemonTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle /*-----------------------------------------------------------*/ - PUBLIC MPU_xTimerGenericCommandFromTask -MPU_xTimerGenericCommandFromTask: + PUBLIC MPU_xTimerGenericCommandFromTaskEntry +MPU_xTimerGenericCommandFromTaskEntry: push {r0} mrs r0, control tst r0, #1 @@ -889,10 +739,7 @@ MPU_xTimerGenericCommandFromTask: b MPU_xTimerGenericCommandFromTaskImpl MPU_xTimerGenericCommandFromTask_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTimerGenericCommandFromTaskImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGenericCommandFromTask /*-----------------------------------------------------------*/ PUBLIC MPU_pcTimerGetName @@ -906,10 +753,7 @@ MPU_pcTimerGetName: b MPU_pcTimerGetNameImpl MPU_pcTimerGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcTimerGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcTimerGetName /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetReloadMode @@ -923,10 +767,7 @@ MPU_vTimerSetReloadMode: b MPU_vTimerSetReloadModeImpl MPU_vTimerSetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetReloadMode @@ -940,10 +781,7 @@ MPU_xTimerGetReloadMode: b MPU_xTimerGetReloadModeImpl MPU_xTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_uxTimerGetReloadMode @@ -957,10 +795,7 @@ MPU_uxTimerGetReloadMode: b MPU_uxTimerGetReloadModeImpl MPU_uxTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetPeriod @@ -974,10 +809,7 @@ MPU_xTimerGetPeriod: b MPU_xTimerGetPeriodImpl MPU_xTimerGetPeriod_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetPeriodImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetPeriod /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetExpiryTime @@ -991,14 +823,11 @@ MPU_xTimerGetExpiryTime: b MPU_xTimerGetExpiryTimeImpl MPU_xTimerGetExpiryTime_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetExpiryTimeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetExpiryTime /*-----------------------------------------------------------*/ - PUBLIC MPU_xEventGroupWaitBits -MPU_xEventGroupWaitBits: + PUBLIC MPU_xEventGroupWaitBitsEntry +MPU_xEventGroupWaitBitsEntry: push {r0} mrs r0, control tst r0, #1 @@ -1008,10 +837,7 @@ MPU_xEventGroupWaitBits: b MPU_xEventGroupWaitBitsImpl MPU_xEventGroupWaitBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xEventGroupWaitBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupWaitBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupClearBits @@ -1025,10 +851,7 @@ MPU_xEventGroupClearBits: b MPU_xEventGroupClearBitsImpl MPU_xEventGroupClearBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupClearBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupClearBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSetBits @@ -1042,10 +865,7 @@ MPU_xEventGroupSetBits: b MPU_xEventGroupSetBitsImpl MPU_xEventGroupSetBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSetBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSetBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSync @@ -1059,10 +879,7 @@ MPU_xEventGroupSync: b MPU_xEventGroupSyncImpl MPU_xEventGroupSync_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSyncImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSync /*-----------------------------------------------------------*/ PUBLIC MPU_uxEventGroupGetNumber @@ -1076,10 +893,7 @@ MPU_uxEventGroupGetNumber: b MPU_uxEventGroupGetNumberImpl MPU_uxEventGroupGetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxEventGroupGetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxEventGroupGetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_vEventGroupSetNumber @@ -1093,10 +907,7 @@ MPU_vEventGroupSetNumber: b MPU_vEventGroupSetNumberImpl MPU_vEventGroupSetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vEventGroupSetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vEventGroupSetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSend @@ -1110,10 +921,7 @@ MPU_xStreamBufferSend: b MPU_xStreamBufferSendImpl MPU_xStreamBufferSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSend /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferReceive @@ -1127,10 +935,7 @@ MPU_xStreamBufferReceive: b MPU_xStreamBufferReceiveImpl MPU_xStreamBufferReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsFull @@ -1144,10 +949,7 @@ MPU_xStreamBufferIsFull: b MPU_xStreamBufferIsFullImpl MPU_xStreamBufferIsFull_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsFullImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsFull /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsEmpty @@ -1161,10 +963,7 @@ MPU_xStreamBufferIsEmpty: b MPU_xStreamBufferIsEmptyImpl MPU_xStreamBufferIsEmpty_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsEmptyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsEmpty /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSpacesAvailable @@ -1178,10 +977,7 @@ MPU_xStreamBufferSpacesAvailable: b MPU_xStreamBufferSpacesAvailableImpl MPU_xStreamBufferSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferBytesAvailable @@ -1195,10 +991,7 @@ MPU_xStreamBufferBytesAvailable: b MPU_xStreamBufferBytesAvailableImpl MPU_xStreamBufferBytesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferBytesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferBytesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSetTriggerLevel @@ -1212,10 +1005,7 @@ MPU_xStreamBufferSetTriggerLevel: b MPU_xStreamBufferSetTriggerLevelImpl MPU_xStreamBufferSetTriggerLevel_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSetTriggerLevelImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSetTriggerLevel /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferNextMessageLengthBytes @@ -1229,10 +1019,7 @@ MPU_xStreamBufferNextMessageLengthBytes: b MPU_xStreamBufferNextMessageLengthBytesImpl MPU_xStreamBufferNextMessageLengthBytes_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferNextMessageLengthBytesImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferNextMessageLengthBytes /*-----------------------------------------------------------*/ /* Default weak implementations in case one is not available from diff --git a/portable/IAR/ARM_CM33_NTZ/non_secure/port.c b/portable/IAR/ARM_CM33_NTZ/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/IAR/ARM_CM33_NTZ/non_secure/port.c +++ b/portable/IAR/ARM_CM33_NTZ/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM33_NTZ/non_secure/portasm.s b/portable/IAR/ARM_CM33_NTZ/non_secure/portasm.s index ec5202527..7cf467d22 100644 --- a/portable/IAR/ARM_CM33_NTZ/non_secure/portasm.s +++ b/portable/IAR/ARM_CM33_NTZ/non_secure/portasm.s @@ -32,6 +32,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 @@ -41,7 +44,6 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler. EXTERN vPortSVCHandler_C #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) EXTERN vSystemCallEnter - EXTERN vSystemCallEnter_1 EXTERN vSystemCallExit #endif @@ -191,7 +193,7 @@ vStartFirstTask: cpsie f 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: @@ -371,11 +373,9 @@ SVC_Handler: ldr r1, [r0, #24] ldrb r2, [r1, #-2] - cmp r2, #4 /* portSVC_SYSTEM_CALL_ENTER. */ - beq syscall_enter - cmp r2, #5 /* portSVC_SYSTEM_CALL_ENTER_1. */ - beq syscall_enter_1 - cmp r2, #6 /* portSVC_SYSTEM_CALL_EXIT. */ + cmp r2, #NUM_SYSTEM_CALLS + blt syscall_enter + cmp r2, #104 /* portSVC_SYSTEM_CALL_EXIT. */ beq syscall_exit b vPortSVCHandler_C @@ -383,10 +383,6 @@ SVC_Handler: mov r1, lr b vSystemCallEnter - syscall_enter_1: - mov r1, lr - b vSystemCallEnter_1 - syscall_exit: mov r1, lr b vSystemCallExit diff --git a/portable/IAR/ARM_CM33_NTZ/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM33_NTZ/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/IAR/ARM_CM33_NTZ/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM33_NTZ/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM35P/non_secure/mpu_wrappers_v2_asm.S b/portable/IAR/ARM_CM35P/non_secure/mpu_wrappers_v2_asm.S index 1005dad33..80d5a1c63 100644 --- a/portable/IAR/ARM_CM35P/non_secure/mpu_wrappers_v2_asm.S +++ b/portable/IAR/ARM_CM35P/non_secure/mpu_wrappers_v2_asm.S @@ -32,15 +32,12 @@ /*-----------------------------------------------------------*/ #include "FreeRTOSConfig.h" +#include "mpu_syscall_numbers.h" #ifndef configUSE_MPU_WRAPPERS_V1 #define configUSE_MPU_WRAPPERS_V1 0 #endif -/* These must be in sync with portmacro.h. */ -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) @@ -56,10 +53,7 @@ MPU_xTaskDelayUntil: b MPU_xTaskDelayUntilImpl MPU_xTaskDelayUntil_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskDelayUntilImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskDelayUntil /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskAbortDelay @@ -73,10 +67,7 @@ MPU_xTaskAbortDelay: b MPU_xTaskAbortDelayImpl MPU_xTaskAbortDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskAbortDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskAbortDelay /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskDelay @@ -90,10 +81,7 @@ MPU_vTaskDelay: b MPU_vTaskDelayImpl MPU_vTaskDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskDelay /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskPriorityGet @@ -107,10 +95,7 @@ MPU_uxTaskPriorityGet: b MPU_uxTaskPriorityGetImpl MPU_uxTaskPriorityGet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskPriorityGetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskPriorityGet /*-----------------------------------------------------------*/ PUBLIC MPU_eTaskGetState @@ -124,10 +109,7 @@ MPU_eTaskGetState: b MPU_eTaskGetStateImpl MPU_eTaskGetState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_eTaskGetStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_eTaskGetState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskGetInfo @@ -141,10 +123,7 @@ MPU_vTaskGetInfo: b MPU_vTaskGetInfoImpl MPU_vTaskGetInfo_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskGetInfoImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskGetInfo /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetIdleTaskHandle @@ -158,10 +137,7 @@ MPU_xTaskGetIdleTaskHandle: b MPU_xTaskGetIdleTaskHandleImpl MPU_xTaskGetIdleTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetIdleTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetIdleTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSuspend @@ -175,10 +151,7 @@ MPU_vTaskSuspend: b MPU_vTaskSuspendImpl MPU_vTaskSuspend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSuspendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSuspend /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskResume @@ -192,10 +165,7 @@ MPU_vTaskResume: b MPU_vTaskResumeImpl MPU_vTaskResume_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskResumeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskResume /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetTickCount @@ -209,10 +179,7 @@ MPU_xTaskGetTickCount: b MPU_xTaskGetTickCountImpl MPU_xTaskGetTickCount_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetTickCountImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetTickCount /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetNumberOfTasks @@ -226,10 +193,7 @@ MPU_uxTaskGetNumberOfTasks: b MPU_uxTaskGetNumberOfTasksImpl MPU_uxTaskGetNumberOfTasks_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetNumberOfTasksImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetNumberOfTasks /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimeCounter @@ -243,10 +207,7 @@ MPU_ulTaskGetRunTimeCounter: b MPU_ulTaskGetRunTimeCounterImpl MPU_ulTaskGetRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimePercent @@ -260,10 +221,7 @@ MPU_ulTaskGetRunTimePercent: b MPU_ulTaskGetRunTimePercentImpl MPU_ulTaskGetRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimePercent @@ -277,10 +235,7 @@ MPU_ulTaskGetIdleRunTimePercent: b MPU_ulTaskGetIdleRunTimePercentImpl MPU_ulTaskGetIdleRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimeCounter @@ -294,10 +249,7 @@ MPU_ulTaskGetIdleRunTimeCounter: b MPU_ulTaskGetIdleRunTimeCounterImpl MPU_ulTaskGetIdleRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetApplicationTaskTag @@ -311,10 +263,7 @@ MPU_vTaskSetApplicationTaskTag: b MPU_vTaskSetApplicationTaskTagImpl MPU_vTaskSetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetApplicationTaskTag @@ -328,10 +277,7 @@ MPU_xTaskGetApplicationTaskTag: b MPU_xTaskGetApplicationTaskTagImpl MPU_xTaskGetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetThreadLocalStoragePointer @@ -345,10 +291,7 @@ MPU_vTaskSetThreadLocalStoragePointer: b MPU_vTaskSetThreadLocalStoragePointerImpl MPU_vTaskSetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_pvTaskGetThreadLocalStoragePointer @@ -362,10 +305,7 @@ MPU_pvTaskGetThreadLocalStoragePointer: b MPU_pvTaskGetThreadLocalStoragePointerImpl MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTaskGetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetSystemState @@ -379,10 +319,7 @@ MPU_uxTaskGetSystemState: b MPU_uxTaskGetSystemStateImpl MPU_uxTaskGetSystemState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetSystemStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetSystemState /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark @@ -396,10 +333,7 @@ MPU_uxTaskGetStackHighWaterMark: b MPU_uxTaskGetStackHighWaterMarkImpl MPU_uxTaskGetStackHighWaterMark_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMarkImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark2 @@ -413,10 +347,7 @@ MPU_uxTaskGetStackHighWaterMark2: b MPU_uxTaskGetStackHighWaterMark2Impl MPU_uxTaskGetStackHighWaterMark2_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMark2Impl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark2 /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetCurrentTaskHandle @@ -430,10 +361,7 @@ MPU_xTaskGetCurrentTaskHandle: b MPU_xTaskGetCurrentTaskHandleImpl MPU_xTaskGetCurrentTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetCurrentTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetCurrentTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetSchedulerState @@ -447,10 +375,7 @@ MPU_xTaskGetSchedulerState: b MPU_xTaskGetSchedulerStateImpl MPU_xTaskGetSchedulerState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetSchedulerStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetSchedulerState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetTimeOutState @@ -464,10 +389,7 @@ MPU_vTaskSetTimeOutState: b MPU_vTaskSetTimeOutStateImpl MPU_vTaskSetTimeOutState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetTimeOutStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetTimeOutState /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskCheckForTimeOut @@ -481,14 +403,11 @@ MPU_xTaskCheckForTimeOut: b MPU_xTaskCheckForTimeOutImpl MPU_xTaskCheckForTimeOut_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskCheckForTimeOutImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskCheckForTimeOut /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotify -MPU_xTaskGenericNotify: + PUBLIC MPU_xTaskGenericNotifyEntry +MPU_xTaskGenericNotifyEntry: push {r0} mrs r0, control tst r0, #1 @@ -498,14 +417,11 @@ MPU_xTaskGenericNotify: b MPU_xTaskGenericNotifyImpl MPU_xTaskGenericNotify_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotify /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotifyWait -MPU_xTaskGenericNotifyWait: + PUBLIC MPU_xTaskGenericNotifyWaitEntry +MPU_xTaskGenericNotifyWaitEntry: push {r0} mrs r0, control tst r0, #1 @@ -515,10 +431,7 @@ MPU_xTaskGenericNotifyWait: b MPU_xTaskGenericNotifyWaitImpl MPU_xTaskGenericNotifyWait_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyWaitImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyWait /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyTake @@ -532,10 +445,7 @@ MPU_ulTaskGenericNotifyTake: b MPU_ulTaskGenericNotifyTakeImpl MPU_ulTaskGenericNotifyTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyTake /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGenericNotifyStateClear @@ -549,10 +459,7 @@ MPU_xTaskGenericNotifyStateClear: b MPU_xTaskGenericNotifyStateClearImpl MPU_xTaskGenericNotifyStateClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGenericNotifyStateClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyStateClear /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyValueClear @@ -566,10 +473,7 @@ MPU_ulTaskGenericNotifyValueClear: b MPU_ulTaskGenericNotifyValueClearImpl MPU_ulTaskGenericNotifyValueClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyValueClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyValueClear /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGenericSend @@ -583,10 +487,7 @@ MPU_xQueueGenericSend: b MPU_xQueueGenericSendImpl MPU_xQueueGenericSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGenericSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGenericSend /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueMessagesWaiting @@ -600,10 +501,7 @@ MPU_uxQueueMessagesWaiting: b MPU_uxQueueMessagesWaitingImpl MPU_uxQueueMessagesWaiting_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueMessagesWaitingImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueMessagesWaiting /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueSpacesAvailable @@ -617,10 +515,7 @@ MPU_uxQueueSpacesAvailable: b MPU_uxQueueSpacesAvailableImpl MPU_uxQueueSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueReceive @@ -634,10 +529,7 @@ MPU_xQueueReceive: b MPU_xQueueReceiveImpl MPU_xQueueReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueuePeek @@ -651,10 +543,7 @@ MPU_xQueuePeek: b MPU_xQueuePeekImpl MPU_xQueuePeek_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueuePeekImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueuePeek /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSemaphoreTake @@ -668,10 +557,7 @@ MPU_xQueueSemaphoreTake: b MPU_xQueueSemaphoreTakeImpl MPU_xQueueSemaphoreTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSemaphoreTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSemaphoreTake /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGetMutexHolder @@ -685,10 +571,7 @@ MPU_xQueueGetMutexHolder: b MPU_xQueueGetMutexHolderImpl MPU_xQueueGetMutexHolder_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGetMutexHolderImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGetMutexHolder /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueTakeMutexRecursive @@ -702,10 +585,7 @@ MPU_xQueueTakeMutexRecursive: b MPU_xQueueTakeMutexRecursiveImpl MPU_xQueueTakeMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueTakeMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueTakeMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGiveMutexRecursive @@ -719,10 +599,7 @@ MPU_xQueueGiveMutexRecursive: b MPU_xQueueGiveMutexRecursiveImpl MPU_xQueueGiveMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGiveMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGiveMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSelectFromSet @@ -736,10 +613,7 @@ MPU_xQueueSelectFromSet: b MPU_xQueueSelectFromSetImpl MPU_xQueueSelectFromSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSelectFromSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSelectFromSet /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueAddToSet @@ -753,10 +627,7 @@ MPU_xQueueAddToSet: b MPU_xQueueAddToSetImpl MPU_xQueueAddToSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueAddToSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueAddToSet /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueAddToRegistry @@ -770,10 +641,7 @@ MPU_vQueueAddToRegistry: b MPU_vQueueAddToRegistryImpl MPU_vQueueAddToRegistry_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueAddToRegistryImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueAddToRegistry /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueUnregisterQueue @@ -787,10 +655,7 @@ MPU_vQueueUnregisterQueue: b MPU_vQueueUnregisterQueueImpl MPU_vQueueUnregisterQueue_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueUnregisterQueueImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueUnregisterQueue /*-----------------------------------------------------------*/ PUBLIC MPU_pcQueueGetName @@ -804,10 +669,7 @@ MPU_pcQueueGetName: b MPU_pcQueueGetNameImpl MPU_pcQueueGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcQueueGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcQueueGetName /*-----------------------------------------------------------*/ PUBLIC MPU_pvTimerGetTimerID @@ -821,10 +683,7 @@ MPU_pvTimerGetTimerID: b MPU_pvTimerGetTimerIDImpl MPU_pvTimerGetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTimerGetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTimerGetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetTimerID @@ -838,10 +697,7 @@ MPU_vTimerSetTimerID: b MPU_vTimerSetTimerIDImpl MPU_vTimerSetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerIsTimerActive @@ -855,10 +711,7 @@ MPU_xTimerIsTimerActive: b MPU_xTimerIsTimerActiveImpl MPU_xTimerIsTimerActive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerIsTimerActiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerIsTimerActive /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetTimerDaemonTaskHandle @@ -872,14 +725,11 @@ MPU_xTimerGetTimerDaemonTaskHandle: b MPU_xTimerGetTimerDaemonTaskHandleImpl MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetTimerDaemonTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle /*-----------------------------------------------------------*/ - PUBLIC MPU_xTimerGenericCommandFromTask -MPU_xTimerGenericCommandFromTask: + PUBLIC MPU_xTimerGenericCommandFromTaskEntry +MPU_xTimerGenericCommandFromTaskEntry: push {r0} mrs r0, control tst r0, #1 @@ -889,10 +739,7 @@ MPU_xTimerGenericCommandFromTask: b MPU_xTimerGenericCommandFromTaskImpl MPU_xTimerGenericCommandFromTask_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTimerGenericCommandFromTaskImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGenericCommandFromTask /*-----------------------------------------------------------*/ PUBLIC MPU_pcTimerGetName @@ -906,10 +753,7 @@ MPU_pcTimerGetName: b MPU_pcTimerGetNameImpl MPU_pcTimerGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcTimerGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcTimerGetName /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetReloadMode @@ -923,10 +767,7 @@ MPU_vTimerSetReloadMode: b MPU_vTimerSetReloadModeImpl MPU_vTimerSetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetReloadMode @@ -940,10 +781,7 @@ MPU_xTimerGetReloadMode: b MPU_xTimerGetReloadModeImpl MPU_xTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_uxTimerGetReloadMode @@ -957,10 +795,7 @@ MPU_uxTimerGetReloadMode: b MPU_uxTimerGetReloadModeImpl MPU_uxTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetPeriod @@ -974,10 +809,7 @@ MPU_xTimerGetPeriod: b MPU_xTimerGetPeriodImpl MPU_xTimerGetPeriod_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetPeriodImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetPeriod /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetExpiryTime @@ -991,14 +823,11 @@ MPU_xTimerGetExpiryTime: b MPU_xTimerGetExpiryTimeImpl MPU_xTimerGetExpiryTime_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetExpiryTimeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetExpiryTime /*-----------------------------------------------------------*/ - PUBLIC MPU_xEventGroupWaitBits -MPU_xEventGroupWaitBits: + PUBLIC MPU_xEventGroupWaitBitsEntry +MPU_xEventGroupWaitBitsEntry: push {r0} mrs r0, control tst r0, #1 @@ -1008,10 +837,7 @@ MPU_xEventGroupWaitBits: b MPU_xEventGroupWaitBitsImpl MPU_xEventGroupWaitBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xEventGroupWaitBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupWaitBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupClearBits @@ -1025,10 +851,7 @@ MPU_xEventGroupClearBits: b MPU_xEventGroupClearBitsImpl MPU_xEventGroupClearBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupClearBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupClearBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSetBits @@ -1042,10 +865,7 @@ MPU_xEventGroupSetBits: b MPU_xEventGroupSetBitsImpl MPU_xEventGroupSetBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSetBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSetBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSync @@ -1059,10 +879,7 @@ MPU_xEventGroupSync: b MPU_xEventGroupSyncImpl MPU_xEventGroupSync_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSyncImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSync /*-----------------------------------------------------------*/ PUBLIC MPU_uxEventGroupGetNumber @@ -1076,10 +893,7 @@ MPU_uxEventGroupGetNumber: b MPU_uxEventGroupGetNumberImpl MPU_uxEventGroupGetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxEventGroupGetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxEventGroupGetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_vEventGroupSetNumber @@ -1093,10 +907,7 @@ MPU_vEventGroupSetNumber: b MPU_vEventGroupSetNumberImpl MPU_vEventGroupSetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vEventGroupSetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vEventGroupSetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSend @@ -1110,10 +921,7 @@ MPU_xStreamBufferSend: b MPU_xStreamBufferSendImpl MPU_xStreamBufferSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSend /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferReceive @@ -1127,10 +935,7 @@ MPU_xStreamBufferReceive: b MPU_xStreamBufferReceiveImpl MPU_xStreamBufferReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsFull @@ -1144,10 +949,7 @@ MPU_xStreamBufferIsFull: b MPU_xStreamBufferIsFullImpl MPU_xStreamBufferIsFull_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsFullImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsFull /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsEmpty @@ -1161,10 +963,7 @@ MPU_xStreamBufferIsEmpty: b MPU_xStreamBufferIsEmptyImpl MPU_xStreamBufferIsEmpty_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsEmptyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsEmpty /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSpacesAvailable @@ -1178,10 +977,7 @@ MPU_xStreamBufferSpacesAvailable: b MPU_xStreamBufferSpacesAvailableImpl MPU_xStreamBufferSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferBytesAvailable @@ -1195,10 +991,7 @@ MPU_xStreamBufferBytesAvailable: b MPU_xStreamBufferBytesAvailableImpl MPU_xStreamBufferBytesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferBytesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferBytesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSetTriggerLevel @@ -1212,10 +1005,7 @@ MPU_xStreamBufferSetTriggerLevel: b MPU_xStreamBufferSetTriggerLevelImpl MPU_xStreamBufferSetTriggerLevel_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSetTriggerLevelImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSetTriggerLevel /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferNextMessageLengthBytes @@ -1229,10 +1019,7 @@ MPU_xStreamBufferNextMessageLengthBytes: b MPU_xStreamBufferNextMessageLengthBytesImpl MPU_xStreamBufferNextMessageLengthBytes_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferNextMessageLengthBytesImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferNextMessageLengthBytes /*-----------------------------------------------------------*/ /* Default weak implementations in case one is not available from diff --git a/portable/IAR/ARM_CM35P/non_secure/port.c b/portable/IAR/ARM_CM35P/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/IAR/ARM_CM35P/non_secure/port.c +++ b/portable/IAR/ARM_CM35P/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM35P/non_secure/portasm.s b/portable/IAR/ARM_CM35P/non_secure/portasm.s index 15e74ffc1..d8f1b1d9a 100644 --- a/portable/IAR/ARM_CM35P/non_secure/portasm.s +++ b/portable/IAR/ARM_CM35P/non_secure/portasm.s @@ -32,6 +32,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 @@ -44,7 +47,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 @@ -86,7 +88,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. */ /*-----------------------------------------------------------*/ @@ -205,7 +207,7 @@ vStartFirstTask: cpsie f 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: @@ -455,11 +457,9 @@ SVC_Handler: ldr r1, [r0, #24] ldrb r2, [r1, #-2] - cmp r2, #4 /* portSVC_SYSTEM_CALL_ENTER. */ - beq syscall_enter - cmp r2, #5 /* portSVC_SYSTEM_CALL_ENTER_1. */ - beq syscall_enter_1 - cmp r2, #6 /* portSVC_SYSTEM_CALL_EXIT. */ + cmp r2, #NUM_SYSTEM_CALLS + blt syscall_enter + cmp r2, #104 /* portSVC_SYSTEM_CALL_EXIT. */ beq syscall_exit b vPortSVCHandler_C @@ -467,10 +467,6 @@ SVC_Handler: mov r1, lr b vSystemCallEnter - syscall_enter_1: - mov r1, lr - b vSystemCallEnter_1 - syscall_exit: mov r1, lr b vSystemCallExit @@ -493,7 +489,7 @@ vPortFreeSecureContext: ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */ cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */ it ne - svcne 1 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 1. */ + svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */ bx lr /* Return. */ /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM35P/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM35P/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/IAR/ARM_CM35P/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM35P/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM35P_NTZ/non_secure/mpu_wrappers_v2_asm.S b/portable/IAR/ARM_CM35P_NTZ/non_secure/mpu_wrappers_v2_asm.S index 1005dad33..80d5a1c63 100644 --- a/portable/IAR/ARM_CM35P_NTZ/non_secure/mpu_wrappers_v2_asm.S +++ b/portable/IAR/ARM_CM35P_NTZ/non_secure/mpu_wrappers_v2_asm.S @@ -32,15 +32,12 @@ /*-----------------------------------------------------------*/ #include "FreeRTOSConfig.h" +#include "mpu_syscall_numbers.h" #ifndef configUSE_MPU_WRAPPERS_V1 #define configUSE_MPU_WRAPPERS_V1 0 #endif -/* These must be in sync with portmacro.h. */ -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) @@ -56,10 +53,7 @@ MPU_xTaskDelayUntil: b MPU_xTaskDelayUntilImpl MPU_xTaskDelayUntil_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskDelayUntilImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskDelayUntil /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskAbortDelay @@ -73,10 +67,7 @@ MPU_xTaskAbortDelay: b MPU_xTaskAbortDelayImpl MPU_xTaskAbortDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskAbortDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskAbortDelay /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskDelay @@ -90,10 +81,7 @@ MPU_vTaskDelay: b MPU_vTaskDelayImpl MPU_vTaskDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskDelay /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskPriorityGet @@ -107,10 +95,7 @@ MPU_uxTaskPriorityGet: b MPU_uxTaskPriorityGetImpl MPU_uxTaskPriorityGet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskPriorityGetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskPriorityGet /*-----------------------------------------------------------*/ PUBLIC MPU_eTaskGetState @@ -124,10 +109,7 @@ MPU_eTaskGetState: b MPU_eTaskGetStateImpl MPU_eTaskGetState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_eTaskGetStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_eTaskGetState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskGetInfo @@ -141,10 +123,7 @@ MPU_vTaskGetInfo: b MPU_vTaskGetInfoImpl MPU_vTaskGetInfo_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskGetInfoImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskGetInfo /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetIdleTaskHandle @@ -158,10 +137,7 @@ MPU_xTaskGetIdleTaskHandle: b MPU_xTaskGetIdleTaskHandleImpl MPU_xTaskGetIdleTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetIdleTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetIdleTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSuspend @@ -175,10 +151,7 @@ MPU_vTaskSuspend: b MPU_vTaskSuspendImpl MPU_vTaskSuspend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSuspendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSuspend /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskResume @@ -192,10 +165,7 @@ MPU_vTaskResume: b MPU_vTaskResumeImpl MPU_vTaskResume_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskResumeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskResume /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetTickCount @@ -209,10 +179,7 @@ MPU_xTaskGetTickCount: b MPU_xTaskGetTickCountImpl MPU_xTaskGetTickCount_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetTickCountImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetTickCount /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetNumberOfTasks @@ -226,10 +193,7 @@ MPU_uxTaskGetNumberOfTasks: b MPU_uxTaskGetNumberOfTasksImpl MPU_uxTaskGetNumberOfTasks_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetNumberOfTasksImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetNumberOfTasks /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimeCounter @@ -243,10 +207,7 @@ MPU_ulTaskGetRunTimeCounter: b MPU_ulTaskGetRunTimeCounterImpl MPU_ulTaskGetRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimePercent @@ -260,10 +221,7 @@ MPU_ulTaskGetRunTimePercent: b MPU_ulTaskGetRunTimePercentImpl MPU_ulTaskGetRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimePercent @@ -277,10 +235,7 @@ MPU_ulTaskGetIdleRunTimePercent: b MPU_ulTaskGetIdleRunTimePercentImpl MPU_ulTaskGetIdleRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimeCounter @@ -294,10 +249,7 @@ MPU_ulTaskGetIdleRunTimeCounter: b MPU_ulTaskGetIdleRunTimeCounterImpl MPU_ulTaskGetIdleRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetApplicationTaskTag @@ -311,10 +263,7 @@ MPU_vTaskSetApplicationTaskTag: b MPU_vTaskSetApplicationTaskTagImpl MPU_vTaskSetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetApplicationTaskTag @@ -328,10 +277,7 @@ MPU_xTaskGetApplicationTaskTag: b MPU_xTaskGetApplicationTaskTagImpl MPU_xTaskGetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetThreadLocalStoragePointer @@ -345,10 +291,7 @@ MPU_vTaskSetThreadLocalStoragePointer: b MPU_vTaskSetThreadLocalStoragePointerImpl MPU_vTaskSetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_pvTaskGetThreadLocalStoragePointer @@ -362,10 +305,7 @@ MPU_pvTaskGetThreadLocalStoragePointer: b MPU_pvTaskGetThreadLocalStoragePointerImpl MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTaskGetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetSystemState @@ -379,10 +319,7 @@ MPU_uxTaskGetSystemState: b MPU_uxTaskGetSystemStateImpl MPU_uxTaskGetSystemState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetSystemStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetSystemState /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark @@ -396,10 +333,7 @@ MPU_uxTaskGetStackHighWaterMark: b MPU_uxTaskGetStackHighWaterMarkImpl MPU_uxTaskGetStackHighWaterMark_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMarkImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark2 @@ -413,10 +347,7 @@ MPU_uxTaskGetStackHighWaterMark2: b MPU_uxTaskGetStackHighWaterMark2Impl MPU_uxTaskGetStackHighWaterMark2_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMark2Impl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark2 /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetCurrentTaskHandle @@ -430,10 +361,7 @@ MPU_xTaskGetCurrentTaskHandle: b MPU_xTaskGetCurrentTaskHandleImpl MPU_xTaskGetCurrentTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetCurrentTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetCurrentTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetSchedulerState @@ -447,10 +375,7 @@ MPU_xTaskGetSchedulerState: b MPU_xTaskGetSchedulerStateImpl MPU_xTaskGetSchedulerState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetSchedulerStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetSchedulerState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetTimeOutState @@ -464,10 +389,7 @@ MPU_vTaskSetTimeOutState: b MPU_vTaskSetTimeOutStateImpl MPU_vTaskSetTimeOutState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetTimeOutStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetTimeOutState /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskCheckForTimeOut @@ -481,14 +403,11 @@ MPU_xTaskCheckForTimeOut: b MPU_xTaskCheckForTimeOutImpl MPU_xTaskCheckForTimeOut_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskCheckForTimeOutImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskCheckForTimeOut /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotify -MPU_xTaskGenericNotify: + PUBLIC MPU_xTaskGenericNotifyEntry +MPU_xTaskGenericNotifyEntry: push {r0} mrs r0, control tst r0, #1 @@ -498,14 +417,11 @@ MPU_xTaskGenericNotify: b MPU_xTaskGenericNotifyImpl MPU_xTaskGenericNotify_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotify /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotifyWait -MPU_xTaskGenericNotifyWait: + PUBLIC MPU_xTaskGenericNotifyWaitEntry +MPU_xTaskGenericNotifyWaitEntry: push {r0} mrs r0, control tst r0, #1 @@ -515,10 +431,7 @@ MPU_xTaskGenericNotifyWait: b MPU_xTaskGenericNotifyWaitImpl MPU_xTaskGenericNotifyWait_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyWaitImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyWait /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyTake @@ -532,10 +445,7 @@ MPU_ulTaskGenericNotifyTake: b MPU_ulTaskGenericNotifyTakeImpl MPU_ulTaskGenericNotifyTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyTake /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGenericNotifyStateClear @@ -549,10 +459,7 @@ MPU_xTaskGenericNotifyStateClear: b MPU_xTaskGenericNotifyStateClearImpl MPU_xTaskGenericNotifyStateClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGenericNotifyStateClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyStateClear /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyValueClear @@ -566,10 +473,7 @@ MPU_ulTaskGenericNotifyValueClear: b MPU_ulTaskGenericNotifyValueClearImpl MPU_ulTaskGenericNotifyValueClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyValueClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyValueClear /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGenericSend @@ -583,10 +487,7 @@ MPU_xQueueGenericSend: b MPU_xQueueGenericSendImpl MPU_xQueueGenericSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGenericSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGenericSend /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueMessagesWaiting @@ -600,10 +501,7 @@ MPU_uxQueueMessagesWaiting: b MPU_uxQueueMessagesWaitingImpl MPU_uxQueueMessagesWaiting_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueMessagesWaitingImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueMessagesWaiting /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueSpacesAvailable @@ -617,10 +515,7 @@ MPU_uxQueueSpacesAvailable: b MPU_uxQueueSpacesAvailableImpl MPU_uxQueueSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueReceive @@ -634,10 +529,7 @@ MPU_xQueueReceive: b MPU_xQueueReceiveImpl MPU_xQueueReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueuePeek @@ -651,10 +543,7 @@ MPU_xQueuePeek: b MPU_xQueuePeekImpl MPU_xQueuePeek_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueuePeekImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueuePeek /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSemaphoreTake @@ -668,10 +557,7 @@ MPU_xQueueSemaphoreTake: b MPU_xQueueSemaphoreTakeImpl MPU_xQueueSemaphoreTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSemaphoreTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSemaphoreTake /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGetMutexHolder @@ -685,10 +571,7 @@ MPU_xQueueGetMutexHolder: b MPU_xQueueGetMutexHolderImpl MPU_xQueueGetMutexHolder_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGetMutexHolderImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGetMutexHolder /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueTakeMutexRecursive @@ -702,10 +585,7 @@ MPU_xQueueTakeMutexRecursive: b MPU_xQueueTakeMutexRecursiveImpl MPU_xQueueTakeMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueTakeMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueTakeMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGiveMutexRecursive @@ -719,10 +599,7 @@ MPU_xQueueGiveMutexRecursive: b MPU_xQueueGiveMutexRecursiveImpl MPU_xQueueGiveMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGiveMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGiveMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSelectFromSet @@ -736,10 +613,7 @@ MPU_xQueueSelectFromSet: b MPU_xQueueSelectFromSetImpl MPU_xQueueSelectFromSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSelectFromSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSelectFromSet /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueAddToSet @@ -753,10 +627,7 @@ MPU_xQueueAddToSet: b MPU_xQueueAddToSetImpl MPU_xQueueAddToSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueAddToSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueAddToSet /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueAddToRegistry @@ -770,10 +641,7 @@ MPU_vQueueAddToRegistry: b MPU_vQueueAddToRegistryImpl MPU_vQueueAddToRegistry_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueAddToRegistryImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueAddToRegistry /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueUnregisterQueue @@ -787,10 +655,7 @@ MPU_vQueueUnregisterQueue: b MPU_vQueueUnregisterQueueImpl MPU_vQueueUnregisterQueue_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueUnregisterQueueImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueUnregisterQueue /*-----------------------------------------------------------*/ PUBLIC MPU_pcQueueGetName @@ -804,10 +669,7 @@ MPU_pcQueueGetName: b MPU_pcQueueGetNameImpl MPU_pcQueueGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcQueueGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcQueueGetName /*-----------------------------------------------------------*/ PUBLIC MPU_pvTimerGetTimerID @@ -821,10 +683,7 @@ MPU_pvTimerGetTimerID: b MPU_pvTimerGetTimerIDImpl MPU_pvTimerGetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTimerGetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTimerGetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetTimerID @@ -838,10 +697,7 @@ MPU_vTimerSetTimerID: b MPU_vTimerSetTimerIDImpl MPU_vTimerSetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerIsTimerActive @@ -855,10 +711,7 @@ MPU_xTimerIsTimerActive: b MPU_xTimerIsTimerActiveImpl MPU_xTimerIsTimerActive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerIsTimerActiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerIsTimerActive /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetTimerDaemonTaskHandle @@ -872,14 +725,11 @@ MPU_xTimerGetTimerDaemonTaskHandle: b MPU_xTimerGetTimerDaemonTaskHandleImpl MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetTimerDaemonTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle /*-----------------------------------------------------------*/ - PUBLIC MPU_xTimerGenericCommandFromTask -MPU_xTimerGenericCommandFromTask: + PUBLIC MPU_xTimerGenericCommandFromTaskEntry +MPU_xTimerGenericCommandFromTaskEntry: push {r0} mrs r0, control tst r0, #1 @@ -889,10 +739,7 @@ MPU_xTimerGenericCommandFromTask: b MPU_xTimerGenericCommandFromTaskImpl MPU_xTimerGenericCommandFromTask_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTimerGenericCommandFromTaskImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGenericCommandFromTask /*-----------------------------------------------------------*/ PUBLIC MPU_pcTimerGetName @@ -906,10 +753,7 @@ MPU_pcTimerGetName: b MPU_pcTimerGetNameImpl MPU_pcTimerGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcTimerGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcTimerGetName /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetReloadMode @@ -923,10 +767,7 @@ MPU_vTimerSetReloadMode: b MPU_vTimerSetReloadModeImpl MPU_vTimerSetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetReloadMode @@ -940,10 +781,7 @@ MPU_xTimerGetReloadMode: b MPU_xTimerGetReloadModeImpl MPU_xTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_uxTimerGetReloadMode @@ -957,10 +795,7 @@ MPU_uxTimerGetReloadMode: b MPU_uxTimerGetReloadModeImpl MPU_uxTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetPeriod @@ -974,10 +809,7 @@ MPU_xTimerGetPeriod: b MPU_xTimerGetPeriodImpl MPU_xTimerGetPeriod_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetPeriodImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetPeriod /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetExpiryTime @@ -991,14 +823,11 @@ MPU_xTimerGetExpiryTime: b MPU_xTimerGetExpiryTimeImpl MPU_xTimerGetExpiryTime_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetExpiryTimeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetExpiryTime /*-----------------------------------------------------------*/ - PUBLIC MPU_xEventGroupWaitBits -MPU_xEventGroupWaitBits: + PUBLIC MPU_xEventGroupWaitBitsEntry +MPU_xEventGroupWaitBitsEntry: push {r0} mrs r0, control tst r0, #1 @@ -1008,10 +837,7 @@ MPU_xEventGroupWaitBits: b MPU_xEventGroupWaitBitsImpl MPU_xEventGroupWaitBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xEventGroupWaitBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupWaitBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupClearBits @@ -1025,10 +851,7 @@ MPU_xEventGroupClearBits: b MPU_xEventGroupClearBitsImpl MPU_xEventGroupClearBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupClearBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupClearBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSetBits @@ -1042,10 +865,7 @@ MPU_xEventGroupSetBits: b MPU_xEventGroupSetBitsImpl MPU_xEventGroupSetBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSetBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSetBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSync @@ -1059,10 +879,7 @@ MPU_xEventGroupSync: b MPU_xEventGroupSyncImpl MPU_xEventGroupSync_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSyncImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSync /*-----------------------------------------------------------*/ PUBLIC MPU_uxEventGroupGetNumber @@ -1076,10 +893,7 @@ MPU_uxEventGroupGetNumber: b MPU_uxEventGroupGetNumberImpl MPU_uxEventGroupGetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxEventGroupGetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxEventGroupGetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_vEventGroupSetNumber @@ -1093,10 +907,7 @@ MPU_vEventGroupSetNumber: b MPU_vEventGroupSetNumberImpl MPU_vEventGroupSetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vEventGroupSetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vEventGroupSetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSend @@ -1110,10 +921,7 @@ MPU_xStreamBufferSend: b MPU_xStreamBufferSendImpl MPU_xStreamBufferSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSend /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferReceive @@ -1127,10 +935,7 @@ MPU_xStreamBufferReceive: b MPU_xStreamBufferReceiveImpl MPU_xStreamBufferReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsFull @@ -1144,10 +949,7 @@ MPU_xStreamBufferIsFull: b MPU_xStreamBufferIsFullImpl MPU_xStreamBufferIsFull_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsFullImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsFull /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsEmpty @@ -1161,10 +963,7 @@ MPU_xStreamBufferIsEmpty: b MPU_xStreamBufferIsEmptyImpl MPU_xStreamBufferIsEmpty_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsEmptyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsEmpty /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSpacesAvailable @@ -1178,10 +977,7 @@ MPU_xStreamBufferSpacesAvailable: b MPU_xStreamBufferSpacesAvailableImpl MPU_xStreamBufferSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferBytesAvailable @@ -1195,10 +991,7 @@ MPU_xStreamBufferBytesAvailable: b MPU_xStreamBufferBytesAvailableImpl MPU_xStreamBufferBytesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferBytesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferBytesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSetTriggerLevel @@ -1212,10 +1005,7 @@ MPU_xStreamBufferSetTriggerLevel: b MPU_xStreamBufferSetTriggerLevelImpl MPU_xStreamBufferSetTriggerLevel_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSetTriggerLevelImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSetTriggerLevel /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferNextMessageLengthBytes @@ -1229,10 +1019,7 @@ MPU_xStreamBufferNextMessageLengthBytes: b MPU_xStreamBufferNextMessageLengthBytesImpl MPU_xStreamBufferNextMessageLengthBytes_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferNextMessageLengthBytesImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferNextMessageLengthBytes /*-----------------------------------------------------------*/ /* Default weak implementations in case one is not available from diff --git a/portable/IAR/ARM_CM35P_NTZ/non_secure/port.c b/portable/IAR/ARM_CM35P_NTZ/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/IAR/ARM_CM35P_NTZ/non_secure/port.c +++ b/portable/IAR/ARM_CM35P_NTZ/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM35P_NTZ/non_secure/portasm.s b/portable/IAR/ARM_CM35P_NTZ/non_secure/portasm.s index ec5202527..7cf467d22 100644 --- a/portable/IAR/ARM_CM35P_NTZ/non_secure/portasm.s +++ b/portable/IAR/ARM_CM35P_NTZ/non_secure/portasm.s @@ -32,6 +32,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 @@ -41,7 +44,6 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler. EXTERN vPortSVCHandler_C #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) EXTERN vSystemCallEnter - EXTERN vSystemCallEnter_1 EXTERN vSystemCallExit #endif @@ -191,7 +193,7 @@ vStartFirstTask: cpsie f 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: @@ -371,11 +373,9 @@ SVC_Handler: ldr r1, [r0, #24] ldrb r2, [r1, #-2] - cmp r2, #4 /* portSVC_SYSTEM_CALL_ENTER. */ - beq syscall_enter - cmp r2, #5 /* portSVC_SYSTEM_CALL_ENTER_1. */ - beq syscall_enter_1 - cmp r2, #6 /* portSVC_SYSTEM_CALL_EXIT. */ + cmp r2, #NUM_SYSTEM_CALLS + blt syscall_enter + cmp r2, #104 /* portSVC_SYSTEM_CALL_EXIT. */ beq syscall_exit b vPortSVCHandler_C @@ -383,10 +383,6 @@ SVC_Handler: mov r1, lr b vSystemCallEnter - syscall_enter_1: - mov r1, lr - b vSystemCallEnter_1 - syscall_exit: mov r1, lr b vSystemCallExit diff --git a/portable/IAR/ARM_CM35P_NTZ/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM35P_NTZ/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/IAR/ARM_CM35P_NTZ/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM35P_NTZ/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM4F_MPU/mpu_wrappers_v2_asm.S b/portable/IAR/ARM_CM4F_MPU/mpu_wrappers_v2_asm.S index 8d88af630..d21dbaa7f 100644 --- a/portable/IAR/ARM_CM4F_MPU/mpu_wrappers_v2_asm.S +++ b/portable/IAR/ARM_CM4F_MPU/mpu_wrappers_v2_asm.S @@ -32,6 +32,7 @@ * 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" SECTION freertos_system_calls:CODE:NOROOT(2) THUMB @@ -41,10 +42,6 @@ #define configUSE_MPU_WRAPPERS_V1 0 #endif -/* These must be in sync with portmacro.h. */ -#define portSVC_SYSTEM_CALL_ENTER 3 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 4 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 5 /*-----------------------------------------------------------*/ #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) @@ -60,10 +57,7 @@ MPU_xTaskDelayUntil: b MPU_xTaskDelayUntilImpl MPU_xTaskDelayUntil_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskDelayUntilImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskDelayUntil /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskAbortDelay @@ -77,10 +71,7 @@ MPU_xTaskAbortDelay: b MPU_xTaskAbortDelayImpl MPU_xTaskAbortDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskAbortDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskAbortDelay /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskDelay @@ -94,10 +85,7 @@ MPU_vTaskDelay: b MPU_vTaskDelayImpl MPU_vTaskDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskDelay /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskPriorityGet @@ -111,10 +99,7 @@ MPU_uxTaskPriorityGet: b MPU_uxTaskPriorityGetImpl MPU_uxTaskPriorityGet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskPriorityGetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskPriorityGet /*-----------------------------------------------------------*/ PUBLIC MPU_eTaskGetState @@ -128,10 +113,7 @@ MPU_eTaskGetState: b MPU_eTaskGetStateImpl MPU_eTaskGetState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_eTaskGetStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_eTaskGetState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskGetInfo @@ -145,10 +127,7 @@ MPU_vTaskGetInfo: b MPU_vTaskGetInfoImpl MPU_vTaskGetInfo_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskGetInfoImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskGetInfo /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetIdleTaskHandle @@ -162,10 +141,7 @@ MPU_xTaskGetIdleTaskHandle: b MPU_xTaskGetIdleTaskHandleImpl MPU_xTaskGetIdleTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetIdleTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetIdleTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSuspend @@ -179,10 +155,7 @@ MPU_vTaskSuspend: b MPU_vTaskSuspendImpl MPU_vTaskSuspend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSuspendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSuspend /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskResume @@ -196,10 +169,7 @@ MPU_vTaskResume: b MPU_vTaskResumeImpl MPU_vTaskResume_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskResumeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskResume /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetTickCount @@ -213,10 +183,7 @@ MPU_xTaskGetTickCount: b MPU_xTaskGetTickCountImpl MPU_xTaskGetTickCount_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetTickCountImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetTickCount /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetNumberOfTasks @@ -230,10 +197,7 @@ MPU_uxTaskGetNumberOfTasks: b MPU_uxTaskGetNumberOfTasksImpl MPU_uxTaskGetNumberOfTasks_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetNumberOfTasksImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetNumberOfTasks /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimeCounter @@ -247,10 +211,7 @@ MPU_ulTaskGetRunTimeCounter: b MPU_ulTaskGetRunTimeCounterImpl MPU_ulTaskGetRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimePercent @@ -264,10 +225,7 @@ MPU_ulTaskGetRunTimePercent: b MPU_ulTaskGetRunTimePercentImpl MPU_ulTaskGetRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimePercent @@ -281,10 +239,7 @@ MPU_ulTaskGetIdleRunTimePercent: b MPU_ulTaskGetIdleRunTimePercentImpl MPU_ulTaskGetIdleRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimeCounter @@ -298,10 +253,7 @@ MPU_ulTaskGetIdleRunTimeCounter: b MPU_ulTaskGetIdleRunTimeCounterImpl MPU_ulTaskGetIdleRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetApplicationTaskTag @@ -315,10 +267,7 @@ MPU_vTaskSetApplicationTaskTag: b MPU_vTaskSetApplicationTaskTagImpl MPU_vTaskSetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetApplicationTaskTag @@ -332,10 +281,7 @@ MPU_xTaskGetApplicationTaskTag: b MPU_xTaskGetApplicationTaskTagImpl MPU_xTaskGetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetThreadLocalStoragePointer @@ -349,10 +295,7 @@ MPU_vTaskSetThreadLocalStoragePointer: b MPU_vTaskSetThreadLocalStoragePointerImpl MPU_vTaskSetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_pvTaskGetThreadLocalStoragePointer @@ -366,10 +309,7 @@ MPU_pvTaskGetThreadLocalStoragePointer: b MPU_pvTaskGetThreadLocalStoragePointerImpl MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTaskGetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetSystemState @@ -383,10 +323,7 @@ MPU_uxTaskGetSystemState: b MPU_uxTaskGetSystemStateImpl MPU_uxTaskGetSystemState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetSystemStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetSystemState /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark @@ -400,10 +337,7 @@ MPU_uxTaskGetStackHighWaterMark: b MPU_uxTaskGetStackHighWaterMarkImpl MPU_uxTaskGetStackHighWaterMark_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMarkImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark2 @@ -417,10 +351,7 @@ MPU_uxTaskGetStackHighWaterMark2: b MPU_uxTaskGetStackHighWaterMark2Impl MPU_uxTaskGetStackHighWaterMark2_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMark2Impl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark2 /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetCurrentTaskHandle @@ -434,10 +365,7 @@ MPU_xTaskGetCurrentTaskHandle: b MPU_xTaskGetCurrentTaskHandleImpl MPU_xTaskGetCurrentTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetCurrentTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetCurrentTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetSchedulerState @@ -451,10 +379,7 @@ MPU_xTaskGetSchedulerState: b MPU_xTaskGetSchedulerStateImpl MPU_xTaskGetSchedulerState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetSchedulerStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetSchedulerState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetTimeOutState @@ -468,10 +393,7 @@ MPU_vTaskSetTimeOutState: b MPU_vTaskSetTimeOutStateImpl MPU_vTaskSetTimeOutState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetTimeOutStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetTimeOutState /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskCheckForTimeOut @@ -485,14 +407,11 @@ MPU_xTaskCheckForTimeOut: b MPU_xTaskCheckForTimeOutImpl MPU_xTaskCheckForTimeOut_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskCheckForTimeOutImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskCheckForTimeOut /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotify -MPU_xTaskGenericNotify: + PUBLIC MPU_xTaskGenericNotifyEntry +MPU_xTaskGenericNotifyEntry: push {r0} mrs r0, control tst r0, #1 @@ -502,14 +421,11 @@ MPU_xTaskGenericNotify: b MPU_xTaskGenericNotifyImpl MPU_xTaskGenericNotify_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotify /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotifyWait -MPU_xTaskGenericNotifyWait: + PUBLIC MPU_xTaskGenericNotifyWaitEntry +MPU_xTaskGenericNotifyWaitEntry: push {r0} mrs r0, control tst r0, #1 @@ -519,10 +435,7 @@ MPU_xTaskGenericNotifyWait: b MPU_xTaskGenericNotifyWaitImpl MPU_xTaskGenericNotifyWait_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyWaitImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyWait /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyTake @@ -536,10 +449,7 @@ MPU_ulTaskGenericNotifyTake: b MPU_ulTaskGenericNotifyTakeImpl MPU_ulTaskGenericNotifyTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyTake /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGenericNotifyStateClear @@ -553,10 +463,7 @@ MPU_xTaskGenericNotifyStateClear: b MPU_xTaskGenericNotifyStateClearImpl MPU_xTaskGenericNotifyStateClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGenericNotifyStateClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyStateClear /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyValueClear @@ -570,10 +477,7 @@ MPU_ulTaskGenericNotifyValueClear: b MPU_ulTaskGenericNotifyValueClearImpl MPU_ulTaskGenericNotifyValueClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyValueClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyValueClear /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGenericSend @@ -587,10 +491,7 @@ MPU_xQueueGenericSend: b MPU_xQueueGenericSendImpl MPU_xQueueGenericSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGenericSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGenericSend /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueMessagesWaiting @@ -604,10 +505,7 @@ MPU_uxQueueMessagesWaiting: b MPU_uxQueueMessagesWaitingImpl MPU_uxQueueMessagesWaiting_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueMessagesWaitingImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueMessagesWaiting /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueSpacesAvailable @@ -621,10 +519,7 @@ MPU_uxQueueSpacesAvailable: b MPU_uxQueueSpacesAvailableImpl MPU_uxQueueSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueReceive @@ -638,10 +533,7 @@ MPU_xQueueReceive: b MPU_xQueueReceiveImpl MPU_xQueueReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueuePeek @@ -655,10 +547,7 @@ MPU_xQueuePeek: b MPU_xQueuePeekImpl MPU_xQueuePeek_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueuePeekImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueuePeek /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSemaphoreTake @@ -672,10 +561,7 @@ MPU_xQueueSemaphoreTake: b MPU_xQueueSemaphoreTakeImpl MPU_xQueueSemaphoreTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSemaphoreTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSemaphoreTake /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGetMutexHolder @@ -689,10 +575,7 @@ MPU_xQueueGetMutexHolder: b MPU_xQueueGetMutexHolderImpl MPU_xQueueGetMutexHolder_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGetMutexHolderImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGetMutexHolder /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueTakeMutexRecursive @@ -706,10 +589,7 @@ MPU_xQueueTakeMutexRecursive: b MPU_xQueueTakeMutexRecursiveImpl MPU_xQueueTakeMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueTakeMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueTakeMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGiveMutexRecursive @@ -723,10 +603,7 @@ MPU_xQueueGiveMutexRecursive: b MPU_xQueueGiveMutexRecursiveImpl MPU_xQueueGiveMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGiveMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGiveMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSelectFromSet @@ -740,10 +617,7 @@ MPU_xQueueSelectFromSet: b MPU_xQueueSelectFromSetImpl MPU_xQueueSelectFromSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSelectFromSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSelectFromSet /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueAddToSet @@ -757,10 +631,7 @@ MPU_xQueueAddToSet: b MPU_xQueueAddToSetImpl MPU_xQueueAddToSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueAddToSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueAddToSet /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueAddToRegistry @@ -774,10 +645,7 @@ MPU_vQueueAddToRegistry: b MPU_vQueueAddToRegistryImpl MPU_vQueueAddToRegistry_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueAddToRegistryImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueAddToRegistry /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueUnregisterQueue @@ -791,10 +659,7 @@ MPU_vQueueUnregisterQueue: b MPU_vQueueUnregisterQueueImpl MPU_vQueueUnregisterQueue_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueUnregisterQueueImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueUnregisterQueue /*-----------------------------------------------------------*/ PUBLIC MPU_pcQueueGetName @@ -808,10 +673,7 @@ MPU_pcQueueGetName: b MPU_pcQueueGetNameImpl MPU_pcQueueGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcQueueGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcQueueGetName /*-----------------------------------------------------------*/ PUBLIC MPU_pvTimerGetTimerID @@ -825,10 +687,7 @@ MPU_pvTimerGetTimerID: b MPU_pvTimerGetTimerIDImpl MPU_pvTimerGetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTimerGetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTimerGetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetTimerID @@ -842,10 +701,7 @@ MPU_vTimerSetTimerID: b MPU_vTimerSetTimerIDImpl MPU_vTimerSetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerIsTimerActive @@ -859,10 +715,7 @@ MPU_xTimerIsTimerActive: b MPU_xTimerIsTimerActiveImpl MPU_xTimerIsTimerActive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerIsTimerActiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerIsTimerActive /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetTimerDaemonTaskHandle @@ -876,14 +729,11 @@ MPU_xTimerGetTimerDaemonTaskHandle: b MPU_xTimerGetTimerDaemonTaskHandleImpl MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetTimerDaemonTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle /*-----------------------------------------------------------*/ - PUBLIC MPU_xTimerGenericCommandFromTask -MPU_xTimerGenericCommandFromTask: + PUBLIC MPU_xTimerGenericCommandFromTaskEntry +MPU_xTimerGenericCommandFromTaskEntry: push {r0} mrs r0, control tst r0, #1 @@ -893,10 +743,7 @@ MPU_xTimerGenericCommandFromTask: b MPU_xTimerGenericCommandFromTaskImpl MPU_xTimerGenericCommandFromTask_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTimerGenericCommandFromTaskImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGenericCommandFromTask /*-----------------------------------------------------------*/ PUBLIC MPU_pcTimerGetName @@ -910,10 +757,7 @@ MPU_pcTimerGetName: b MPU_pcTimerGetNameImpl MPU_pcTimerGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcTimerGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcTimerGetName /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetReloadMode @@ -927,10 +771,7 @@ MPU_vTimerSetReloadMode: b MPU_vTimerSetReloadModeImpl MPU_vTimerSetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetReloadMode @@ -944,10 +785,7 @@ MPU_xTimerGetReloadMode: b MPU_xTimerGetReloadModeImpl MPU_xTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_uxTimerGetReloadMode @@ -961,10 +799,7 @@ MPU_uxTimerGetReloadMode: b MPU_uxTimerGetReloadModeImpl MPU_uxTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetPeriod @@ -978,10 +813,7 @@ MPU_xTimerGetPeriod: b MPU_xTimerGetPeriodImpl MPU_xTimerGetPeriod_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetPeriodImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetPeriod /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetExpiryTime @@ -995,14 +827,11 @@ MPU_xTimerGetExpiryTime: b MPU_xTimerGetExpiryTimeImpl MPU_xTimerGetExpiryTime_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetExpiryTimeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetExpiryTime /*-----------------------------------------------------------*/ - PUBLIC MPU_xEventGroupWaitBits -MPU_xEventGroupWaitBits: + PUBLIC MPU_xEventGroupWaitBitsEntry +MPU_xEventGroupWaitBitsEntry: push {r0} mrs r0, control tst r0, #1 @@ -1012,10 +841,7 @@ MPU_xEventGroupWaitBits: b MPU_xEventGroupWaitBitsImpl MPU_xEventGroupWaitBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xEventGroupWaitBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupWaitBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupClearBits @@ -1029,10 +855,7 @@ MPU_xEventGroupClearBits: b MPU_xEventGroupClearBitsImpl MPU_xEventGroupClearBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupClearBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupClearBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSetBits @@ -1046,10 +869,7 @@ MPU_xEventGroupSetBits: b MPU_xEventGroupSetBitsImpl MPU_xEventGroupSetBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSetBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSetBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSync @@ -1063,10 +883,7 @@ MPU_xEventGroupSync: b MPU_xEventGroupSyncImpl MPU_xEventGroupSync_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSyncImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSync /*-----------------------------------------------------------*/ PUBLIC MPU_uxEventGroupGetNumber @@ -1080,10 +897,7 @@ MPU_uxEventGroupGetNumber: b MPU_uxEventGroupGetNumberImpl MPU_uxEventGroupGetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxEventGroupGetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxEventGroupGetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_vEventGroupSetNumber @@ -1097,10 +911,7 @@ MPU_vEventGroupSetNumber: b MPU_vEventGroupSetNumberImpl MPU_vEventGroupSetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vEventGroupSetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vEventGroupSetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSend @@ -1114,10 +925,7 @@ MPU_xStreamBufferSend: b MPU_xStreamBufferSendImpl MPU_xStreamBufferSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSend /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferReceive @@ -1131,10 +939,7 @@ MPU_xStreamBufferReceive: b MPU_xStreamBufferReceiveImpl MPU_xStreamBufferReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsFull @@ -1148,10 +953,7 @@ MPU_xStreamBufferIsFull: b MPU_xStreamBufferIsFullImpl MPU_xStreamBufferIsFull_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsFullImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsFull /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsEmpty @@ -1165,10 +967,7 @@ MPU_xStreamBufferIsEmpty: b MPU_xStreamBufferIsEmptyImpl MPU_xStreamBufferIsEmpty_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsEmptyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsEmpty /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSpacesAvailable @@ -1182,10 +981,7 @@ MPU_xStreamBufferSpacesAvailable: b MPU_xStreamBufferSpacesAvailableImpl MPU_xStreamBufferSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferBytesAvailable @@ -1199,10 +995,7 @@ MPU_xStreamBufferBytesAvailable: b MPU_xStreamBufferBytesAvailableImpl MPU_xStreamBufferBytesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferBytesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferBytesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSetTriggerLevel @@ -1216,10 +1009,7 @@ MPU_xStreamBufferSetTriggerLevel: b MPU_xStreamBufferSetTriggerLevelImpl MPU_xStreamBufferSetTriggerLevel_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSetTriggerLevelImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSetTriggerLevel /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferNextMessageLengthBytes @@ -1233,10 +1023,7 @@ MPU_xStreamBufferNextMessageLengthBytes: b MPU_xStreamBufferNextMessageLengthBytesImpl MPU_xStreamBufferNextMessageLengthBytes_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferNextMessageLengthBytesImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferNextMessageLengthBytes /*-----------------------------------------------------------*/ /* Default weak implementations in case one is not available from diff --git a/portable/IAR/ARM_CM4F_MPU/port.c b/portable/IAR/ARM_CM4F_MPU/port.c index 6db7bd796..4f0b617ce 100644 --- a/portable/IAR/ARM_CM4F_MPU/port.c +++ b/portable/IAR/ARM_CM4F_MPU/port.c @@ -41,6 +41,7 @@ /* Scheduler includes. */ #include "FreeRTOS.h" #include "task.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -236,29 +237,22 @@ extern void vPortRestoreContextOfFirstTask( void ) PRIVILEGED_FUNCTION; * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -294,6 +288,15 @@ void vPortSwitchToUserMode( void ); * variable. */ static UBaseType_t uxCriticalNesting = 0xaaaaaaaa; +#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/* + * This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /* * Used by the portASSERT_IF_INTERRUPT_PRIORITY_INVALID() macro to ensure * FreeRTOS API functions are not called from interrupts that have been assigned @@ -368,10 +371,10 @@ void vPortSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ uint8_t ucSVCNumber; uint32_t ulPC; - #if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) + #if ( ( configUSE_MPU_WRAPPERS_V1 == 1 ) && ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) ) extern uint32_t __syscalls_flash_start__[]; extern uint32_t __syscalls_flash_end__[]; - #endif /* #if( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ + #endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 1 ) && ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) ) */ /* The stack contains: r0, r1, r2, r3, r12, LR, PC and xPSR. The first * argument (r0) is pulParam[ 0 ]. */ @@ -397,26 +400,15 @@ void vPortSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ break; - #if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) - case portSVC_RAISE_PRIVILEGE: /* Only raise the privilege, if the - * svc was raised from any of the - * system calls. */ + #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) + #if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) + case portSVC_RAISE_PRIVILEGE: /* Only raise the privilege, if the + * svc was raised from any of the + * system calls. */ - if( ( ulPC >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulPC <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - __asm volatile - ( - " mrs r1, control \n" /* Obtain current control value. */ - " bic r1, r1, #1 \n" /* Set privilege bit. */ - " msr control, r1 \n" /* Write back new control value. */ - ::: "r1", "memory" - ); - } - - break; - #else /* if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ - case portSVC_RAISE_PRIVILEGE: + if( ( ulPC >= ( uint32_t ) __syscalls_flash_start__ ) && + ( ulPC <= ( uint32_t ) __syscalls_flash_end__ ) ) + { __asm volatile ( " mrs r1, control \n" /* Obtain current control value. */ @@ -424,11 +416,24 @@ void vPortSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ " msr control, r1 \n" /* Write back new control value. */ ::: "r1", "memory" ); - break; - #endif /* #if( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ + } - default: /* Unknown SVC call. */ - break; + break; + #else /* if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ + case portSVC_RAISE_PRIVILEGE: + __asm volatile + ( + " mrs r1, control \n" /* Obtain current control value. */ + " bic r1, r1, #1 \n" /* Set privilege bit. */ + " msr control, r1 \n" /* Write back new control value. */ + ::: "r1", "memory" + ); + break; + #endif /* #if( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ + #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) */ + + default: /* Unknown SVC call. */ + break; } } /*-----------------------------------------------------------*/ @@ -436,15 +441,16 @@ void vPortSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -456,17 +462,27 @@ void vPortSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) { /* Extended frame i.e. FPU in use. */ @@ -507,10 +523,19 @@ void vPortSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - /* Store the value of the Link Register before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Record if the hardware used padding to force the stack pointer * to be double word aligned. */ if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) @@ -534,108 +559,9 @@ void vPortSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r1, control \n" /* Obtain current control value. */ - " bic r1, #1 \n" /* Clear nPRIV bit. */ - " msr control, r1 \n" /* Write back new control value. */ - ::: "r1", "memory" - ); - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* Store the value of the Link Register before the SVC was raised. We need to - * restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -652,24 +578,32 @@ void vPortSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -708,8 +642,10 @@ void vPortSVCHandler_C( uint32_t * pulParam ) /* PRIVILEGED_FUNCTION */ ::: "r1", "memory" ); - /* Restore the stacked link register to what it was at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; /* If the hardware used padding to force the stack pointer @@ -875,6 +811,12 @@ BaseType_t xPortStartScheduler( void ) /* Initialise the critical nesting count ready for the first task. */ uxCriticalNesting = 0; + #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Ensure the VFP is enabled - it should be anyway. */ vPortEnableVFP(); @@ -1404,21 +1346,34 @@ BaseType_t xPortIsAuthorizedToAccessBuffer( const void * pvBuffer, { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; diff --git a/portable/IAR/ARM_CM4F_MPU/portasm.s b/portable/IAR/ARM_CM4F_MPU/portasm.s index 5d7b41061..7866d9ee9 100644 --- a/portable/IAR/ARM_CM4F_MPU/portasm.s +++ b/portable/IAR/ARM_CM4F_MPU/portasm.s @@ -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 +#include 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 @@ -64,9 +64,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: @@ -170,10 +169,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 @@ -182,10 +179,6 @@ vPortSVCHandler: mov r1, lr b vSystemCallEnter - syscall_enter_1: - mov r1, lr - b vSystemCallEnter_1 - syscall_exit: mov r1, lr b vSystemCallExit @@ -224,7 +217,7 @@ vPortStartFirstTask: cpsie f dsb isb - svc 0 + svc #portSVC_START_SCHEDULER /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM4F_MPU/portmacro.h b/portable/IAR/ARM_CM4F_MPU/portmacro.h index 98b087e11..5b994cca9 100644 --- a/portable/IAR/ARM_CM4F_MPU/portmacro.h +++ b/portable/IAR/ARM_CM4F_MPU/portmacro.h @@ -252,12 +252,10 @@ typedef struct MPU_SETTINGS /*-----------------------------------------------------------*/ /* SVC numbers for various services. */ -#define portSVC_START_SCHEDULER 0 -#define portSVC_YIELD 1 -#define portSVC_RAISE_PRIVILEGE 2 -#define portSVC_SYSTEM_CALL_ENTER 3 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 4 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 5 +#define portSVC_START_SCHEDULER 100 +#define portSVC_YIELD 101 +#define portSVC_RAISE_PRIVILEGE 102 +#define portSVC_SYSTEM_CALL_EXIT 103 /* Scheduler utilities. */ diff --git a/portable/IAR/ARM_CM55/non_secure/mpu_wrappers_v2_asm.S b/portable/IAR/ARM_CM55/non_secure/mpu_wrappers_v2_asm.S index 1005dad33..80d5a1c63 100644 --- a/portable/IAR/ARM_CM55/non_secure/mpu_wrappers_v2_asm.S +++ b/portable/IAR/ARM_CM55/non_secure/mpu_wrappers_v2_asm.S @@ -32,15 +32,12 @@ /*-----------------------------------------------------------*/ #include "FreeRTOSConfig.h" +#include "mpu_syscall_numbers.h" #ifndef configUSE_MPU_WRAPPERS_V1 #define configUSE_MPU_WRAPPERS_V1 0 #endif -/* These must be in sync with portmacro.h. */ -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) @@ -56,10 +53,7 @@ MPU_xTaskDelayUntil: b MPU_xTaskDelayUntilImpl MPU_xTaskDelayUntil_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskDelayUntilImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskDelayUntil /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskAbortDelay @@ -73,10 +67,7 @@ MPU_xTaskAbortDelay: b MPU_xTaskAbortDelayImpl MPU_xTaskAbortDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskAbortDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskAbortDelay /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskDelay @@ -90,10 +81,7 @@ MPU_vTaskDelay: b MPU_vTaskDelayImpl MPU_vTaskDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskDelay /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskPriorityGet @@ -107,10 +95,7 @@ MPU_uxTaskPriorityGet: b MPU_uxTaskPriorityGetImpl MPU_uxTaskPriorityGet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskPriorityGetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskPriorityGet /*-----------------------------------------------------------*/ PUBLIC MPU_eTaskGetState @@ -124,10 +109,7 @@ MPU_eTaskGetState: b MPU_eTaskGetStateImpl MPU_eTaskGetState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_eTaskGetStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_eTaskGetState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskGetInfo @@ -141,10 +123,7 @@ MPU_vTaskGetInfo: b MPU_vTaskGetInfoImpl MPU_vTaskGetInfo_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskGetInfoImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskGetInfo /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetIdleTaskHandle @@ -158,10 +137,7 @@ MPU_xTaskGetIdleTaskHandle: b MPU_xTaskGetIdleTaskHandleImpl MPU_xTaskGetIdleTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetIdleTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetIdleTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSuspend @@ -175,10 +151,7 @@ MPU_vTaskSuspend: b MPU_vTaskSuspendImpl MPU_vTaskSuspend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSuspendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSuspend /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskResume @@ -192,10 +165,7 @@ MPU_vTaskResume: b MPU_vTaskResumeImpl MPU_vTaskResume_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskResumeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskResume /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetTickCount @@ -209,10 +179,7 @@ MPU_xTaskGetTickCount: b MPU_xTaskGetTickCountImpl MPU_xTaskGetTickCount_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetTickCountImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetTickCount /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetNumberOfTasks @@ -226,10 +193,7 @@ MPU_uxTaskGetNumberOfTasks: b MPU_uxTaskGetNumberOfTasksImpl MPU_uxTaskGetNumberOfTasks_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetNumberOfTasksImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetNumberOfTasks /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimeCounter @@ -243,10 +207,7 @@ MPU_ulTaskGetRunTimeCounter: b MPU_ulTaskGetRunTimeCounterImpl MPU_ulTaskGetRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimePercent @@ -260,10 +221,7 @@ MPU_ulTaskGetRunTimePercent: b MPU_ulTaskGetRunTimePercentImpl MPU_ulTaskGetRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimePercent @@ -277,10 +235,7 @@ MPU_ulTaskGetIdleRunTimePercent: b MPU_ulTaskGetIdleRunTimePercentImpl MPU_ulTaskGetIdleRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimeCounter @@ -294,10 +249,7 @@ MPU_ulTaskGetIdleRunTimeCounter: b MPU_ulTaskGetIdleRunTimeCounterImpl MPU_ulTaskGetIdleRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetApplicationTaskTag @@ -311,10 +263,7 @@ MPU_vTaskSetApplicationTaskTag: b MPU_vTaskSetApplicationTaskTagImpl MPU_vTaskSetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetApplicationTaskTag @@ -328,10 +277,7 @@ MPU_xTaskGetApplicationTaskTag: b MPU_xTaskGetApplicationTaskTagImpl MPU_xTaskGetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetThreadLocalStoragePointer @@ -345,10 +291,7 @@ MPU_vTaskSetThreadLocalStoragePointer: b MPU_vTaskSetThreadLocalStoragePointerImpl MPU_vTaskSetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_pvTaskGetThreadLocalStoragePointer @@ -362,10 +305,7 @@ MPU_pvTaskGetThreadLocalStoragePointer: b MPU_pvTaskGetThreadLocalStoragePointerImpl MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTaskGetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetSystemState @@ -379,10 +319,7 @@ MPU_uxTaskGetSystemState: b MPU_uxTaskGetSystemStateImpl MPU_uxTaskGetSystemState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetSystemStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetSystemState /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark @@ -396,10 +333,7 @@ MPU_uxTaskGetStackHighWaterMark: b MPU_uxTaskGetStackHighWaterMarkImpl MPU_uxTaskGetStackHighWaterMark_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMarkImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark2 @@ -413,10 +347,7 @@ MPU_uxTaskGetStackHighWaterMark2: b MPU_uxTaskGetStackHighWaterMark2Impl MPU_uxTaskGetStackHighWaterMark2_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMark2Impl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark2 /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetCurrentTaskHandle @@ -430,10 +361,7 @@ MPU_xTaskGetCurrentTaskHandle: b MPU_xTaskGetCurrentTaskHandleImpl MPU_xTaskGetCurrentTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetCurrentTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetCurrentTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetSchedulerState @@ -447,10 +375,7 @@ MPU_xTaskGetSchedulerState: b MPU_xTaskGetSchedulerStateImpl MPU_xTaskGetSchedulerState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetSchedulerStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetSchedulerState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetTimeOutState @@ -464,10 +389,7 @@ MPU_vTaskSetTimeOutState: b MPU_vTaskSetTimeOutStateImpl MPU_vTaskSetTimeOutState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetTimeOutStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetTimeOutState /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskCheckForTimeOut @@ -481,14 +403,11 @@ MPU_xTaskCheckForTimeOut: b MPU_xTaskCheckForTimeOutImpl MPU_xTaskCheckForTimeOut_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskCheckForTimeOutImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskCheckForTimeOut /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotify -MPU_xTaskGenericNotify: + PUBLIC MPU_xTaskGenericNotifyEntry +MPU_xTaskGenericNotifyEntry: push {r0} mrs r0, control tst r0, #1 @@ -498,14 +417,11 @@ MPU_xTaskGenericNotify: b MPU_xTaskGenericNotifyImpl MPU_xTaskGenericNotify_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotify /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotifyWait -MPU_xTaskGenericNotifyWait: + PUBLIC MPU_xTaskGenericNotifyWaitEntry +MPU_xTaskGenericNotifyWaitEntry: push {r0} mrs r0, control tst r0, #1 @@ -515,10 +431,7 @@ MPU_xTaskGenericNotifyWait: b MPU_xTaskGenericNotifyWaitImpl MPU_xTaskGenericNotifyWait_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyWaitImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyWait /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyTake @@ -532,10 +445,7 @@ MPU_ulTaskGenericNotifyTake: b MPU_ulTaskGenericNotifyTakeImpl MPU_ulTaskGenericNotifyTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyTake /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGenericNotifyStateClear @@ -549,10 +459,7 @@ MPU_xTaskGenericNotifyStateClear: b MPU_xTaskGenericNotifyStateClearImpl MPU_xTaskGenericNotifyStateClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGenericNotifyStateClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyStateClear /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyValueClear @@ -566,10 +473,7 @@ MPU_ulTaskGenericNotifyValueClear: b MPU_ulTaskGenericNotifyValueClearImpl MPU_ulTaskGenericNotifyValueClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyValueClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyValueClear /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGenericSend @@ -583,10 +487,7 @@ MPU_xQueueGenericSend: b MPU_xQueueGenericSendImpl MPU_xQueueGenericSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGenericSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGenericSend /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueMessagesWaiting @@ -600,10 +501,7 @@ MPU_uxQueueMessagesWaiting: b MPU_uxQueueMessagesWaitingImpl MPU_uxQueueMessagesWaiting_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueMessagesWaitingImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueMessagesWaiting /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueSpacesAvailable @@ -617,10 +515,7 @@ MPU_uxQueueSpacesAvailable: b MPU_uxQueueSpacesAvailableImpl MPU_uxQueueSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueReceive @@ -634,10 +529,7 @@ MPU_xQueueReceive: b MPU_xQueueReceiveImpl MPU_xQueueReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueuePeek @@ -651,10 +543,7 @@ MPU_xQueuePeek: b MPU_xQueuePeekImpl MPU_xQueuePeek_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueuePeekImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueuePeek /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSemaphoreTake @@ -668,10 +557,7 @@ MPU_xQueueSemaphoreTake: b MPU_xQueueSemaphoreTakeImpl MPU_xQueueSemaphoreTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSemaphoreTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSemaphoreTake /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGetMutexHolder @@ -685,10 +571,7 @@ MPU_xQueueGetMutexHolder: b MPU_xQueueGetMutexHolderImpl MPU_xQueueGetMutexHolder_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGetMutexHolderImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGetMutexHolder /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueTakeMutexRecursive @@ -702,10 +585,7 @@ MPU_xQueueTakeMutexRecursive: b MPU_xQueueTakeMutexRecursiveImpl MPU_xQueueTakeMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueTakeMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueTakeMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGiveMutexRecursive @@ -719,10 +599,7 @@ MPU_xQueueGiveMutexRecursive: b MPU_xQueueGiveMutexRecursiveImpl MPU_xQueueGiveMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGiveMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGiveMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSelectFromSet @@ -736,10 +613,7 @@ MPU_xQueueSelectFromSet: b MPU_xQueueSelectFromSetImpl MPU_xQueueSelectFromSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSelectFromSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSelectFromSet /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueAddToSet @@ -753,10 +627,7 @@ MPU_xQueueAddToSet: b MPU_xQueueAddToSetImpl MPU_xQueueAddToSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueAddToSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueAddToSet /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueAddToRegistry @@ -770,10 +641,7 @@ MPU_vQueueAddToRegistry: b MPU_vQueueAddToRegistryImpl MPU_vQueueAddToRegistry_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueAddToRegistryImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueAddToRegistry /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueUnregisterQueue @@ -787,10 +655,7 @@ MPU_vQueueUnregisterQueue: b MPU_vQueueUnregisterQueueImpl MPU_vQueueUnregisterQueue_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueUnregisterQueueImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueUnregisterQueue /*-----------------------------------------------------------*/ PUBLIC MPU_pcQueueGetName @@ -804,10 +669,7 @@ MPU_pcQueueGetName: b MPU_pcQueueGetNameImpl MPU_pcQueueGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcQueueGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcQueueGetName /*-----------------------------------------------------------*/ PUBLIC MPU_pvTimerGetTimerID @@ -821,10 +683,7 @@ MPU_pvTimerGetTimerID: b MPU_pvTimerGetTimerIDImpl MPU_pvTimerGetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTimerGetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTimerGetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetTimerID @@ -838,10 +697,7 @@ MPU_vTimerSetTimerID: b MPU_vTimerSetTimerIDImpl MPU_vTimerSetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerIsTimerActive @@ -855,10 +711,7 @@ MPU_xTimerIsTimerActive: b MPU_xTimerIsTimerActiveImpl MPU_xTimerIsTimerActive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerIsTimerActiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerIsTimerActive /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetTimerDaemonTaskHandle @@ -872,14 +725,11 @@ MPU_xTimerGetTimerDaemonTaskHandle: b MPU_xTimerGetTimerDaemonTaskHandleImpl MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetTimerDaemonTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle /*-----------------------------------------------------------*/ - PUBLIC MPU_xTimerGenericCommandFromTask -MPU_xTimerGenericCommandFromTask: + PUBLIC MPU_xTimerGenericCommandFromTaskEntry +MPU_xTimerGenericCommandFromTaskEntry: push {r0} mrs r0, control tst r0, #1 @@ -889,10 +739,7 @@ MPU_xTimerGenericCommandFromTask: b MPU_xTimerGenericCommandFromTaskImpl MPU_xTimerGenericCommandFromTask_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTimerGenericCommandFromTaskImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGenericCommandFromTask /*-----------------------------------------------------------*/ PUBLIC MPU_pcTimerGetName @@ -906,10 +753,7 @@ MPU_pcTimerGetName: b MPU_pcTimerGetNameImpl MPU_pcTimerGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcTimerGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcTimerGetName /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetReloadMode @@ -923,10 +767,7 @@ MPU_vTimerSetReloadMode: b MPU_vTimerSetReloadModeImpl MPU_vTimerSetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetReloadMode @@ -940,10 +781,7 @@ MPU_xTimerGetReloadMode: b MPU_xTimerGetReloadModeImpl MPU_xTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_uxTimerGetReloadMode @@ -957,10 +795,7 @@ MPU_uxTimerGetReloadMode: b MPU_uxTimerGetReloadModeImpl MPU_uxTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetPeriod @@ -974,10 +809,7 @@ MPU_xTimerGetPeriod: b MPU_xTimerGetPeriodImpl MPU_xTimerGetPeriod_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetPeriodImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetPeriod /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetExpiryTime @@ -991,14 +823,11 @@ MPU_xTimerGetExpiryTime: b MPU_xTimerGetExpiryTimeImpl MPU_xTimerGetExpiryTime_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetExpiryTimeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetExpiryTime /*-----------------------------------------------------------*/ - PUBLIC MPU_xEventGroupWaitBits -MPU_xEventGroupWaitBits: + PUBLIC MPU_xEventGroupWaitBitsEntry +MPU_xEventGroupWaitBitsEntry: push {r0} mrs r0, control tst r0, #1 @@ -1008,10 +837,7 @@ MPU_xEventGroupWaitBits: b MPU_xEventGroupWaitBitsImpl MPU_xEventGroupWaitBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xEventGroupWaitBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupWaitBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupClearBits @@ -1025,10 +851,7 @@ MPU_xEventGroupClearBits: b MPU_xEventGroupClearBitsImpl MPU_xEventGroupClearBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupClearBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupClearBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSetBits @@ -1042,10 +865,7 @@ MPU_xEventGroupSetBits: b MPU_xEventGroupSetBitsImpl MPU_xEventGroupSetBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSetBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSetBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSync @@ -1059,10 +879,7 @@ MPU_xEventGroupSync: b MPU_xEventGroupSyncImpl MPU_xEventGroupSync_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSyncImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSync /*-----------------------------------------------------------*/ PUBLIC MPU_uxEventGroupGetNumber @@ -1076,10 +893,7 @@ MPU_uxEventGroupGetNumber: b MPU_uxEventGroupGetNumberImpl MPU_uxEventGroupGetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxEventGroupGetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxEventGroupGetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_vEventGroupSetNumber @@ -1093,10 +907,7 @@ MPU_vEventGroupSetNumber: b MPU_vEventGroupSetNumberImpl MPU_vEventGroupSetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vEventGroupSetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vEventGroupSetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSend @@ -1110,10 +921,7 @@ MPU_xStreamBufferSend: b MPU_xStreamBufferSendImpl MPU_xStreamBufferSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSend /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferReceive @@ -1127,10 +935,7 @@ MPU_xStreamBufferReceive: b MPU_xStreamBufferReceiveImpl MPU_xStreamBufferReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsFull @@ -1144,10 +949,7 @@ MPU_xStreamBufferIsFull: b MPU_xStreamBufferIsFullImpl MPU_xStreamBufferIsFull_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsFullImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsFull /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsEmpty @@ -1161,10 +963,7 @@ MPU_xStreamBufferIsEmpty: b MPU_xStreamBufferIsEmptyImpl MPU_xStreamBufferIsEmpty_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsEmptyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsEmpty /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSpacesAvailable @@ -1178,10 +977,7 @@ MPU_xStreamBufferSpacesAvailable: b MPU_xStreamBufferSpacesAvailableImpl MPU_xStreamBufferSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferBytesAvailable @@ -1195,10 +991,7 @@ MPU_xStreamBufferBytesAvailable: b MPU_xStreamBufferBytesAvailableImpl MPU_xStreamBufferBytesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferBytesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferBytesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSetTriggerLevel @@ -1212,10 +1005,7 @@ MPU_xStreamBufferSetTriggerLevel: b MPU_xStreamBufferSetTriggerLevelImpl MPU_xStreamBufferSetTriggerLevel_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSetTriggerLevelImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSetTriggerLevel /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferNextMessageLengthBytes @@ -1229,10 +1019,7 @@ MPU_xStreamBufferNextMessageLengthBytes: b MPU_xStreamBufferNextMessageLengthBytesImpl MPU_xStreamBufferNextMessageLengthBytes_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferNextMessageLengthBytesImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferNextMessageLengthBytes /*-----------------------------------------------------------*/ /* Default weak implementations in case one is not available from diff --git a/portable/IAR/ARM_CM55/non_secure/port.c b/portable/IAR/ARM_CM55/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/IAR/ARM_CM55/non_secure/port.c +++ b/portable/IAR/ARM_CM55/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM55/non_secure/portasm.s b/portable/IAR/ARM_CM55/non_secure/portasm.s index 15e74ffc1..d8f1b1d9a 100644 --- a/portable/IAR/ARM_CM55/non_secure/portasm.s +++ b/portable/IAR/ARM_CM55/non_secure/portasm.s @@ -32,6 +32,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 @@ -44,7 +47,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 @@ -86,7 +88,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. */ /*-----------------------------------------------------------*/ @@ -205,7 +207,7 @@ vStartFirstTask: cpsie f 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: @@ -455,11 +457,9 @@ SVC_Handler: ldr r1, [r0, #24] ldrb r2, [r1, #-2] - cmp r2, #4 /* portSVC_SYSTEM_CALL_ENTER. */ - beq syscall_enter - cmp r2, #5 /* portSVC_SYSTEM_CALL_ENTER_1. */ - beq syscall_enter_1 - cmp r2, #6 /* portSVC_SYSTEM_CALL_EXIT. */ + cmp r2, #NUM_SYSTEM_CALLS + blt syscall_enter + cmp r2, #104 /* portSVC_SYSTEM_CALL_EXIT. */ beq syscall_exit b vPortSVCHandler_C @@ -467,10 +467,6 @@ SVC_Handler: mov r1, lr b vSystemCallEnter - syscall_enter_1: - mov r1, lr - b vSystemCallEnter_1 - syscall_exit: mov r1, lr b vSystemCallExit @@ -493,7 +489,7 @@ vPortFreeSecureContext: ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */ cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */ it ne - svcne 1 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 1. */ + svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */ bx lr /* Return. */ /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM55/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM55/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/IAR/ARM_CM55/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM55/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM55_NTZ/non_secure/mpu_wrappers_v2_asm.S b/portable/IAR/ARM_CM55_NTZ/non_secure/mpu_wrappers_v2_asm.S index 1005dad33..80d5a1c63 100644 --- a/portable/IAR/ARM_CM55_NTZ/non_secure/mpu_wrappers_v2_asm.S +++ b/portable/IAR/ARM_CM55_NTZ/non_secure/mpu_wrappers_v2_asm.S @@ -32,15 +32,12 @@ /*-----------------------------------------------------------*/ #include "FreeRTOSConfig.h" +#include "mpu_syscall_numbers.h" #ifndef configUSE_MPU_WRAPPERS_V1 #define configUSE_MPU_WRAPPERS_V1 0 #endif -/* These must be in sync with portmacro.h. */ -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) @@ -56,10 +53,7 @@ MPU_xTaskDelayUntil: b MPU_xTaskDelayUntilImpl MPU_xTaskDelayUntil_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskDelayUntilImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskDelayUntil /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskAbortDelay @@ -73,10 +67,7 @@ MPU_xTaskAbortDelay: b MPU_xTaskAbortDelayImpl MPU_xTaskAbortDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskAbortDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskAbortDelay /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskDelay @@ -90,10 +81,7 @@ MPU_vTaskDelay: b MPU_vTaskDelayImpl MPU_vTaskDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskDelay /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskPriorityGet @@ -107,10 +95,7 @@ MPU_uxTaskPriorityGet: b MPU_uxTaskPriorityGetImpl MPU_uxTaskPriorityGet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskPriorityGetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskPriorityGet /*-----------------------------------------------------------*/ PUBLIC MPU_eTaskGetState @@ -124,10 +109,7 @@ MPU_eTaskGetState: b MPU_eTaskGetStateImpl MPU_eTaskGetState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_eTaskGetStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_eTaskGetState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskGetInfo @@ -141,10 +123,7 @@ MPU_vTaskGetInfo: b MPU_vTaskGetInfoImpl MPU_vTaskGetInfo_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskGetInfoImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskGetInfo /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetIdleTaskHandle @@ -158,10 +137,7 @@ MPU_xTaskGetIdleTaskHandle: b MPU_xTaskGetIdleTaskHandleImpl MPU_xTaskGetIdleTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetIdleTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetIdleTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSuspend @@ -175,10 +151,7 @@ MPU_vTaskSuspend: b MPU_vTaskSuspendImpl MPU_vTaskSuspend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSuspendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSuspend /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskResume @@ -192,10 +165,7 @@ MPU_vTaskResume: b MPU_vTaskResumeImpl MPU_vTaskResume_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskResumeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskResume /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetTickCount @@ -209,10 +179,7 @@ MPU_xTaskGetTickCount: b MPU_xTaskGetTickCountImpl MPU_xTaskGetTickCount_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetTickCountImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetTickCount /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetNumberOfTasks @@ -226,10 +193,7 @@ MPU_uxTaskGetNumberOfTasks: b MPU_uxTaskGetNumberOfTasksImpl MPU_uxTaskGetNumberOfTasks_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetNumberOfTasksImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetNumberOfTasks /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimeCounter @@ -243,10 +207,7 @@ MPU_ulTaskGetRunTimeCounter: b MPU_ulTaskGetRunTimeCounterImpl MPU_ulTaskGetRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimePercent @@ -260,10 +221,7 @@ MPU_ulTaskGetRunTimePercent: b MPU_ulTaskGetRunTimePercentImpl MPU_ulTaskGetRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimePercent @@ -277,10 +235,7 @@ MPU_ulTaskGetIdleRunTimePercent: b MPU_ulTaskGetIdleRunTimePercentImpl MPU_ulTaskGetIdleRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimeCounter @@ -294,10 +249,7 @@ MPU_ulTaskGetIdleRunTimeCounter: b MPU_ulTaskGetIdleRunTimeCounterImpl MPU_ulTaskGetIdleRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetApplicationTaskTag @@ -311,10 +263,7 @@ MPU_vTaskSetApplicationTaskTag: b MPU_vTaskSetApplicationTaskTagImpl MPU_vTaskSetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetApplicationTaskTag @@ -328,10 +277,7 @@ MPU_xTaskGetApplicationTaskTag: b MPU_xTaskGetApplicationTaskTagImpl MPU_xTaskGetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetThreadLocalStoragePointer @@ -345,10 +291,7 @@ MPU_vTaskSetThreadLocalStoragePointer: b MPU_vTaskSetThreadLocalStoragePointerImpl MPU_vTaskSetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_pvTaskGetThreadLocalStoragePointer @@ -362,10 +305,7 @@ MPU_pvTaskGetThreadLocalStoragePointer: b MPU_pvTaskGetThreadLocalStoragePointerImpl MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTaskGetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetSystemState @@ -379,10 +319,7 @@ MPU_uxTaskGetSystemState: b MPU_uxTaskGetSystemStateImpl MPU_uxTaskGetSystemState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetSystemStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetSystemState /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark @@ -396,10 +333,7 @@ MPU_uxTaskGetStackHighWaterMark: b MPU_uxTaskGetStackHighWaterMarkImpl MPU_uxTaskGetStackHighWaterMark_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMarkImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark2 @@ -413,10 +347,7 @@ MPU_uxTaskGetStackHighWaterMark2: b MPU_uxTaskGetStackHighWaterMark2Impl MPU_uxTaskGetStackHighWaterMark2_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMark2Impl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark2 /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetCurrentTaskHandle @@ -430,10 +361,7 @@ MPU_xTaskGetCurrentTaskHandle: b MPU_xTaskGetCurrentTaskHandleImpl MPU_xTaskGetCurrentTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetCurrentTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetCurrentTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetSchedulerState @@ -447,10 +375,7 @@ MPU_xTaskGetSchedulerState: b MPU_xTaskGetSchedulerStateImpl MPU_xTaskGetSchedulerState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetSchedulerStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetSchedulerState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetTimeOutState @@ -464,10 +389,7 @@ MPU_vTaskSetTimeOutState: b MPU_vTaskSetTimeOutStateImpl MPU_vTaskSetTimeOutState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetTimeOutStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetTimeOutState /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskCheckForTimeOut @@ -481,14 +403,11 @@ MPU_xTaskCheckForTimeOut: b MPU_xTaskCheckForTimeOutImpl MPU_xTaskCheckForTimeOut_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskCheckForTimeOutImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskCheckForTimeOut /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotify -MPU_xTaskGenericNotify: + PUBLIC MPU_xTaskGenericNotifyEntry +MPU_xTaskGenericNotifyEntry: push {r0} mrs r0, control tst r0, #1 @@ -498,14 +417,11 @@ MPU_xTaskGenericNotify: b MPU_xTaskGenericNotifyImpl MPU_xTaskGenericNotify_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotify /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotifyWait -MPU_xTaskGenericNotifyWait: + PUBLIC MPU_xTaskGenericNotifyWaitEntry +MPU_xTaskGenericNotifyWaitEntry: push {r0} mrs r0, control tst r0, #1 @@ -515,10 +431,7 @@ MPU_xTaskGenericNotifyWait: b MPU_xTaskGenericNotifyWaitImpl MPU_xTaskGenericNotifyWait_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyWaitImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyWait /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyTake @@ -532,10 +445,7 @@ MPU_ulTaskGenericNotifyTake: b MPU_ulTaskGenericNotifyTakeImpl MPU_ulTaskGenericNotifyTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyTake /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGenericNotifyStateClear @@ -549,10 +459,7 @@ MPU_xTaskGenericNotifyStateClear: b MPU_xTaskGenericNotifyStateClearImpl MPU_xTaskGenericNotifyStateClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGenericNotifyStateClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyStateClear /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyValueClear @@ -566,10 +473,7 @@ MPU_ulTaskGenericNotifyValueClear: b MPU_ulTaskGenericNotifyValueClearImpl MPU_ulTaskGenericNotifyValueClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyValueClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyValueClear /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGenericSend @@ -583,10 +487,7 @@ MPU_xQueueGenericSend: b MPU_xQueueGenericSendImpl MPU_xQueueGenericSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGenericSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGenericSend /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueMessagesWaiting @@ -600,10 +501,7 @@ MPU_uxQueueMessagesWaiting: b MPU_uxQueueMessagesWaitingImpl MPU_uxQueueMessagesWaiting_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueMessagesWaitingImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueMessagesWaiting /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueSpacesAvailable @@ -617,10 +515,7 @@ MPU_uxQueueSpacesAvailable: b MPU_uxQueueSpacesAvailableImpl MPU_uxQueueSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueReceive @@ -634,10 +529,7 @@ MPU_xQueueReceive: b MPU_xQueueReceiveImpl MPU_xQueueReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueuePeek @@ -651,10 +543,7 @@ MPU_xQueuePeek: b MPU_xQueuePeekImpl MPU_xQueuePeek_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueuePeekImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueuePeek /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSemaphoreTake @@ -668,10 +557,7 @@ MPU_xQueueSemaphoreTake: b MPU_xQueueSemaphoreTakeImpl MPU_xQueueSemaphoreTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSemaphoreTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSemaphoreTake /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGetMutexHolder @@ -685,10 +571,7 @@ MPU_xQueueGetMutexHolder: b MPU_xQueueGetMutexHolderImpl MPU_xQueueGetMutexHolder_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGetMutexHolderImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGetMutexHolder /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueTakeMutexRecursive @@ -702,10 +585,7 @@ MPU_xQueueTakeMutexRecursive: b MPU_xQueueTakeMutexRecursiveImpl MPU_xQueueTakeMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueTakeMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueTakeMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGiveMutexRecursive @@ -719,10 +599,7 @@ MPU_xQueueGiveMutexRecursive: b MPU_xQueueGiveMutexRecursiveImpl MPU_xQueueGiveMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGiveMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGiveMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSelectFromSet @@ -736,10 +613,7 @@ MPU_xQueueSelectFromSet: b MPU_xQueueSelectFromSetImpl MPU_xQueueSelectFromSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSelectFromSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSelectFromSet /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueAddToSet @@ -753,10 +627,7 @@ MPU_xQueueAddToSet: b MPU_xQueueAddToSetImpl MPU_xQueueAddToSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueAddToSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueAddToSet /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueAddToRegistry @@ -770,10 +641,7 @@ MPU_vQueueAddToRegistry: b MPU_vQueueAddToRegistryImpl MPU_vQueueAddToRegistry_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueAddToRegistryImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueAddToRegistry /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueUnregisterQueue @@ -787,10 +655,7 @@ MPU_vQueueUnregisterQueue: b MPU_vQueueUnregisterQueueImpl MPU_vQueueUnregisterQueue_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueUnregisterQueueImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueUnregisterQueue /*-----------------------------------------------------------*/ PUBLIC MPU_pcQueueGetName @@ -804,10 +669,7 @@ MPU_pcQueueGetName: b MPU_pcQueueGetNameImpl MPU_pcQueueGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcQueueGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcQueueGetName /*-----------------------------------------------------------*/ PUBLIC MPU_pvTimerGetTimerID @@ -821,10 +683,7 @@ MPU_pvTimerGetTimerID: b MPU_pvTimerGetTimerIDImpl MPU_pvTimerGetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTimerGetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTimerGetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetTimerID @@ -838,10 +697,7 @@ MPU_vTimerSetTimerID: b MPU_vTimerSetTimerIDImpl MPU_vTimerSetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerIsTimerActive @@ -855,10 +711,7 @@ MPU_xTimerIsTimerActive: b MPU_xTimerIsTimerActiveImpl MPU_xTimerIsTimerActive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerIsTimerActiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerIsTimerActive /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetTimerDaemonTaskHandle @@ -872,14 +725,11 @@ MPU_xTimerGetTimerDaemonTaskHandle: b MPU_xTimerGetTimerDaemonTaskHandleImpl MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetTimerDaemonTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle /*-----------------------------------------------------------*/ - PUBLIC MPU_xTimerGenericCommandFromTask -MPU_xTimerGenericCommandFromTask: + PUBLIC MPU_xTimerGenericCommandFromTaskEntry +MPU_xTimerGenericCommandFromTaskEntry: push {r0} mrs r0, control tst r0, #1 @@ -889,10 +739,7 @@ MPU_xTimerGenericCommandFromTask: b MPU_xTimerGenericCommandFromTaskImpl MPU_xTimerGenericCommandFromTask_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTimerGenericCommandFromTaskImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGenericCommandFromTask /*-----------------------------------------------------------*/ PUBLIC MPU_pcTimerGetName @@ -906,10 +753,7 @@ MPU_pcTimerGetName: b MPU_pcTimerGetNameImpl MPU_pcTimerGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcTimerGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcTimerGetName /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetReloadMode @@ -923,10 +767,7 @@ MPU_vTimerSetReloadMode: b MPU_vTimerSetReloadModeImpl MPU_vTimerSetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetReloadMode @@ -940,10 +781,7 @@ MPU_xTimerGetReloadMode: b MPU_xTimerGetReloadModeImpl MPU_xTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_uxTimerGetReloadMode @@ -957,10 +795,7 @@ MPU_uxTimerGetReloadMode: b MPU_uxTimerGetReloadModeImpl MPU_uxTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetPeriod @@ -974,10 +809,7 @@ MPU_xTimerGetPeriod: b MPU_xTimerGetPeriodImpl MPU_xTimerGetPeriod_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetPeriodImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetPeriod /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetExpiryTime @@ -991,14 +823,11 @@ MPU_xTimerGetExpiryTime: b MPU_xTimerGetExpiryTimeImpl MPU_xTimerGetExpiryTime_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetExpiryTimeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetExpiryTime /*-----------------------------------------------------------*/ - PUBLIC MPU_xEventGroupWaitBits -MPU_xEventGroupWaitBits: + PUBLIC MPU_xEventGroupWaitBitsEntry +MPU_xEventGroupWaitBitsEntry: push {r0} mrs r0, control tst r0, #1 @@ -1008,10 +837,7 @@ MPU_xEventGroupWaitBits: b MPU_xEventGroupWaitBitsImpl MPU_xEventGroupWaitBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xEventGroupWaitBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupWaitBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupClearBits @@ -1025,10 +851,7 @@ MPU_xEventGroupClearBits: b MPU_xEventGroupClearBitsImpl MPU_xEventGroupClearBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupClearBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupClearBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSetBits @@ -1042,10 +865,7 @@ MPU_xEventGroupSetBits: b MPU_xEventGroupSetBitsImpl MPU_xEventGroupSetBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSetBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSetBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSync @@ -1059,10 +879,7 @@ MPU_xEventGroupSync: b MPU_xEventGroupSyncImpl MPU_xEventGroupSync_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSyncImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSync /*-----------------------------------------------------------*/ PUBLIC MPU_uxEventGroupGetNumber @@ -1076,10 +893,7 @@ MPU_uxEventGroupGetNumber: b MPU_uxEventGroupGetNumberImpl MPU_uxEventGroupGetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxEventGroupGetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxEventGroupGetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_vEventGroupSetNumber @@ -1093,10 +907,7 @@ MPU_vEventGroupSetNumber: b MPU_vEventGroupSetNumberImpl MPU_vEventGroupSetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vEventGroupSetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vEventGroupSetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSend @@ -1110,10 +921,7 @@ MPU_xStreamBufferSend: b MPU_xStreamBufferSendImpl MPU_xStreamBufferSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSend /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferReceive @@ -1127,10 +935,7 @@ MPU_xStreamBufferReceive: b MPU_xStreamBufferReceiveImpl MPU_xStreamBufferReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsFull @@ -1144,10 +949,7 @@ MPU_xStreamBufferIsFull: b MPU_xStreamBufferIsFullImpl MPU_xStreamBufferIsFull_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsFullImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsFull /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsEmpty @@ -1161,10 +963,7 @@ MPU_xStreamBufferIsEmpty: b MPU_xStreamBufferIsEmptyImpl MPU_xStreamBufferIsEmpty_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsEmptyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsEmpty /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSpacesAvailable @@ -1178,10 +977,7 @@ MPU_xStreamBufferSpacesAvailable: b MPU_xStreamBufferSpacesAvailableImpl MPU_xStreamBufferSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferBytesAvailable @@ -1195,10 +991,7 @@ MPU_xStreamBufferBytesAvailable: b MPU_xStreamBufferBytesAvailableImpl MPU_xStreamBufferBytesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferBytesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferBytesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSetTriggerLevel @@ -1212,10 +1005,7 @@ MPU_xStreamBufferSetTriggerLevel: b MPU_xStreamBufferSetTriggerLevelImpl MPU_xStreamBufferSetTriggerLevel_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSetTriggerLevelImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSetTriggerLevel /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferNextMessageLengthBytes @@ -1229,10 +1019,7 @@ MPU_xStreamBufferNextMessageLengthBytes: b MPU_xStreamBufferNextMessageLengthBytesImpl MPU_xStreamBufferNextMessageLengthBytes_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferNextMessageLengthBytesImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferNextMessageLengthBytes /*-----------------------------------------------------------*/ /* Default weak implementations in case one is not available from diff --git a/portable/IAR/ARM_CM55_NTZ/non_secure/port.c b/portable/IAR/ARM_CM55_NTZ/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/IAR/ARM_CM55_NTZ/non_secure/port.c +++ b/portable/IAR/ARM_CM55_NTZ/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM55_NTZ/non_secure/portasm.s b/portable/IAR/ARM_CM55_NTZ/non_secure/portasm.s index ec5202527..7cf467d22 100644 --- a/portable/IAR/ARM_CM55_NTZ/non_secure/portasm.s +++ b/portable/IAR/ARM_CM55_NTZ/non_secure/portasm.s @@ -32,6 +32,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 @@ -41,7 +44,6 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler. EXTERN vPortSVCHandler_C #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) EXTERN vSystemCallEnter - EXTERN vSystemCallEnter_1 EXTERN vSystemCallExit #endif @@ -191,7 +193,7 @@ vStartFirstTask: cpsie f 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: @@ -371,11 +373,9 @@ SVC_Handler: ldr r1, [r0, #24] ldrb r2, [r1, #-2] - cmp r2, #4 /* portSVC_SYSTEM_CALL_ENTER. */ - beq syscall_enter - cmp r2, #5 /* portSVC_SYSTEM_CALL_ENTER_1. */ - beq syscall_enter_1 - cmp r2, #6 /* portSVC_SYSTEM_CALL_EXIT. */ + cmp r2, #NUM_SYSTEM_CALLS + blt syscall_enter + cmp r2, #104 /* portSVC_SYSTEM_CALL_EXIT. */ beq syscall_exit b vPortSVCHandler_C @@ -383,10 +383,6 @@ SVC_Handler: mov r1, lr b vSystemCallEnter - syscall_enter_1: - mov r1, lr - b vSystemCallEnter_1 - syscall_exit: mov r1, lr b vSystemCallExit diff --git a/portable/IAR/ARM_CM55_NTZ/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM55_NTZ/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/IAR/ARM_CM55_NTZ/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM55_NTZ/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM85/non_secure/mpu_wrappers_v2_asm.S b/portable/IAR/ARM_CM85/non_secure/mpu_wrappers_v2_asm.S index 1005dad33..80d5a1c63 100644 --- a/portable/IAR/ARM_CM85/non_secure/mpu_wrappers_v2_asm.S +++ b/portable/IAR/ARM_CM85/non_secure/mpu_wrappers_v2_asm.S @@ -32,15 +32,12 @@ /*-----------------------------------------------------------*/ #include "FreeRTOSConfig.h" +#include "mpu_syscall_numbers.h" #ifndef configUSE_MPU_WRAPPERS_V1 #define configUSE_MPU_WRAPPERS_V1 0 #endif -/* These must be in sync with portmacro.h. */ -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) @@ -56,10 +53,7 @@ MPU_xTaskDelayUntil: b MPU_xTaskDelayUntilImpl MPU_xTaskDelayUntil_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskDelayUntilImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskDelayUntil /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskAbortDelay @@ -73,10 +67,7 @@ MPU_xTaskAbortDelay: b MPU_xTaskAbortDelayImpl MPU_xTaskAbortDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskAbortDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskAbortDelay /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskDelay @@ -90,10 +81,7 @@ MPU_vTaskDelay: b MPU_vTaskDelayImpl MPU_vTaskDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskDelay /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskPriorityGet @@ -107,10 +95,7 @@ MPU_uxTaskPriorityGet: b MPU_uxTaskPriorityGetImpl MPU_uxTaskPriorityGet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskPriorityGetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskPriorityGet /*-----------------------------------------------------------*/ PUBLIC MPU_eTaskGetState @@ -124,10 +109,7 @@ MPU_eTaskGetState: b MPU_eTaskGetStateImpl MPU_eTaskGetState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_eTaskGetStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_eTaskGetState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskGetInfo @@ -141,10 +123,7 @@ MPU_vTaskGetInfo: b MPU_vTaskGetInfoImpl MPU_vTaskGetInfo_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskGetInfoImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskGetInfo /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetIdleTaskHandle @@ -158,10 +137,7 @@ MPU_xTaskGetIdleTaskHandle: b MPU_xTaskGetIdleTaskHandleImpl MPU_xTaskGetIdleTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetIdleTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetIdleTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSuspend @@ -175,10 +151,7 @@ MPU_vTaskSuspend: b MPU_vTaskSuspendImpl MPU_vTaskSuspend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSuspendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSuspend /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskResume @@ -192,10 +165,7 @@ MPU_vTaskResume: b MPU_vTaskResumeImpl MPU_vTaskResume_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskResumeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskResume /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetTickCount @@ -209,10 +179,7 @@ MPU_xTaskGetTickCount: b MPU_xTaskGetTickCountImpl MPU_xTaskGetTickCount_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetTickCountImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetTickCount /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetNumberOfTasks @@ -226,10 +193,7 @@ MPU_uxTaskGetNumberOfTasks: b MPU_uxTaskGetNumberOfTasksImpl MPU_uxTaskGetNumberOfTasks_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetNumberOfTasksImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetNumberOfTasks /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimeCounter @@ -243,10 +207,7 @@ MPU_ulTaskGetRunTimeCounter: b MPU_ulTaskGetRunTimeCounterImpl MPU_ulTaskGetRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimePercent @@ -260,10 +221,7 @@ MPU_ulTaskGetRunTimePercent: b MPU_ulTaskGetRunTimePercentImpl MPU_ulTaskGetRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimePercent @@ -277,10 +235,7 @@ MPU_ulTaskGetIdleRunTimePercent: b MPU_ulTaskGetIdleRunTimePercentImpl MPU_ulTaskGetIdleRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimeCounter @@ -294,10 +249,7 @@ MPU_ulTaskGetIdleRunTimeCounter: b MPU_ulTaskGetIdleRunTimeCounterImpl MPU_ulTaskGetIdleRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetApplicationTaskTag @@ -311,10 +263,7 @@ MPU_vTaskSetApplicationTaskTag: b MPU_vTaskSetApplicationTaskTagImpl MPU_vTaskSetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetApplicationTaskTag @@ -328,10 +277,7 @@ MPU_xTaskGetApplicationTaskTag: b MPU_xTaskGetApplicationTaskTagImpl MPU_xTaskGetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetThreadLocalStoragePointer @@ -345,10 +291,7 @@ MPU_vTaskSetThreadLocalStoragePointer: b MPU_vTaskSetThreadLocalStoragePointerImpl MPU_vTaskSetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_pvTaskGetThreadLocalStoragePointer @@ -362,10 +305,7 @@ MPU_pvTaskGetThreadLocalStoragePointer: b MPU_pvTaskGetThreadLocalStoragePointerImpl MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTaskGetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetSystemState @@ -379,10 +319,7 @@ MPU_uxTaskGetSystemState: b MPU_uxTaskGetSystemStateImpl MPU_uxTaskGetSystemState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetSystemStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetSystemState /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark @@ -396,10 +333,7 @@ MPU_uxTaskGetStackHighWaterMark: b MPU_uxTaskGetStackHighWaterMarkImpl MPU_uxTaskGetStackHighWaterMark_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMarkImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark2 @@ -413,10 +347,7 @@ MPU_uxTaskGetStackHighWaterMark2: b MPU_uxTaskGetStackHighWaterMark2Impl MPU_uxTaskGetStackHighWaterMark2_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMark2Impl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark2 /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetCurrentTaskHandle @@ -430,10 +361,7 @@ MPU_xTaskGetCurrentTaskHandle: b MPU_xTaskGetCurrentTaskHandleImpl MPU_xTaskGetCurrentTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetCurrentTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetCurrentTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetSchedulerState @@ -447,10 +375,7 @@ MPU_xTaskGetSchedulerState: b MPU_xTaskGetSchedulerStateImpl MPU_xTaskGetSchedulerState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetSchedulerStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetSchedulerState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetTimeOutState @@ -464,10 +389,7 @@ MPU_vTaskSetTimeOutState: b MPU_vTaskSetTimeOutStateImpl MPU_vTaskSetTimeOutState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetTimeOutStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetTimeOutState /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskCheckForTimeOut @@ -481,14 +403,11 @@ MPU_xTaskCheckForTimeOut: b MPU_xTaskCheckForTimeOutImpl MPU_xTaskCheckForTimeOut_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskCheckForTimeOutImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskCheckForTimeOut /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotify -MPU_xTaskGenericNotify: + PUBLIC MPU_xTaskGenericNotifyEntry +MPU_xTaskGenericNotifyEntry: push {r0} mrs r0, control tst r0, #1 @@ -498,14 +417,11 @@ MPU_xTaskGenericNotify: b MPU_xTaskGenericNotifyImpl MPU_xTaskGenericNotify_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotify /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotifyWait -MPU_xTaskGenericNotifyWait: + PUBLIC MPU_xTaskGenericNotifyWaitEntry +MPU_xTaskGenericNotifyWaitEntry: push {r0} mrs r0, control tst r0, #1 @@ -515,10 +431,7 @@ MPU_xTaskGenericNotifyWait: b MPU_xTaskGenericNotifyWaitImpl MPU_xTaskGenericNotifyWait_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyWaitImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyWait /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyTake @@ -532,10 +445,7 @@ MPU_ulTaskGenericNotifyTake: b MPU_ulTaskGenericNotifyTakeImpl MPU_ulTaskGenericNotifyTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyTake /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGenericNotifyStateClear @@ -549,10 +459,7 @@ MPU_xTaskGenericNotifyStateClear: b MPU_xTaskGenericNotifyStateClearImpl MPU_xTaskGenericNotifyStateClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGenericNotifyStateClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyStateClear /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyValueClear @@ -566,10 +473,7 @@ MPU_ulTaskGenericNotifyValueClear: b MPU_ulTaskGenericNotifyValueClearImpl MPU_ulTaskGenericNotifyValueClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyValueClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyValueClear /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGenericSend @@ -583,10 +487,7 @@ MPU_xQueueGenericSend: b MPU_xQueueGenericSendImpl MPU_xQueueGenericSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGenericSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGenericSend /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueMessagesWaiting @@ -600,10 +501,7 @@ MPU_uxQueueMessagesWaiting: b MPU_uxQueueMessagesWaitingImpl MPU_uxQueueMessagesWaiting_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueMessagesWaitingImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueMessagesWaiting /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueSpacesAvailable @@ -617,10 +515,7 @@ MPU_uxQueueSpacesAvailable: b MPU_uxQueueSpacesAvailableImpl MPU_uxQueueSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueReceive @@ -634,10 +529,7 @@ MPU_xQueueReceive: b MPU_xQueueReceiveImpl MPU_xQueueReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueuePeek @@ -651,10 +543,7 @@ MPU_xQueuePeek: b MPU_xQueuePeekImpl MPU_xQueuePeek_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueuePeekImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueuePeek /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSemaphoreTake @@ -668,10 +557,7 @@ MPU_xQueueSemaphoreTake: b MPU_xQueueSemaphoreTakeImpl MPU_xQueueSemaphoreTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSemaphoreTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSemaphoreTake /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGetMutexHolder @@ -685,10 +571,7 @@ MPU_xQueueGetMutexHolder: b MPU_xQueueGetMutexHolderImpl MPU_xQueueGetMutexHolder_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGetMutexHolderImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGetMutexHolder /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueTakeMutexRecursive @@ -702,10 +585,7 @@ MPU_xQueueTakeMutexRecursive: b MPU_xQueueTakeMutexRecursiveImpl MPU_xQueueTakeMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueTakeMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueTakeMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGiveMutexRecursive @@ -719,10 +599,7 @@ MPU_xQueueGiveMutexRecursive: b MPU_xQueueGiveMutexRecursiveImpl MPU_xQueueGiveMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGiveMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGiveMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSelectFromSet @@ -736,10 +613,7 @@ MPU_xQueueSelectFromSet: b MPU_xQueueSelectFromSetImpl MPU_xQueueSelectFromSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSelectFromSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSelectFromSet /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueAddToSet @@ -753,10 +627,7 @@ MPU_xQueueAddToSet: b MPU_xQueueAddToSetImpl MPU_xQueueAddToSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueAddToSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueAddToSet /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueAddToRegistry @@ -770,10 +641,7 @@ MPU_vQueueAddToRegistry: b MPU_vQueueAddToRegistryImpl MPU_vQueueAddToRegistry_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueAddToRegistryImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueAddToRegistry /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueUnregisterQueue @@ -787,10 +655,7 @@ MPU_vQueueUnregisterQueue: b MPU_vQueueUnregisterQueueImpl MPU_vQueueUnregisterQueue_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueUnregisterQueueImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueUnregisterQueue /*-----------------------------------------------------------*/ PUBLIC MPU_pcQueueGetName @@ -804,10 +669,7 @@ MPU_pcQueueGetName: b MPU_pcQueueGetNameImpl MPU_pcQueueGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcQueueGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcQueueGetName /*-----------------------------------------------------------*/ PUBLIC MPU_pvTimerGetTimerID @@ -821,10 +683,7 @@ MPU_pvTimerGetTimerID: b MPU_pvTimerGetTimerIDImpl MPU_pvTimerGetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTimerGetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTimerGetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetTimerID @@ -838,10 +697,7 @@ MPU_vTimerSetTimerID: b MPU_vTimerSetTimerIDImpl MPU_vTimerSetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerIsTimerActive @@ -855,10 +711,7 @@ MPU_xTimerIsTimerActive: b MPU_xTimerIsTimerActiveImpl MPU_xTimerIsTimerActive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerIsTimerActiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerIsTimerActive /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetTimerDaemonTaskHandle @@ -872,14 +725,11 @@ MPU_xTimerGetTimerDaemonTaskHandle: b MPU_xTimerGetTimerDaemonTaskHandleImpl MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetTimerDaemonTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle /*-----------------------------------------------------------*/ - PUBLIC MPU_xTimerGenericCommandFromTask -MPU_xTimerGenericCommandFromTask: + PUBLIC MPU_xTimerGenericCommandFromTaskEntry +MPU_xTimerGenericCommandFromTaskEntry: push {r0} mrs r0, control tst r0, #1 @@ -889,10 +739,7 @@ MPU_xTimerGenericCommandFromTask: b MPU_xTimerGenericCommandFromTaskImpl MPU_xTimerGenericCommandFromTask_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTimerGenericCommandFromTaskImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGenericCommandFromTask /*-----------------------------------------------------------*/ PUBLIC MPU_pcTimerGetName @@ -906,10 +753,7 @@ MPU_pcTimerGetName: b MPU_pcTimerGetNameImpl MPU_pcTimerGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcTimerGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcTimerGetName /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetReloadMode @@ -923,10 +767,7 @@ MPU_vTimerSetReloadMode: b MPU_vTimerSetReloadModeImpl MPU_vTimerSetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetReloadMode @@ -940,10 +781,7 @@ MPU_xTimerGetReloadMode: b MPU_xTimerGetReloadModeImpl MPU_xTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_uxTimerGetReloadMode @@ -957,10 +795,7 @@ MPU_uxTimerGetReloadMode: b MPU_uxTimerGetReloadModeImpl MPU_uxTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetPeriod @@ -974,10 +809,7 @@ MPU_xTimerGetPeriod: b MPU_xTimerGetPeriodImpl MPU_xTimerGetPeriod_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetPeriodImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetPeriod /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetExpiryTime @@ -991,14 +823,11 @@ MPU_xTimerGetExpiryTime: b MPU_xTimerGetExpiryTimeImpl MPU_xTimerGetExpiryTime_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetExpiryTimeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetExpiryTime /*-----------------------------------------------------------*/ - PUBLIC MPU_xEventGroupWaitBits -MPU_xEventGroupWaitBits: + PUBLIC MPU_xEventGroupWaitBitsEntry +MPU_xEventGroupWaitBitsEntry: push {r0} mrs r0, control tst r0, #1 @@ -1008,10 +837,7 @@ MPU_xEventGroupWaitBits: b MPU_xEventGroupWaitBitsImpl MPU_xEventGroupWaitBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xEventGroupWaitBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupWaitBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupClearBits @@ -1025,10 +851,7 @@ MPU_xEventGroupClearBits: b MPU_xEventGroupClearBitsImpl MPU_xEventGroupClearBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupClearBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupClearBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSetBits @@ -1042,10 +865,7 @@ MPU_xEventGroupSetBits: b MPU_xEventGroupSetBitsImpl MPU_xEventGroupSetBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSetBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSetBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSync @@ -1059,10 +879,7 @@ MPU_xEventGroupSync: b MPU_xEventGroupSyncImpl MPU_xEventGroupSync_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSyncImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSync /*-----------------------------------------------------------*/ PUBLIC MPU_uxEventGroupGetNumber @@ -1076,10 +893,7 @@ MPU_uxEventGroupGetNumber: b MPU_uxEventGroupGetNumberImpl MPU_uxEventGroupGetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxEventGroupGetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxEventGroupGetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_vEventGroupSetNumber @@ -1093,10 +907,7 @@ MPU_vEventGroupSetNumber: b MPU_vEventGroupSetNumberImpl MPU_vEventGroupSetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vEventGroupSetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vEventGroupSetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSend @@ -1110,10 +921,7 @@ MPU_xStreamBufferSend: b MPU_xStreamBufferSendImpl MPU_xStreamBufferSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSend /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferReceive @@ -1127,10 +935,7 @@ MPU_xStreamBufferReceive: b MPU_xStreamBufferReceiveImpl MPU_xStreamBufferReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsFull @@ -1144,10 +949,7 @@ MPU_xStreamBufferIsFull: b MPU_xStreamBufferIsFullImpl MPU_xStreamBufferIsFull_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsFullImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsFull /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsEmpty @@ -1161,10 +963,7 @@ MPU_xStreamBufferIsEmpty: b MPU_xStreamBufferIsEmptyImpl MPU_xStreamBufferIsEmpty_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsEmptyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsEmpty /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSpacesAvailable @@ -1178,10 +977,7 @@ MPU_xStreamBufferSpacesAvailable: b MPU_xStreamBufferSpacesAvailableImpl MPU_xStreamBufferSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferBytesAvailable @@ -1195,10 +991,7 @@ MPU_xStreamBufferBytesAvailable: b MPU_xStreamBufferBytesAvailableImpl MPU_xStreamBufferBytesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferBytesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferBytesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSetTriggerLevel @@ -1212,10 +1005,7 @@ MPU_xStreamBufferSetTriggerLevel: b MPU_xStreamBufferSetTriggerLevelImpl MPU_xStreamBufferSetTriggerLevel_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSetTriggerLevelImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSetTriggerLevel /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferNextMessageLengthBytes @@ -1229,10 +1019,7 @@ MPU_xStreamBufferNextMessageLengthBytes: b MPU_xStreamBufferNextMessageLengthBytesImpl MPU_xStreamBufferNextMessageLengthBytes_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferNextMessageLengthBytesImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferNextMessageLengthBytes /*-----------------------------------------------------------*/ /* Default weak implementations in case one is not available from diff --git a/portable/IAR/ARM_CM85/non_secure/port.c b/portable/IAR/ARM_CM85/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/IAR/ARM_CM85/non_secure/port.c +++ b/portable/IAR/ARM_CM85/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM85/non_secure/portasm.s b/portable/IAR/ARM_CM85/non_secure/portasm.s index 15e74ffc1..d8f1b1d9a 100644 --- a/portable/IAR/ARM_CM85/non_secure/portasm.s +++ b/portable/IAR/ARM_CM85/non_secure/portasm.s @@ -32,6 +32,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 @@ -44,7 +47,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 @@ -86,7 +88,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. */ /*-----------------------------------------------------------*/ @@ -205,7 +207,7 @@ vStartFirstTask: cpsie f 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: @@ -455,11 +457,9 @@ SVC_Handler: ldr r1, [r0, #24] ldrb r2, [r1, #-2] - cmp r2, #4 /* portSVC_SYSTEM_CALL_ENTER. */ - beq syscall_enter - cmp r2, #5 /* portSVC_SYSTEM_CALL_ENTER_1. */ - beq syscall_enter_1 - cmp r2, #6 /* portSVC_SYSTEM_CALL_EXIT. */ + cmp r2, #NUM_SYSTEM_CALLS + blt syscall_enter + cmp r2, #104 /* portSVC_SYSTEM_CALL_EXIT. */ beq syscall_exit b vPortSVCHandler_C @@ -467,10 +467,6 @@ SVC_Handler: mov r1, lr b vSystemCallEnter - syscall_enter_1: - mov r1, lr - b vSystemCallEnter_1 - syscall_exit: mov r1, lr b vSystemCallExit @@ -493,7 +489,7 @@ vPortFreeSecureContext: ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */ cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */ it ne - svcne 1 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 1. */ + svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */ bx lr /* Return. */ /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM85/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM85/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/IAR/ARM_CM85/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM85/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM85_NTZ/non_secure/mpu_wrappers_v2_asm.S b/portable/IAR/ARM_CM85_NTZ/non_secure/mpu_wrappers_v2_asm.S index 1005dad33..80d5a1c63 100644 --- a/portable/IAR/ARM_CM85_NTZ/non_secure/mpu_wrappers_v2_asm.S +++ b/portable/IAR/ARM_CM85_NTZ/non_secure/mpu_wrappers_v2_asm.S @@ -32,15 +32,12 @@ /*-----------------------------------------------------------*/ #include "FreeRTOSConfig.h" +#include "mpu_syscall_numbers.h" #ifndef configUSE_MPU_WRAPPERS_V1 #define configUSE_MPU_WRAPPERS_V1 0 #endif -/* These must be in sync with portmacro.h. */ -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) @@ -56,10 +53,7 @@ MPU_xTaskDelayUntil: b MPU_xTaskDelayUntilImpl MPU_xTaskDelayUntil_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskDelayUntilImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskDelayUntil /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskAbortDelay @@ -73,10 +67,7 @@ MPU_xTaskAbortDelay: b MPU_xTaskAbortDelayImpl MPU_xTaskAbortDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskAbortDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskAbortDelay /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskDelay @@ -90,10 +81,7 @@ MPU_vTaskDelay: b MPU_vTaskDelayImpl MPU_vTaskDelay_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskDelayImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskDelay /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskPriorityGet @@ -107,10 +95,7 @@ MPU_uxTaskPriorityGet: b MPU_uxTaskPriorityGetImpl MPU_uxTaskPriorityGet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskPriorityGetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskPriorityGet /*-----------------------------------------------------------*/ PUBLIC MPU_eTaskGetState @@ -124,10 +109,7 @@ MPU_eTaskGetState: b MPU_eTaskGetStateImpl MPU_eTaskGetState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_eTaskGetStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_eTaskGetState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskGetInfo @@ -141,10 +123,7 @@ MPU_vTaskGetInfo: b MPU_vTaskGetInfoImpl MPU_vTaskGetInfo_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskGetInfoImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskGetInfo /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetIdleTaskHandle @@ -158,10 +137,7 @@ MPU_xTaskGetIdleTaskHandle: b MPU_xTaskGetIdleTaskHandleImpl MPU_xTaskGetIdleTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetIdleTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetIdleTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSuspend @@ -175,10 +151,7 @@ MPU_vTaskSuspend: b MPU_vTaskSuspendImpl MPU_vTaskSuspend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSuspendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSuspend /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskResume @@ -192,10 +165,7 @@ MPU_vTaskResume: b MPU_vTaskResumeImpl MPU_vTaskResume_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskResumeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskResume /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetTickCount @@ -209,10 +179,7 @@ MPU_xTaskGetTickCount: b MPU_xTaskGetTickCountImpl MPU_xTaskGetTickCount_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetTickCountImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetTickCount /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetNumberOfTasks @@ -226,10 +193,7 @@ MPU_uxTaskGetNumberOfTasks: b MPU_uxTaskGetNumberOfTasksImpl MPU_uxTaskGetNumberOfTasks_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetNumberOfTasksImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetNumberOfTasks /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimeCounter @@ -243,10 +207,7 @@ MPU_ulTaskGetRunTimeCounter: b MPU_ulTaskGetRunTimeCounterImpl MPU_ulTaskGetRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetRunTimePercent @@ -260,10 +221,7 @@ MPU_ulTaskGetRunTimePercent: b MPU_ulTaskGetRunTimePercentImpl MPU_ulTaskGetRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimePercent @@ -277,10 +235,7 @@ MPU_ulTaskGetIdleRunTimePercent: b MPU_ulTaskGetIdleRunTimePercentImpl MPU_ulTaskGetIdleRunTimePercent_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimePercentImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimePercent /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGetIdleRunTimeCounter @@ -294,10 +249,7 @@ MPU_ulTaskGetIdleRunTimeCounter: b MPU_ulTaskGetIdleRunTimeCounterImpl MPU_ulTaskGetIdleRunTimeCounter_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimeCounterImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGetIdleRunTimeCounter /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetApplicationTaskTag @@ -311,10 +263,7 @@ MPU_vTaskSetApplicationTaskTag: b MPU_vTaskSetApplicationTaskTagImpl MPU_vTaskSetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetApplicationTaskTag @@ -328,10 +277,7 @@ MPU_xTaskGetApplicationTaskTag: b MPU_xTaskGetApplicationTaskTagImpl MPU_xTaskGetApplicationTaskTag_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetApplicationTaskTagImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetApplicationTaskTag /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetThreadLocalStoragePointer @@ -345,10 +291,7 @@ MPU_vTaskSetThreadLocalStoragePointer: b MPU_vTaskSetThreadLocalStoragePointerImpl MPU_vTaskSetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_pvTaskGetThreadLocalStoragePointer @@ -362,10 +305,7 @@ MPU_pvTaskGetThreadLocalStoragePointer: b MPU_pvTaskGetThreadLocalStoragePointerImpl MPU_pvTaskGetThreadLocalStoragePointer_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTaskGetThreadLocalStoragePointerImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetSystemState @@ -379,10 +319,7 @@ MPU_uxTaskGetSystemState: b MPU_uxTaskGetSystemStateImpl MPU_uxTaskGetSystemState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetSystemStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetSystemState /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark @@ -396,10 +333,7 @@ MPU_uxTaskGetStackHighWaterMark: b MPU_uxTaskGetStackHighWaterMarkImpl MPU_uxTaskGetStackHighWaterMark_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMarkImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark /*-----------------------------------------------------------*/ PUBLIC MPU_uxTaskGetStackHighWaterMark2 @@ -413,10 +347,7 @@ MPU_uxTaskGetStackHighWaterMark2: b MPU_uxTaskGetStackHighWaterMark2Impl MPU_uxTaskGetStackHighWaterMark2_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMark2Impl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark2 /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetCurrentTaskHandle @@ -430,10 +361,7 @@ MPU_xTaskGetCurrentTaskHandle: b MPU_xTaskGetCurrentTaskHandleImpl MPU_xTaskGetCurrentTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetCurrentTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetCurrentTaskHandle /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGetSchedulerState @@ -447,10 +375,7 @@ MPU_xTaskGetSchedulerState: b MPU_xTaskGetSchedulerStateImpl MPU_xTaskGetSchedulerState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetSchedulerStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGetSchedulerState /*-----------------------------------------------------------*/ PUBLIC MPU_vTaskSetTimeOutState @@ -464,10 +389,7 @@ MPU_vTaskSetTimeOutState: b MPU_vTaskSetTimeOutStateImpl MPU_vTaskSetTimeOutState_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetTimeOutStateImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTaskSetTimeOutState /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskCheckForTimeOut @@ -481,14 +403,11 @@ MPU_xTaskCheckForTimeOut: b MPU_xTaskCheckForTimeOutImpl MPU_xTaskCheckForTimeOut_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskCheckForTimeOutImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskCheckForTimeOut /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotify -MPU_xTaskGenericNotify: + PUBLIC MPU_xTaskGenericNotifyEntry +MPU_xTaskGenericNotifyEntry: push {r0} mrs r0, control tst r0, #1 @@ -498,14 +417,11 @@ MPU_xTaskGenericNotify: b MPU_xTaskGenericNotifyImpl MPU_xTaskGenericNotify_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotify /*-----------------------------------------------------------*/ - PUBLIC MPU_xTaskGenericNotifyWait -MPU_xTaskGenericNotifyWait: + PUBLIC MPU_xTaskGenericNotifyWaitEntry +MPU_xTaskGenericNotifyWaitEntry: push {r0} mrs r0, control tst r0, #1 @@ -515,10 +431,7 @@ MPU_xTaskGenericNotifyWait: b MPU_xTaskGenericNotifyWaitImpl MPU_xTaskGenericNotifyWait_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyWaitImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyWait /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyTake @@ -532,10 +445,7 @@ MPU_ulTaskGenericNotifyTake: b MPU_ulTaskGenericNotifyTakeImpl MPU_ulTaskGenericNotifyTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyTake /*-----------------------------------------------------------*/ PUBLIC MPU_xTaskGenericNotifyStateClear @@ -549,10 +459,7 @@ MPU_xTaskGenericNotifyStateClear: b MPU_xTaskGenericNotifyStateClearImpl MPU_xTaskGenericNotifyStateClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGenericNotifyStateClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTaskGenericNotifyStateClear /*-----------------------------------------------------------*/ PUBLIC MPU_ulTaskGenericNotifyValueClear @@ -566,10 +473,7 @@ MPU_ulTaskGenericNotifyValueClear: b MPU_ulTaskGenericNotifyValueClearImpl MPU_ulTaskGenericNotifyValueClear_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyValueClearImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_ulTaskGenericNotifyValueClear /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGenericSend @@ -583,10 +487,7 @@ MPU_xQueueGenericSend: b MPU_xQueueGenericSendImpl MPU_xQueueGenericSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGenericSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGenericSend /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueMessagesWaiting @@ -600,10 +501,7 @@ MPU_uxQueueMessagesWaiting: b MPU_uxQueueMessagesWaitingImpl MPU_uxQueueMessagesWaiting_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueMessagesWaitingImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueMessagesWaiting /*-----------------------------------------------------------*/ PUBLIC MPU_uxQueueSpacesAvailable @@ -617,10 +515,7 @@ MPU_uxQueueSpacesAvailable: b MPU_uxQueueSpacesAvailableImpl MPU_uxQueueSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxQueueSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueReceive @@ -634,10 +529,7 @@ MPU_xQueueReceive: b MPU_xQueueReceiveImpl MPU_xQueueReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueuePeek @@ -651,10 +543,7 @@ MPU_xQueuePeek: b MPU_xQueuePeekImpl MPU_xQueuePeek_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueuePeekImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueuePeek /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSemaphoreTake @@ -668,10 +557,7 @@ MPU_xQueueSemaphoreTake: b MPU_xQueueSemaphoreTakeImpl MPU_xQueueSemaphoreTake_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSemaphoreTakeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSemaphoreTake /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGetMutexHolder @@ -685,10 +571,7 @@ MPU_xQueueGetMutexHolder: b MPU_xQueueGetMutexHolderImpl MPU_xQueueGetMutexHolder_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGetMutexHolderImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGetMutexHolder /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueTakeMutexRecursive @@ -702,10 +585,7 @@ MPU_xQueueTakeMutexRecursive: b MPU_xQueueTakeMutexRecursiveImpl MPU_xQueueTakeMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueTakeMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueTakeMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueGiveMutexRecursive @@ -719,10 +599,7 @@ MPU_xQueueGiveMutexRecursive: b MPU_xQueueGiveMutexRecursiveImpl MPU_xQueueGiveMutexRecursive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGiveMutexRecursiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueGiveMutexRecursive /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueSelectFromSet @@ -736,10 +613,7 @@ MPU_xQueueSelectFromSet: b MPU_xQueueSelectFromSetImpl MPU_xQueueSelectFromSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSelectFromSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueSelectFromSet /*-----------------------------------------------------------*/ PUBLIC MPU_xQueueAddToSet @@ -753,10 +627,7 @@ MPU_xQueueAddToSet: b MPU_xQueueAddToSetImpl MPU_xQueueAddToSet_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueAddToSetImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xQueueAddToSet /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueAddToRegistry @@ -770,10 +641,7 @@ MPU_vQueueAddToRegistry: b MPU_vQueueAddToRegistryImpl MPU_vQueueAddToRegistry_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueAddToRegistryImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueAddToRegistry /*-----------------------------------------------------------*/ PUBLIC MPU_vQueueUnregisterQueue @@ -787,10 +655,7 @@ MPU_vQueueUnregisterQueue: b MPU_vQueueUnregisterQueueImpl MPU_vQueueUnregisterQueue_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueUnregisterQueueImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vQueueUnregisterQueue /*-----------------------------------------------------------*/ PUBLIC MPU_pcQueueGetName @@ -804,10 +669,7 @@ MPU_pcQueueGetName: b MPU_pcQueueGetNameImpl MPU_pcQueueGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcQueueGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcQueueGetName /*-----------------------------------------------------------*/ PUBLIC MPU_pvTimerGetTimerID @@ -821,10 +683,7 @@ MPU_pvTimerGetTimerID: b MPU_pvTimerGetTimerIDImpl MPU_pvTimerGetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTimerGetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pvTimerGetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetTimerID @@ -838,10 +697,7 @@ MPU_vTimerSetTimerID: b MPU_vTimerSetTimerIDImpl MPU_vTimerSetTimerID_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetTimerIDImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetTimerID /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerIsTimerActive @@ -855,10 +711,7 @@ MPU_xTimerIsTimerActive: b MPU_xTimerIsTimerActiveImpl MPU_xTimerIsTimerActive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerIsTimerActiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerIsTimerActive /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetTimerDaemonTaskHandle @@ -872,14 +725,11 @@ MPU_xTimerGetTimerDaemonTaskHandle: b MPU_xTimerGetTimerDaemonTaskHandleImpl MPU_xTimerGetTimerDaemonTaskHandle_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetTimerDaemonTaskHandleImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle /*-----------------------------------------------------------*/ - PUBLIC MPU_xTimerGenericCommandFromTask -MPU_xTimerGenericCommandFromTask: + PUBLIC MPU_xTimerGenericCommandFromTaskEntry +MPU_xTimerGenericCommandFromTaskEntry: push {r0} mrs r0, control tst r0, #1 @@ -889,10 +739,7 @@ MPU_xTimerGenericCommandFromTask: b MPU_xTimerGenericCommandFromTaskImpl MPU_xTimerGenericCommandFromTask_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTimerGenericCommandFromTaskImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGenericCommandFromTask /*-----------------------------------------------------------*/ PUBLIC MPU_pcTimerGetName @@ -906,10 +753,7 @@ MPU_pcTimerGetName: b MPU_pcTimerGetNameImpl MPU_pcTimerGetName_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_pcTimerGetNameImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_pcTimerGetName /*-----------------------------------------------------------*/ PUBLIC MPU_vTimerSetReloadMode @@ -923,10 +767,7 @@ MPU_vTimerSetReloadMode: b MPU_vTimerSetReloadModeImpl MPU_vTimerSetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vTimerSetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetReloadMode @@ -940,10 +781,7 @@ MPU_xTimerGetReloadMode: b MPU_xTimerGetReloadModeImpl MPU_xTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_uxTimerGetReloadMode @@ -957,10 +795,7 @@ MPU_uxTimerGetReloadMode: b MPU_uxTimerGetReloadModeImpl MPU_uxTimerGetReloadMode_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTimerGetReloadModeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxTimerGetReloadMode /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetPeriod @@ -974,10 +809,7 @@ MPU_xTimerGetPeriod: b MPU_xTimerGetPeriodImpl MPU_xTimerGetPeriod_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetPeriodImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetPeriod /*-----------------------------------------------------------*/ PUBLIC MPU_xTimerGetExpiryTime @@ -991,14 +823,11 @@ MPU_xTimerGetExpiryTime: b MPU_xTimerGetExpiryTimeImpl MPU_xTimerGetExpiryTime_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetExpiryTimeImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xTimerGetExpiryTime /*-----------------------------------------------------------*/ - PUBLIC MPU_xEventGroupWaitBits -MPU_xEventGroupWaitBits: + PUBLIC MPU_xEventGroupWaitBitsEntry +MPU_xEventGroupWaitBitsEntry: push {r0} mrs r0, control tst r0, #1 @@ -1008,10 +837,7 @@ MPU_xEventGroupWaitBits: b MPU_xEventGroupWaitBitsImpl MPU_xEventGroupWaitBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xEventGroupWaitBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupWaitBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupClearBits @@ -1025,10 +851,7 @@ MPU_xEventGroupClearBits: b MPU_xEventGroupClearBitsImpl MPU_xEventGroupClearBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupClearBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupClearBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSetBits @@ -1042,10 +865,7 @@ MPU_xEventGroupSetBits: b MPU_xEventGroupSetBitsImpl MPU_xEventGroupSetBits_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSetBitsImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSetBits /*-----------------------------------------------------------*/ PUBLIC MPU_xEventGroupSync @@ -1059,10 +879,7 @@ MPU_xEventGroupSync: b MPU_xEventGroupSyncImpl MPU_xEventGroupSync_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSyncImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xEventGroupSync /*-----------------------------------------------------------*/ PUBLIC MPU_uxEventGroupGetNumber @@ -1076,10 +893,7 @@ MPU_uxEventGroupGetNumber: b MPU_uxEventGroupGetNumberImpl MPU_uxEventGroupGetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_uxEventGroupGetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_uxEventGroupGetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_vEventGroupSetNumber @@ -1093,10 +907,7 @@ MPU_vEventGroupSetNumber: b MPU_vEventGroupSetNumberImpl MPU_vEventGroupSetNumber_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_vEventGroupSetNumberImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_vEventGroupSetNumber /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSend @@ -1110,10 +921,7 @@ MPU_xStreamBufferSend: b MPU_xStreamBufferSendImpl MPU_xStreamBufferSend_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSendImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSend /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferReceive @@ -1127,10 +935,7 @@ MPU_xStreamBufferReceive: b MPU_xStreamBufferReceiveImpl MPU_xStreamBufferReceive_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferReceiveImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferReceive /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsFull @@ -1144,10 +949,7 @@ MPU_xStreamBufferIsFull: b MPU_xStreamBufferIsFullImpl MPU_xStreamBufferIsFull_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsFullImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsFull /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferIsEmpty @@ -1161,10 +963,7 @@ MPU_xStreamBufferIsEmpty: b MPU_xStreamBufferIsEmptyImpl MPU_xStreamBufferIsEmpty_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsEmptyImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferIsEmpty /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSpacesAvailable @@ -1178,10 +977,7 @@ MPU_xStreamBufferSpacesAvailable: b MPU_xStreamBufferSpacesAvailableImpl MPU_xStreamBufferSpacesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSpacesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSpacesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferBytesAvailable @@ -1195,10 +991,7 @@ MPU_xStreamBufferBytesAvailable: b MPU_xStreamBufferBytesAvailableImpl MPU_xStreamBufferBytesAvailable_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferBytesAvailableImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferBytesAvailable /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferSetTriggerLevel @@ -1212,10 +1005,7 @@ MPU_xStreamBufferSetTriggerLevel: b MPU_xStreamBufferSetTriggerLevelImpl MPU_xStreamBufferSetTriggerLevel_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSetTriggerLevelImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferSetTriggerLevel /*-----------------------------------------------------------*/ PUBLIC MPU_xStreamBufferNextMessageLengthBytes @@ -1229,10 +1019,7 @@ MPU_xStreamBufferNextMessageLengthBytes: b MPU_xStreamBufferNextMessageLengthBytesImpl MPU_xStreamBufferNextMessageLengthBytes_Unpriv: pop {r0} - svc #portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferNextMessageLengthBytesImpl - svc #portSVC_SYSTEM_CALL_EXIT - bx lr + svc #SYSTEM_CALL_xStreamBufferNextMessageLengthBytes /*-----------------------------------------------------------*/ /* Default weak implementations in case one is not available from diff --git a/portable/IAR/ARM_CM85_NTZ/non_secure/port.c b/portable/IAR/ARM_CM85_NTZ/non_secure/port.c index 52d68d3ea..6a3877894 100644 --- a/portable/IAR/ARM_CM85_NTZ/non_secure/port.c +++ b/portable/IAR/ARM_CM85_NTZ/non_secure/port.c @@ -35,8 +35,9 @@ #include "FreeRTOS.h" #include "task.h" -/* MPU wrappers includes. */ +/* MPU includes. */ #include "mpu_wrappers.h" +#include "mpu_syscall_numbers.h" /* Portasm includes. */ #include "portasm.h" @@ -436,29 +437,22 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with up to 4 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with 5 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Raise SVC for exiting from a system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vRequestSystemCallExit( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -488,6 +482,15 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV #endif /* configENABLE_MPU == 1 */ /*-----------------------------------------------------------*/ +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/** + * @brief This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif + /** * @brief Each task maintains its own interrupt status in the critical nesting * variable. @@ -1134,15 +1137,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ extern uint32_t * __syscalls_flash_start__; @@ -1154,17 +1158,27 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) { if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -1198,9 +1212,13 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO pulSystemCallStack[ i ] = pulTaskStack[ i ]; } - /* Store the value of the LR and PSPLIM registers before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Store the value of the PSPLIM register before the SVC was raised. + * We need to restore it when we exit from the system call. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1215,6 +1233,12 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO } #endif + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Remember the location where we should copy the stack frame when we exit from * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; @@ -1251,127 +1275,9 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + void vRequestSystemCallExit( void ) /* __attribute__( ( naked ) ) PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i; - - #if defined( __ARMCC_VERSION ) - - /* Declaration when these variable are defined in code instead of being - * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; - #else - /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; - #endif /* #if defined( __ARMCC_VERSION ) */ - - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) - { - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - __asm volatile ( - " vpush {s0} \n" /* Trigger lazy stacking. */ - " vpop {s0} \n" /* Nullify the affect of the above instruction. */ - ::: "memory" - ); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - } - #else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */ - { - ulStackFrameSize = 8; - } - #endif /* configENABLE_FPU || configENABLE_MVE */ - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Store the value of the LR and PSPLIM registers before the SVC was raised. - * We need to restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "mrs %0, psplim" : "=r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); - } - #endif - - /* Use the pulSystemCallStack in thread mode. */ - __asm volatile ( "msr psp, %0" : : "r" ( pulSystemCallStack ) ); - #if ( portUSE_PSPLIM_REGISTER == 1 ) - { - __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.pulSystemCallStackLimit ) ); - } - #endif - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - - /* Raise the privilege for the duration of the system call. */ - __asm volatile ( - " mrs r0, control \n" /* Obtain current control value. */ - " movs r1, #1 \n" /* r1 = 1. */ - " bics r0, r1 \n" /* Clear nPRIV bit. */ - " msr control, r0 \n" /* Write back new control value. */ - ::: "r0", "r1", "memory" - ); - } + __asm volatile ( "svc %0 \n" ::"i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory" ); } #endif /* ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -1388,24 +1294,32 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO uint32_t ulStackFrameSize, ulSystemCallLocation, i; #if defined( __ARMCC_VERSION ) - /* Declaration when these variable are defined in code instead of being * exported from linker scripts. */ - extern uint32_t * __syscalls_flash_start__; - extern uint32_t * __syscalls_flash_end__; + extern uint32_t * __privileged_functions_start__; + extern uint32_t * __privileged_functions_end__; #else /* Declaration when these variable are exported from linker scripts. */ - extern uint32_t __syscalls_flash_start__[]; - extern uint32_t __syscalls_flash_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; #endif /* #if defined( __ARMCC_VERSION ) */ ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) @@ -1444,9 +1358,14 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO /* Use the pulTaskStack in thread mode. */ __asm volatile ( "msr psp, %0" : : "r" ( pulTaskStack ) ); - /* Restore the LR and PSPLIM to what they were at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + + /* Restore the PSPLIM register to what it was at the time of + * system call entry. */ #if ( portUSE_PSPLIM_REGISTER == 1 ) { __asm volatile ( "msr psplim, %0" : : "r" ( pxMpuSettings->xSystemCallStackInfo.ulStackLimitRegisterAtSystemCallEntry ) ); @@ -1780,6 +1699,12 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */ /* Initialize the critical nesting count ready for the first task. */ ulCriticalNesting = 0; + #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Start the first task. */ vStartFirstTask(); @@ -2062,7 +1987,7 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( ( configASSERT_DEFINED == 1 ) && ( portHAS_ARMV8M_MAIN_EXTENSION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortGrantAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2078,10 +2003,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] |= ( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) void vPortRevokeAccessToKernelObject( TaskHandle_t xInternalTaskHandle, int32_t lInternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ @@ -2097,10 +2022,10 @@ BaseType_t xPortIsInsideInterrupt( void ) xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] &= ~( 1U << ulAccessControlListEntryBit ); } -#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ /*-----------------------------------------------------------*/ -#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) +#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) @@ -2108,21 +2033,34 @@ BaseType_t xPortIsInsideInterrupt( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; @@ -2141,5 +2079,5 @@ BaseType_t xPortIsInsideInterrupt( void ) #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ -#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +#endif /* #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */ /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM85_NTZ/non_secure/portasm.s b/portable/IAR/ARM_CM85_NTZ/non_secure/portasm.s index ec5202527..7cf467d22 100644 --- a/portable/IAR/ARM_CM85_NTZ/non_secure/portasm.s +++ b/portable/IAR/ARM_CM85_NTZ/non_secure/portasm.s @@ -32,6 +32,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 @@ -41,7 +44,6 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler. EXTERN vPortSVCHandler_C #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) EXTERN vSystemCallEnter - EXTERN vSystemCallEnter_1 EXTERN vSystemCallExit #endif @@ -191,7 +193,7 @@ vStartFirstTask: cpsie f 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: @@ -371,11 +373,9 @@ SVC_Handler: ldr r1, [r0, #24] ldrb r2, [r1, #-2] - cmp r2, #4 /* portSVC_SYSTEM_CALL_ENTER. */ - beq syscall_enter - cmp r2, #5 /* portSVC_SYSTEM_CALL_ENTER_1. */ - beq syscall_enter_1 - cmp r2, #6 /* portSVC_SYSTEM_CALL_EXIT. */ + cmp r2, #NUM_SYSTEM_CALLS + blt syscall_enter + cmp r2, #104 /* portSVC_SYSTEM_CALL_EXIT. */ beq syscall_exit b vPortSVCHandler_C @@ -383,10 +383,6 @@ SVC_Handler: mov r1, lr b vSystemCallEnter - syscall_enter_1: - mov r1, lr - b vSystemCallEnter_1 - syscall_exit: mov r1, lr b vSystemCallExit diff --git a/portable/IAR/ARM_CM85_NTZ/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM85_NTZ/non_secure/portmacrocommon.h index 60ef37380..672b0dbdc 100644 --- a/portable/IAR/ARM_CM85_NTZ/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM85_NTZ/non_secure/portmacrocommon.h @@ -322,14 +322,12 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P /** * @brief SVC numbers. */ -#define portSVC_ALLOCATE_SECURE_CONTEXT 0 -#define portSVC_FREE_SECURE_CONTEXT 1 -#define portSVC_START_SCHEDULER 2 -#define portSVC_RAISE_PRIVILEGE 3 -#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 6 -#define portSVC_YIELD 7 +#define portSVC_ALLOCATE_SECURE_CONTEXT 100 +#define portSVC_FREE_SECURE_CONTEXT 101 +#define portSVC_START_SCHEDULER 102 +#define portSVC_RAISE_PRIVILEGE 103 +#define portSVC_SYSTEM_CALL_EXIT 104 +#define portSVC_YIELD 105 /*-----------------------------------------------------------*/ /** diff --git a/portable/RVDS/ARM_CM4_MPU/mpu_wrappers_v2_asm.c b/portable/RVDS/ARM_CM4_MPU/mpu_wrappers_v2_asm.c index 931a9ffd4..d65876356 100644 --- a/portable/RVDS/ARM_CM4_MPU/mpu_wrappers_v2_asm.c +++ b/portable/RVDS/ARM_CM4_MPU/mpu_wrappers_v2_asm.c @@ -38,2350 +38,1690 @@ #include "timers.h" #include "event_groups.h" #include "stream_buffer.h" +#include "mpu_prototypes.h" +#include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*-----------------------------------------------------------*/ #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) - #if ( INCLUDE_xTaskDelayUntil == 1 ) +#if ( INCLUDE_xTaskDelayUntil == 1 ) - BaseType_t MPU_xTaskDelayUntil( TickType_t * const pxPreviousWakeTime, - const TickType_t xTimeIncrement ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xTaskDelayUntil( TickType_t * const pxPreviousWakeTime, + const TickType_t xTimeIncrement ) FREERTOS_SYSTEM_CALL; - __asm BaseType_t MPU_xTaskDelayUntil( TickType_t * const pxPreviousWakeTime, - const TickType_t xTimeIncrement ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTaskDelayUntilImpl +__asm BaseType_t MPU_xTaskDelayUntil( TickType_t * const pxPreviousWakeTime, + const TickType_t xTimeIncrement ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTaskDelayUntilImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTaskDelayUntil_Unpriv - MPU_xTaskDelayUntil_Priv - pop { - r0 - } - b MPU_xTaskDelayUntilImpl - MPU_xTaskDelayUntil_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskDelayUntilImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTaskDelayUntil_Unpriv +MPU_xTaskDelayUntil_Priv + pop {r0} + b MPU_xTaskDelayUntilImpl +MPU_xTaskDelayUntil_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTaskDelayUntil +} - #endif /* if ( INCLUDE_xTaskDelayUntil == 1 ) */ +#endif /* if ( INCLUDE_xTaskDelayUntil == 1 ) */ /*-----------------------------------------------------------*/ - #if ( INCLUDE_xTaskAbortDelay == 1 ) +#if ( INCLUDE_xTaskAbortDelay == 1 ) - BaseType_t MPU_xTaskAbortDelay( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xTaskAbortDelay( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; - __asm BaseType_t MPU_xTaskAbortDelay( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTaskAbortDelayImpl +__asm BaseType_t MPU_xTaskAbortDelay( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTaskAbortDelayImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTaskAbortDelay_Unpriv - MPU_xTaskAbortDelay_Priv - pop { - r0 - } - b MPU_xTaskAbortDelayImpl - MPU_xTaskAbortDelay_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskAbortDelayImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTaskAbortDelay_Unpriv +MPU_xTaskAbortDelay_Priv + pop {r0} + b MPU_xTaskAbortDelayImpl +MPU_xTaskAbortDelay_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTaskAbortDelay +} - #endif /* if ( INCLUDE_xTaskAbortDelay == 1 ) */ +#endif /* if ( INCLUDE_xTaskAbortDelay == 1 ) */ /*-----------------------------------------------------------*/ - #if ( INCLUDE_vTaskDelay == 1 ) +#if ( INCLUDE_vTaskDelay == 1 ) - void MPU_vTaskDelay( const TickType_t xTicksToDelay ) FREERTOS_SYSTEM_CALL; +void MPU_vTaskDelay( const TickType_t xTicksToDelay ) FREERTOS_SYSTEM_CALL; - __asm void MPU_vTaskDelay( const TickType_t xTicksToDelay ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_vTaskDelayImpl +__asm void MPU_vTaskDelay( const TickType_t xTicksToDelay ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_vTaskDelayImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_vTaskDelay_Unpriv - MPU_vTaskDelay_Priv - pop { - r0 - } - b MPU_vTaskDelayImpl - MPU_vTaskDelay_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskDelayImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_vTaskDelay_Unpriv +MPU_vTaskDelay_Priv + pop {r0} + b MPU_vTaskDelayImpl +MPU_vTaskDelay_Unpriv + pop {r0} + svc #SYSTEM_CALL_vTaskDelay +} - #endif /* if ( INCLUDE_vTaskDelay == 1 ) */ +#endif /* if ( INCLUDE_vTaskDelay == 1 ) */ /*-----------------------------------------------------------*/ - #if ( INCLUDE_uxTaskPriorityGet == 1 ) +#if ( INCLUDE_uxTaskPriorityGet == 1 ) - UBaseType_t MPU_uxTaskPriorityGet( const TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; +UBaseType_t MPU_uxTaskPriorityGet( const TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; - __asm UBaseType_t MPU_uxTaskPriorityGet( const TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_uxTaskPriorityGetImpl +__asm UBaseType_t MPU_uxTaskPriorityGet( const TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_uxTaskPriorityGetImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_uxTaskPriorityGet_Unpriv - MPU_uxTaskPriorityGet_Priv - pop { - r0 - } - b MPU_uxTaskPriorityGetImpl - MPU_uxTaskPriorityGet_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskPriorityGetImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_uxTaskPriorityGet_Unpriv +MPU_uxTaskPriorityGet_Priv + pop {r0} + b MPU_uxTaskPriorityGetImpl +MPU_uxTaskPriorityGet_Unpriv + pop {r0} + svc #SYSTEM_CALL_uxTaskPriorityGet +} - #endif /* if ( INCLUDE_uxTaskPriorityGet == 1 ) */ +#endif /* if ( INCLUDE_uxTaskPriorityGet == 1 ) */ /*-----------------------------------------------------------*/ - #if ( INCLUDE_eTaskGetState == 1 ) +#if ( INCLUDE_eTaskGetState == 1 ) - eTaskState MPU_eTaskGetState( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; +eTaskState MPU_eTaskGetState( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; - __asm eTaskState MPU_eTaskGetState( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_eTaskGetStateImpl +__asm eTaskState MPU_eTaskGetState( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_eTaskGetStateImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_eTaskGetState_Unpriv - MPU_eTaskGetState_Priv - pop { - r0 - } - b MPU_eTaskGetStateImpl - MPU_eTaskGetState_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_eTaskGetStateImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_eTaskGetState_Unpriv +MPU_eTaskGetState_Priv + pop {r0} + b MPU_eTaskGetStateImpl +MPU_eTaskGetState_Unpriv + pop {r0} + svc #SYSTEM_CALL_eTaskGetState +} - #endif /* if ( INCLUDE_eTaskGetState == 1 ) */ +#endif /* if ( INCLUDE_eTaskGetState == 1 ) */ /*-----------------------------------------------------------*/ - #if ( configUSE_TRACE_FACILITY == 1 ) +#if ( configUSE_TRACE_FACILITY == 1 ) - void MPU_vTaskGetInfo( TaskHandle_t xTask, - TaskStatus_t * pxTaskStatus, - BaseType_t xGetFreeStackSpace, - eTaskState eState ) FREERTOS_SYSTEM_CALL; +void MPU_vTaskGetInfo( TaskHandle_t xTask, + TaskStatus_t * pxTaskStatus, + BaseType_t xGetFreeStackSpace, + eTaskState eState ) FREERTOS_SYSTEM_CALL; - __asm void MPU_vTaskGetInfo( TaskHandle_t xTask, - TaskStatus_t * pxTaskStatus, - BaseType_t xGetFreeStackSpace, - eTaskState eState ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_vTaskGetInfoImpl +__asm void MPU_vTaskGetInfo( TaskHandle_t xTask, + TaskStatus_t * pxTaskStatus, + BaseType_t xGetFreeStackSpace, + eTaskState eState ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_vTaskGetInfoImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_vTaskGetInfo_Unpriv - MPU_vTaskGetInfo_Priv - pop { - r0 - } - b MPU_vTaskGetInfoImpl - MPU_vTaskGetInfo_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskGetInfoImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_vTaskGetInfo_Unpriv +MPU_vTaskGetInfo_Priv + pop {r0} + b MPU_vTaskGetInfoImpl +MPU_vTaskGetInfo_Unpriv + pop {r0} + svc #SYSTEM_CALL_vTaskGetInfo +} - #endif /* if ( configUSE_TRACE_FACILITY == 1 ) */ +#endif /* if ( configUSE_TRACE_FACILITY == 1 ) */ /*-----------------------------------------------------------*/ - #if ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) +#if ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) - TaskHandle_t MPU_xTaskGetIdleTaskHandle( void ) FREERTOS_SYSTEM_CALL; +TaskHandle_t MPU_xTaskGetIdleTaskHandle( void ) FREERTOS_SYSTEM_CALL; - __asm TaskHandle_t MPU_xTaskGetIdleTaskHandle( void ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTaskGetIdleTaskHandleImpl +__asm TaskHandle_t MPU_xTaskGetIdleTaskHandle( void ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTaskGetIdleTaskHandleImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTaskGetIdleTaskHandle_Unpriv - MPU_xTaskGetIdleTaskHandle_Priv - pop { - r0 - } - b MPU_xTaskGetIdleTaskHandleImpl - MPU_xTaskGetIdleTaskHandle_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetIdleTaskHandleImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTaskGetIdleTaskHandle_Unpriv +MPU_xTaskGetIdleTaskHandle_Priv + pop {r0} + b MPU_xTaskGetIdleTaskHandleImpl +MPU_xTaskGetIdleTaskHandle_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTaskGetIdleTaskHandle +} - #endif /* if ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) */ +#endif /* if ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) */ /*-----------------------------------------------------------*/ - #if ( INCLUDE_vTaskSuspend == 1 ) +#if ( INCLUDE_vTaskSuspend == 1 ) - void MPU_vTaskSuspend( TaskHandle_t xTaskToSuspend ) FREERTOS_SYSTEM_CALL; +void MPU_vTaskSuspend( TaskHandle_t xTaskToSuspend ) FREERTOS_SYSTEM_CALL; - __asm void MPU_vTaskSuspend( TaskHandle_t xTaskToSuspend ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_vTaskSuspendImpl +__asm void MPU_vTaskSuspend( TaskHandle_t xTaskToSuspend ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_vTaskSuspendImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_vTaskSuspend_Unpriv - MPU_vTaskSuspend_Priv - pop { - r0 - } - b MPU_vTaskSuspendImpl - MPU_vTaskSuspend_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSuspendImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_vTaskSuspend_Unpriv +MPU_vTaskSuspend_Priv + pop {r0} + b MPU_vTaskSuspendImpl +MPU_vTaskSuspend_Unpriv + pop {r0} + svc #SYSTEM_CALL_vTaskSuspend +} - #endif /* if ( INCLUDE_vTaskSuspend == 1 ) */ +#endif /* if ( INCLUDE_vTaskSuspend == 1 ) */ /*-----------------------------------------------------------*/ - #if ( INCLUDE_vTaskSuspend == 1 ) +#if ( INCLUDE_vTaskSuspend == 1 ) - void MPU_vTaskResume( TaskHandle_t xTaskToResume ) FREERTOS_SYSTEM_CALL; +void MPU_vTaskResume( TaskHandle_t xTaskToResume ) FREERTOS_SYSTEM_CALL; - __asm void MPU_vTaskResume( TaskHandle_t xTaskToResume ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_vTaskResumeImpl +__asm void MPU_vTaskResume( TaskHandle_t xTaskToResume ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_vTaskResumeImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_vTaskResume_Unpriv - MPU_vTaskResume_Priv - pop { - r0 - } - b MPU_vTaskResumeImpl - MPU_vTaskResume_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskResumeImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_vTaskResume_Unpriv +MPU_vTaskResume_Priv + pop {r0} + b MPU_vTaskResumeImpl +MPU_vTaskResume_Unpriv + pop {r0} + svc #SYSTEM_CALL_vTaskResume +} - #endif /* if ( INCLUDE_vTaskSuspend == 1 ) */ +#endif /* if ( INCLUDE_vTaskSuspend == 1 ) */ /*-----------------------------------------------------------*/ - TickType_t MPU_xTaskGetTickCount( void ) FREERTOS_SYSTEM_CALL; +TickType_t MPU_xTaskGetTickCount( void ) FREERTOS_SYSTEM_CALL; - __asm TickType_t MPU_xTaskGetTickCount( void ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTaskGetTickCountImpl +__asm TickType_t MPU_xTaskGetTickCount( void ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTaskGetTickCountImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTaskGetTickCount_Unpriv - MPU_xTaskGetTickCount_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTaskGetTickCount_Unpriv +MPU_xTaskGetTickCount_Priv + pop {r0} b MPU_xTaskGetTickCountImpl - MPU_xTaskGetTickCount_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetTickCountImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xTaskGetTickCount_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTaskGetTickCount +} /*-----------------------------------------------------------*/ - UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) FREERTOS_SYSTEM_CALL; +UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) FREERTOS_SYSTEM_CALL; - __asm UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_uxTaskGetNumberOfTasksImpl +__asm UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_uxTaskGetNumberOfTasksImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_uxTaskGetNumberOfTasks_Unpriv - MPU_uxTaskGetNumberOfTasks_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_uxTaskGetNumberOfTasks_Unpriv +MPU_uxTaskGetNumberOfTasks_Priv + pop {r0} b MPU_uxTaskGetNumberOfTasksImpl - MPU_uxTaskGetNumberOfTasks_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetNumberOfTasksImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_uxTaskGetNumberOfTasks_Unpriv + pop {r0} + svc #SYSTEM_CALL_uxTaskGetNumberOfTasks +} /*-----------------------------------------------------------*/ - #if ( configGENERATE_RUN_TIME_STATS == 1 ) +#if ( configGENERATE_RUN_TIME_STATS == 1 ) - configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetRunTimeCounter( const TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; +configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetRunTimeCounter( const TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; - __asm configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetRunTimeCounter( const TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_ulTaskGetRunTimeCounterImpl +__asm configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetRunTimeCounter( const TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_ulTaskGetRunTimeCounterImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_ulTaskGetRunTimeCounter_Unpriv - MPU_ulTaskGetRunTimeCounter_Priv - pop { - r0 - } - b MPU_ulTaskGetRunTimeCounterImpl - MPU_ulTaskGetRunTimeCounter_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimeCounterImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_ulTaskGetRunTimeCounter_Unpriv +MPU_ulTaskGetRunTimeCounter_Priv + pop {r0} + b MPU_ulTaskGetRunTimeCounterImpl +MPU_ulTaskGetRunTimeCounter_Unpriv + pop {r0} + svc #SYSTEM_CALL_ulTaskGetRunTimeCounter +} - #endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) */ +#endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) */ /*-----------------------------------------------------------*/ - #if ( configGENERATE_RUN_TIME_STATS == 1 ) +#if ( configGENERATE_RUN_TIME_STATS == 1 ) - configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetRunTimePercent( const TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; +configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetRunTimePercent( const TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; - __asm configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetRunTimePercent( const TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_ulTaskGetRunTimePercentImpl +__asm configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetRunTimePercent( const TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_ulTaskGetRunTimePercentImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_ulTaskGetRunTimePercent_Unpriv - MPU_ulTaskGetRunTimePercent_Priv - pop { - r0 - } - b MPU_ulTaskGetRunTimePercentImpl - MPU_ulTaskGetRunTimePercent_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetRunTimePercentImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_ulTaskGetRunTimePercent_Unpriv +MPU_ulTaskGetRunTimePercent_Priv + pop {r0} + b MPU_ulTaskGetRunTimePercentImpl +MPU_ulTaskGetRunTimePercent_Unpriv + pop {r0} + svc #SYSTEM_CALL_ulTaskGetRunTimePercent +} - #endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) */ +#endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) */ /*-----------------------------------------------------------*/ - #if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) +#if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) - configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetIdleRunTimePercent( void ) FREERTOS_SYSTEM_CALL; +configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetIdleRunTimePercent( void ) FREERTOS_SYSTEM_CALL; - __asm configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetIdleRunTimePercent( void ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_ulTaskGetIdleRunTimePercentImpl +__asm configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetIdleRunTimePercent( void ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_ulTaskGetIdleRunTimePercentImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_ulTaskGetIdleRunTimePercent_Unpriv - MPU_ulTaskGetIdleRunTimePercent_Priv - pop { - r0 - } - b MPU_ulTaskGetIdleRunTimePercentImpl - MPU_ulTaskGetIdleRunTimePercent_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimePercentImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_ulTaskGetIdleRunTimePercent_Unpriv +MPU_ulTaskGetIdleRunTimePercent_Priv + pop {r0} + b MPU_ulTaskGetIdleRunTimePercentImpl +MPU_ulTaskGetIdleRunTimePercent_Unpriv + pop {r0} + svc #SYSTEM_CALL_ulTaskGetIdleRunTimePercent +} - #endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */ +#endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */ /*-----------------------------------------------------------*/ - #if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) +#if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) - configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetIdleRunTimeCounter( void ) FREERTOS_SYSTEM_CALL; +configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetIdleRunTimeCounter( void ) FREERTOS_SYSTEM_CALL; - __asm configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetIdleRunTimeCounter( void ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_ulTaskGetIdleRunTimeCounterImpl +__asm configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetIdleRunTimeCounter( void ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_ulTaskGetIdleRunTimeCounterImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_ulTaskGetIdleRunTimeCounter_Unpriv - MPU_ulTaskGetIdleRunTimeCounter_Priv - pop { - r0 - } - b MPU_ulTaskGetIdleRunTimeCounterImpl - MPU_ulTaskGetIdleRunTimeCounter_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGetIdleRunTimeCounterImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_ulTaskGetIdleRunTimeCounter_Unpriv +MPU_ulTaskGetIdleRunTimeCounter_Priv + pop {r0} + b MPU_ulTaskGetIdleRunTimeCounterImpl +MPU_ulTaskGetIdleRunTimeCounter_Unpriv + pop {r0} + svc #SYSTEM_CALL_ulTaskGetIdleRunTimeCounter +} - #endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */ +#endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */ /*-----------------------------------------------------------*/ - #if ( configUSE_APPLICATION_TASK_TAG == 1 ) +#if ( configUSE_APPLICATION_TASK_TAG == 1 ) - void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, - TaskHookFunction_t pxHookFunction ) FREERTOS_SYSTEM_CALL; +void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, + TaskHookFunction_t pxHookFunction ) FREERTOS_SYSTEM_CALL; - __asm void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, - TaskHookFunction_t pxHookFunction ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_vTaskSetApplicationTaskTagImpl +__asm void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, + TaskHookFunction_t pxHookFunction ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_vTaskSetApplicationTaskTagImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_vTaskSetApplicationTaskTag_Unpriv - MPU_vTaskSetApplicationTaskTag_Priv - pop { - r0 - } - b MPU_vTaskSetApplicationTaskTagImpl - MPU_vTaskSetApplicationTaskTag_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetApplicationTaskTagImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_vTaskSetApplicationTaskTag_Unpriv +MPU_vTaskSetApplicationTaskTag_Priv + pop {r0} + b MPU_vTaskSetApplicationTaskTagImpl +MPU_vTaskSetApplicationTaskTag_Unpriv + pop {r0} + svc #SYSTEM_CALL_vTaskSetApplicationTaskTag +} - #endif /* if ( configUSE_APPLICATION_TASK_TAG == 1 ) */ +#endif /* if ( configUSE_APPLICATION_TASK_TAG == 1 ) */ /*-----------------------------------------------------------*/ - #if ( configUSE_APPLICATION_TASK_TAG == 1 ) +#if ( configUSE_APPLICATION_TASK_TAG == 1 ) - TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; +TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; - __asm TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTaskGetApplicationTaskTagImpl +__asm TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTaskGetApplicationTaskTagImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTaskGetApplicationTaskTag_Unpriv - MPU_xTaskGetApplicationTaskTag_Priv - pop { - r0 - } - b MPU_xTaskGetApplicationTaskTagImpl - MPU_xTaskGetApplicationTaskTag_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetApplicationTaskTagImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTaskGetApplicationTaskTag_Unpriv +MPU_xTaskGetApplicationTaskTag_Priv + pop {r0} + b MPU_xTaskGetApplicationTaskTagImpl +MPU_xTaskGetApplicationTaskTag_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTaskGetApplicationTaskTag +} - #endif /* if ( configUSE_APPLICATION_TASK_TAG == 1 ) */ +#endif /* if ( configUSE_APPLICATION_TASK_TAG == 1 ) */ /*-----------------------------------------------------------*/ - #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 ) +#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 ) - void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, - BaseType_t xIndex, - void * pvValue ) FREERTOS_SYSTEM_CALL; +void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, + BaseType_t xIndex, + void * pvValue ) FREERTOS_SYSTEM_CALL; - __asm void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, - BaseType_t xIndex, - void * pvValue ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_vTaskSetThreadLocalStoragePointerImpl +__asm void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, + BaseType_t xIndex, + void * pvValue ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_vTaskSetThreadLocalStoragePointerImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_vTaskSetThreadLocalStoragePointer_Unpriv - MPU_vTaskSetThreadLocalStoragePointer_Priv - pop { - r0 - } - b MPU_vTaskSetThreadLocalStoragePointerImpl - MPU_vTaskSetThreadLocalStoragePointer_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetThreadLocalStoragePointerImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_vTaskSetThreadLocalStoragePointer_Unpriv +MPU_vTaskSetThreadLocalStoragePointer_Priv + pop {r0} + b MPU_vTaskSetThreadLocalStoragePointerImpl +MPU_vTaskSetThreadLocalStoragePointer_Unpriv + pop {r0} + svc #SYSTEM_CALL_vTaskSetThreadLocalStoragePointer +} - #endif /* if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 ) */ +#endif /* if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 ) */ /*-----------------------------------------------------------*/ - #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 ) +#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 ) - void * MPU_pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, - BaseType_t xIndex ) FREERTOS_SYSTEM_CALL; +void * MPU_pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, + BaseType_t xIndex ) FREERTOS_SYSTEM_CALL; - __asm void * MPU_pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, - BaseType_t xIndex ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_pvTaskGetThreadLocalStoragePointerImpl +__asm void * MPU_pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, + BaseType_t xIndex ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_pvTaskGetThreadLocalStoragePointerImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_pvTaskGetThreadLocalStoragePointer_Unpriv - MPU_pvTaskGetThreadLocalStoragePointer_Priv - pop { - r0 - } - b MPU_pvTaskGetThreadLocalStoragePointerImpl - MPU_pvTaskGetThreadLocalStoragePointer_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTaskGetThreadLocalStoragePointerImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_pvTaskGetThreadLocalStoragePointer_Unpriv +MPU_pvTaskGetThreadLocalStoragePointer_Priv + pop {r0} + b MPU_pvTaskGetThreadLocalStoragePointerImpl +MPU_pvTaskGetThreadLocalStoragePointer_Unpriv + pop {r0} + svc #SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer +} - #endif /* if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 ) */ +#endif /* if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 ) */ /*-----------------------------------------------------------*/ - #if ( configUSE_TRACE_FACILITY == 1 ) +#if ( configUSE_TRACE_FACILITY == 1 ) - UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, - const UBaseType_t uxArraySize, - configRUN_TIME_COUNTER_TYPE * const pulTotalRunTime ) FREERTOS_SYSTEM_CALL; +UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, + const UBaseType_t uxArraySize, + configRUN_TIME_COUNTER_TYPE * const pulTotalRunTime ) FREERTOS_SYSTEM_CALL; - __asm UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, - const UBaseType_t uxArraySize, - configRUN_TIME_COUNTER_TYPE * const pulTotalRunTime ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_uxTaskGetSystemStateImpl +__asm UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, + const UBaseType_t uxArraySize, + configRUN_TIME_COUNTER_TYPE * const pulTotalRunTime ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_uxTaskGetSystemStateImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_uxTaskGetSystemState_Unpriv - MPU_uxTaskGetSystemState_Priv - pop { - r0 - } - b MPU_uxTaskGetSystemStateImpl - MPU_uxTaskGetSystemState_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetSystemStateImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_uxTaskGetSystemState_Unpriv +MPU_uxTaskGetSystemState_Priv + pop {r0} + b MPU_uxTaskGetSystemStateImpl +MPU_uxTaskGetSystemState_Unpriv + pop {r0} + svc #SYSTEM_CALL_uxTaskGetSystemState +} - #endif /* if ( configUSE_TRACE_FACILITY == 1 ) */ +#endif /* if ( configUSE_TRACE_FACILITY == 1 ) */ /*-----------------------------------------------------------*/ - #if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) +#if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) - UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; +UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; - __asm UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_uxTaskGetStackHighWaterMarkImpl +__asm UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_uxTaskGetStackHighWaterMarkImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_uxTaskGetStackHighWaterMark_Unpriv - MPU_uxTaskGetStackHighWaterMark_Priv - pop { - r0 - } - b MPU_uxTaskGetStackHighWaterMarkImpl - MPU_uxTaskGetStackHighWaterMark_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMarkImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_uxTaskGetStackHighWaterMark_Unpriv +MPU_uxTaskGetStackHighWaterMark_Priv + pop {r0} + b MPU_uxTaskGetStackHighWaterMarkImpl +MPU_uxTaskGetStackHighWaterMark_Unpriv + pop {r0} + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark +} - #endif /* if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) */ +#endif /* if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) */ /*-----------------------------------------------------------*/ - #if ( INCLUDE_uxTaskGetStackHighWaterMark2 == 1 ) +#if ( INCLUDE_uxTaskGetStackHighWaterMark2 == 1 ) - configSTACK_DEPTH_TYPE MPU_uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; +configSTACK_DEPTH_TYPE MPU_uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; - __asm configSTACK_DEPTH_TYPE MPU_uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_uxTaskGetStackHighWaterMark2Impl +__asm configSTACK_DEPTH_TYPE MPU_uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_uxTaskGetStackHighWaterMark2Impl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_uxTaskGetStackHighWaterMark2_Unpriv - MPU_uxTaskGetStackHighWaterMark2_Priv - pop { - r0 - } - b MPU_uxTaskGetStackHighWaterMark2Impl - MPU_uxTaskGetStackHighWaterMark2_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTaskGetStackHighWaterMark2Impl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_uxTaskGetStackHighWaterMark2_Unpriv +MPU_uxTaskGetStackHighWaterMark2_Priv + pop {r0} + b MPU_uxTaskGetStackHighWaterMark2Impl +MPU_uxTaskGetStackHighWaterMark2_Unpriv + pop {r0} + svc #SYSTEM_CALL_uxTaskGetStackHighWaterMark2 +} - #endif /* if ( INCLUDE_uxTaskGetStackHighWaterMark2 == 1 ) */ +#endif /* if ( INCLUDE_uxTaskGetStackHighWaterMark2 == 1 ) */ /*-----------------------------------------------------------*/ - #if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) ) +#if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) ) - TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void ) FREERTOS_SYSTEM_CALL; +TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void ) FREERTOS_SYSTEM_CALL; - __asm TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTaskGetCurrentTaskHandleImpl +__asm TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTaskGetCurrentTaskHandleImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTaskGetCurrentTaskHandle_Unpriv - MPU_xTaskGetCurrentTaskHandle_Priv - pop { - r0 - } - b MPU_xTaskGetCurrentTaskHandleImpl - MPU_xTaskGetCurrentTaskHandle_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetCurrentTaskHandleImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTaskGetCurrentTaskHandle_Unpriv +MPU_xTaskGetCurrentTaskHandle_Priv + pop {r0} + b MPU_xTaskGetCurrentTaskHandleImpl +MPU_xTaskGetCurrentTaskHandle_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTaskGetCurrentTaskHandle +} - #endif /* if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) ) */ +#endif /* if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) ) */ /*-----------------------------------------------------------*/ - #if ( INCLUDE_xTaskGetSchedulerState == 1 ) +#if ( INCLUDE_xTaskGetSchedulerState == 1 ) - BaseType_t MPU_xTaskGetSchedulerState( void ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xTaskGetSchedulerState( void ) FREERTOS_SYSTEM_CALL; - __asm BaseType_t MPU_xTaskGetSchedulerState( void ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTaskGetSchedulerStateImpl +__asm BaseType_t MPU_xTaskGetSchedulerState( void ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTaskGetSchedulerStateImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTaskGetSchedulerState_Unpriv - MPU_xTaskGetSchedulerState_Priv - pop { - r0 - } - b MPU_xTaskGetSchedulerStateImpl - MPU_xTaskGetSchedulerState_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGetSchedulerStateImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTaskGetSchedulerState_Unpriv +MPU_xTaskGetSchedulerState_Priv + pop {r0} + b MPU_xTaskGetSchedulerStateImpl +MPU_xTaskGetSchedulerState_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTaskGetSchedulerState +} - #endif /* if ( INCLUDE_xTaskGetSchedulerState == 1 ) */ +#endif /* if ( INCLUDE_xTaskGetSchedulerState == 1 ) */ /*-----------------------------------------------------------*/ - void MPU_vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) FREERTOS_SYSTEM_CALL; +void MPU_vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) FREERTOS_SYSTEM_CALL; - __asm void MPU_vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_vTaskSetTimeOutStateImpl +__asm void MPU_vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_vTaskSetTimeOutStateImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_vTaskSetTimeOutState_Unpriv - MPU_vTaskSetTimeOutState_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_vTaskSetTimeOutState_Unpriv +MPU_vTaskSetTimeOutState_Priv + pop {r0} b MPU_vTaskSetTimeOutStateImpl - MPU_vTaskSetTimeOutState_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_vTaskSetTimeOutStateImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_vTaskSetTimeOutState_Unpriv + pop {r0} + svc #SYSTEM_CALL_vTaskSetTimeOutState +} /*-----------------------------------------------------------*/ - BaseType_t MPU_xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, - TickType_t * const pxTicksToWait ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, + TickType_t * const pxTicksToWait ) FREERTOS_SYSTEM_CALL; - __asm BaseType_t MPU_xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, - TickType_t * const pxTicksToWait ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTaskCheckForTimeOutImpl +__asm BaseType_t MPU_xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, + TickType_t * const pxTicksToWait ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTaskCheckForTimeOutImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTaskCheckForTimeOut_Unpriv - MPU_xTaskCheckForTimeOut_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTaskCheckForTimeOut_Unpriv +MPU_xTaskCheckForTimeOut_Priv + pop {r0} b MPU_xTaskCheckForTimeOutImpl - MPU_xTaskCheckForTimeOut_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskCheckForTimeOutImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xTaskCheckForTimeOut_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTaskCheckForTimeOut +} /*-----------------------------------------------------------*/ - #if ( configUSE_TASK_NOTIFICATIONS == 1 ) +#if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) FREERTOS_SYSTEM_CALL; - __asm BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, - UBaseType_t uxIndexToNotify, - uint32_t ulValue, - eNotifyAction eAction, - uint32_t * pulPreviousNotificationValue ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTaskGenericNotifyImpl +__asm BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTaskGenericNotifyImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTaskGenericNotify_Unpriv - MPU_xTaskGenericNotify_Priv - pop { - r0 - } - b MPU_xTaskGenericNotifyImpl - MPU_xTaskGenericNotify_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTaskGenericNotify_Unpriv +MPU_xTaskGenericNotify_Priv + pop {r0} + b MPU_xTaskGenericNotifyImpl +MPU_xTaskGenericNotify_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTaskGenericNotify +} - #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */ +#endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */ /*-----------------------------------------------------------*/ - #if ( configUSE_TASK_NOTIFICATIONS == 1 ) +#if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) FREERTOS_SYSTEM_CALL; - __asm BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, - uint32_t ulBitsToClearOnEntry, - uint32_t ulBitsToClearOnExit, - uint32_t * pulNotificationValue, - TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTaskGenericNotifyWaitImpl +__asm BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTaskGenericNotifyWaitImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTaskGenericNotifyWait_Unpriv - MPU_xTaskGenericNotifyWait_Priv - pop { - r0 - } - b MPU_xTaskGenericNotifyWaitImpl - MPU_xTaskGenericNotifyWait_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTaskGenericNotifyWaitImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTaskGenericNotifyWait_Unpriv +MPU_xTaskGenericNotifyWait_Priv + pop {r0} + b MPU_xTaskGenericNotifyWaitImpl +MPU_xTaskGenericNotifyWait_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTaskGenericNotifyWait +} - #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */ +#endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */ /*-----------------------------------------------------------*/ - #if ( configUSE_TASK_NOTIFICATIONS == 1 ) +#if ( configUSE_TASK_NOTIFICATIONS == 1 ) - uint32_t MPU_ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn, - BaseType_t xClearCountOnExit, - TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; +uint32_t MPU_ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn, + BaseType_t xClearCountOnExit, + TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; - __asm uint32_t MPU_ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn, - BaseType_t xClearCountOnExit, - TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_ulTaskGenericNotifyTakeImpl +__asm uint32_t MPU_ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn, + BaseType_t xClearCountOnExit, + TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_ulTaskGenericNotifyTakeImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_ulTaskGenericNotifyTake_Unpriv - MPU_ulTaskGenericNotifyTake_Priv - pop { - r0 - } - b MPU_ulTaskGenericNotifyTakeImpl - MPU_ulTaskGenericNotifyTake_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyTakeImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_ulTaskGenericNotifyTake_Unpriv +MPU_ulTaskGenericNotifyTake_Priv + pop {r0} + b MPU_ulTaskGenericNotifyTakeImpl +MPU_ulTaskGenericNotifyTake_Unpriv + pop {r0} + svc #SYSTEM_CALL_ulTaskGenericNotifyTake +} - #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */ +#endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */ /*-----------------------------------------------------------*/ - #if ( configUSE_TASK_NOTIFICATIONS == 1 ) +#if ( configUSE_TASK_NOTIFICATIONS == 1 ) - BaseType_t MPU_xTaskGenericNotifyStateClear( TaskHandle_t xTask, - UBaseType_t uxIndexToClear ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xTaskGenericNotifyStateClear( TaskHandle_t xTask, + UBaseType_t uxIndexToClear ) FREERTOS_SYSTEM_CALL; - __asm BaseType_t MPU_xTaskGenericNotifyStateClear( TaskHandle_t xTask, - UBaseType_t uxIndexToClear ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTaskGenericNotifyStateClearImpl +__asm BaseType_t MPU_xTaskGenericNotifyStateClear( TaskHandle_t xTask, + UBaseType_t uxIndexToClear ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTaskGenericNotifyStateClearImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTaskGenericNotifyStateClear_Unpriv - MPU_xTaskGenericNotifyStateClear_Priv - pop { - r0 - } - b MPU_xTaskGenericNotifyStateClearImpl - MPU_xTaskGenericNotifyStateClear_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xTaskGenericNotifyStateClearImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTaskGenericNotifyStateClear_Unpriv +MPU_xTaskGenericNotifyStateClear_Priv + pop {r0} + b MPU_xTaskGenericNotifyStateClearImpl +MPU_xTaskGenericNotifyStateClear_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTaskGenericNotifyStateClear +} - #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */ +#endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */ /*-----------------------------------------------------------*/ - #if ( configUSE_TASK_NOTIFICATIONS == 1 ) +#if ( configUSE_TASK_NOTIFICATIONS == 1 ) - uint32_t MPU_ulTaskGenericNotifyValueClear( TaskHandle_t xTask, - UBaseType_t uxIndexToClear, - uint32_t ulBitsToClear ) FREERTOS_SYSTEM_CALL; +uint32_t MPU_ulTaskGenericNotifyValueClear( TaskHandle_t xTask, + UBaseType_t uxIndexToClear, + uint32_t ulBitsToClear ) FREERTOS_SYSTEM_CALL; - __asm uint32_t MPU_ulTaskGenericNotifyValueClear( TaskHandle_t xTask, - UBaseType_t uxIndexToClear, - uint32_t ulBitsToClear ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_ulTaskGenericNotifyValueClearImpl +__asm uint32_t MPU_ulTaskGenericNotifyValueClear( TaskHandle_t xTask, + UBaseType_t uxIndexToClear, + uint32_t ulBitsToClear ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_ulTaskGenericNotifyValueClearImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_ulTaskGenericNotifyValueClear_Unpriv - MPU_ulTaskGenericNotifyValueClear_Priv - pop { - r0 - } - b MPU_ulTaskGenericNotifyValueClearImpl - MPU_ulTaskGenericNotifyValueClear_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_ulTaskGenericNotifyValueClearImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_ulTaskGenericNotifyValueClear_Unpriv +MPU_ulTaskGenericNotifyValueClear_Priv + pop {r0} + b MPU_ulTaskGenericNotifyValueClearImpl +MPU_ulTaskGenericNotifyValueClear_Unpriv + pop {r0} + svc #SYSTEM_CALL_ulTaskGenericNotifyValueClear +} - #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */ +#endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */ /*-----------------------------------------------------------*/ - BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue, - const void * const pvItemToQueue, - TickType_t xTicksToWait, - const BaseType_t xCopyPosition ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue, + const void * const pvItemToQueue, + TickType_t xTicksToWait, + const BaseType_t xCopyPosition ) FREERTOS_SYSTEM_CALL; - __asm BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue, - const void * const pvItemToQueue, - TickType_t xTicksToWait, - const BaseType_t xCopyPosition ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xQueueGenericSendImpl +__asm BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue, + const void * const pvItemToQueue, + TickType_t xTicksToWait, + const BaseType_t xCopyPosition ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xQueueGenericSendImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xQueueGenericSend_Unpriv - MPU_xQueueGenericSend_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xQueueGenericSend_Unpriv +MPU_xQueueGenericSend_Priv + pop {r0} b MPU_xQueueGenericSendImpl - MPU_xQueueGenericSend_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGenericSendImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xQueueGenericSend_Unpriv + pop {r0} + svc #SYSTEM_CALL_xQueueGenericSend +} /*-----------------------------------------------------------*/ - UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL; +UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL; - __asm UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t xQueue ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_uxQueueMessagesWaitingImpl +__asm UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t xQueue ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_uxQueueMessagesWaitingImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_uxQueueMessagesWaiting_Unpriv - MPU_uxQueueMessagesWaiting_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_uxQueueMessagesWaiting_Unpriv +MPU_uxQueueMessagesWaiting_Priv + pop {r0} b MPU_uxQueueMessagesWaitingImpl - MPU_uxQueueMessagesWaiting_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueMessagesWaitingImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_uxQueueMessagesWaiting_Unpriv + pop {r0} + svc #SYSTEM_CALL_uxQueueMessagesWaiting +} /*-----------------------------------------------------------*/ - UBaseType_t MPU_uxQueueSpacesAvailable( const QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL; +UBaseType_t MPU_uxQueueSpacesAvailable( const QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL; - __asm UBaseType_t MPU_uxQueueSpacesAvailable( const QueueHandle_t xQueue ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_uxQueueSpacesAvailableImpl +__asm UBaseType_t MPU_uxQueueSpacesAvailable( const QueueHandle_t xQueue ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_uxQueueSpacesAvailableImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_uxQueueSpacesAvailable_Unpriv - MPU_uxQueueSpacesAvailable_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_uxQueueSpacesAvailable_Unpriv +MPU_uxQueueSpacesAvailable_Priv + pop {r0} b MPU_uxQueueSpacesAvailableImpl - MPU_uxQueueSpacesAvailable_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_uxQueueSpacesAvailableImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_uxQueueSpacesAvailable_Unpriv + pop {r0} + svc #SYSTEM_CALL_uxQueueSpacesAvailable +} /*-----------------------------------------------------------*/ - BaseType_t MPU_xQueueReceive( QueueHandle_t xQueue, - void * const pvBuffer, - TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xQueueReceive( QueueHandle_t xQueue, + void * const pvBuffer, + TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; - __asm BaseType_t MPU_xQueueReceive( QueueHandle_t xQueue, - void * const pvBuffer, - TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xQueueReceiveImpl +__asm BaseType_t MPU_xQueueReceive( QueueHandle_t xQueue, + void * const pvBuffer, + TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xQueueReceiveImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xQueueReceive_Unpriv - MPU_xQueueReceive_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xQueueReceive_Unpriv +MPU_xQueueReceive_Priv + pop {r0} b MPU_xQueueReceiveImpl - MPU_xQueueReceive_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueReceiveImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xQueueReceive_Unpriv + pop {r0} + svc #SYSTEM_CALL_xQueueReceive +} /*-----------------------------------------------------------*/ - BaseType_t MPU_xQueuePeek( QueueHandle_t xQueue, - void * const pvBuffer, - TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xQueuePeek( QueueHandle_t xQueue, + void * const pvBuffer, + TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; - __asm BaseType_t MPU_xQueuePeek( QueueHandle_t xQueue, - void * const pvBuffer, - TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xQueuePeekImpl +__asm BaseType_t MPU_xQueuePeek( QueueHandle_t xQueue, + void * const pvBuffer, + TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xQueuePeekImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xQueuePeek_Unpriv - MPU_xQueuePeek_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xQueuePeek_Unpriv +MPU_xQueuePeek_Priv + pop {r0} b MPU_xQueuePeekImpl - MPU_xQueuePeek_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueuePeekImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xQueuePeek_Unpriv + pop {r0} + svc #SYSTEM_CALL_xQueuePeek +} /*-----------------------------------------------------------*/ - BaseType_t MPU_xQueueSemaphoreTake( QueueHandle_t xQueue, - TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xQueueSemaphoreTake( QueueHandle_t xQueue, + TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; - __asm BaseType_t MPU_xQueueSemaphoreTake( QueueHandle_t xQueue, - TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xQueueSemaphoreTakeImpl +__asm BaseType_t MPU_xQueueSemaphoreTake( QueueHandle_t xQueue, + TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xQueueSemaphoreTakeImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xQueueSemaphoreTake_Unpriv - MPU_xQueueSemaphoreTake_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xQueueSemaphoreTake_Unpriv +MPU_xQueueSemaphoreTake_Priv + pop {r0} b MPU_xQueueSemaphoreTakeImpl - MPU_xQueueSemaphoreTake_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSemaphoreTakeImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xQueueSemaphoreTake_Unpriv + pop {r0} + svc #SYSTEM_CALL_xQueueSemaphoreTake +} /*-----------------------------------------------------------*/ - #if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) ) +#if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) ) - TaskHandle_t MPU_xQueueGetMutexHolder( QueueHandle_t xSemaphore ) FREERTOS_SYSTEM_CALL; +TaskHandle_t MPU_xQueueGetMutexHolder( QueueHandle_t xSemaphore ) FREERTOS_SYSTEM_CALL; - __asm TaskHandle_t MPU_xQueueGetMutexHolder( QueueHandle_t xSemaphore ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xQueueGetMutexHolderImpl +__asm TaskHandle_t MPU_xQueueGetMutexHolder( QueueHandle_t xSemaphore ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xQueueGetMutexHolderImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xQueueGetMutexHolder_Unpriv - MPU_xQueueGetMutexHolder_Priv - pop { - r0 - } - b MPU_xQueueGetMutexHolderImpl - MPU_xQueueGetMutexHolder_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGetMutexHolderImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xQueueGetMutexHolder_Unpriv +MPU_xQueueGetMutexHolder_Priv + pop {r0} + b MPU_xQueueGetMutexHolderImpl +MPU_xQueueGetMutexHolder_Unpriv + pop {r0} + svc #SYSTEM_CALL_xQueueGetMutexHolder +} - #endif /* if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) ) */ +#endif /* if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) ) */ /*-----------------------------------------------------------*/ - #if ( configUSE_RECURSIVE_MUTEXES == 1 ) +#if ( configUSE_RECURSIVE_MUTEXES == 1 ) - BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex, - TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; - - __asm BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex, - TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xQueueTakeMutexRecursiveImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xQueueTakeMutexRecursive_Unpriv - MPU_xQueueTakeMutexRecursive_Priv - pop { - r0 - } - b MPU_xQueueTakeMutexRecursiveImpl - MPU_xQueueTakeMutexRecursive_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueTakeMutexRecursiveImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configUSE_RECURSIVE_MUTEXES == 1 ) */ -/*-----------------------------------------------------------*/ - - #if ( configUSE_RECURSIVE_MUTEXES == 1 ) - - BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) FREERTOS_SYSTEM_CALL; - - __asm BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xQueueGiveMutexRecursiveImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xQueueGiveMutexRecursive_Unpriv - MPU_xQueueGiveMutexRecursive_Priv - pop { - r0 - } - b MPU_xQueueGiveMutexRecursiveImpl - MPU_xQueueGiveMutexRecursive_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueGiveMutexRecursiveImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configUSE_RECURSIVE_MUTEXES == 1 ) */ -/*-----------------------------------------------------------*/ - - #if ( configUSE_QUEUE_SETS == 1 ) - - QueueSetMemberHandle_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet, - const TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; - - __asm QueueSetMemberHandle_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet, - const TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xQueueSelectFromSetImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xQueueSelectFromSet_Unpriv - MPU_xQueueSelectFromSet_Priv - pop { - r0 - } - b MPU_xQueueSelectFromSetImpl - MPU_xQueueSelectFromSet_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueSelectFromSetImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configUSE_QUEUE_SETS == 1 ) */ -/*-----------------------------------------------------------*/ - - #if ( configUSE_QUEUE_SETS == 1 ) - - BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, - QueueSetHandle_t xQueueSet ) FREERTOS_SYSTEM_CALL; - - __asm BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, - QueueSetHandle_t xQueueSet ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xQueueAddToSetImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xQueueAddToSet_Unpriv - MPU_xQueueAddToSet_Priv - pop { - r0 - } - b MPU_xQueueAddToSetImpl - MPU_xQueueAddToSet_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xQueueAddToSetImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configUSE_QUEUE_SETS == 1 ) */ -/*-----------------------------------------------------------*/ - - #if ( configQUEUE_REGISTRY_SIZE > 0 ) - - void MPU_vQueueAddToRegistry( QueueHandle_t xQueue, - const char * pcName ) FREERTOS_SYSTEM_CALL; - - __asm void MPU_vQueueAddToRegistry( QueueHandle_t xQueue, - const char * pcName ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_vQueueAddToRegistryImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_vQueueAddToRegistry_Unpriv - MPU_vQueueAddToRegistry_Priv - pop { - r0 - } - b MPU_vQueueAddToRegistryImpl - MPU_vQueueAddToRegistry_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueAddToRegistryImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configQUEUE_REGISTRY_SIZE > 0 ) */ -/*-----------------------------------------------------------*/ - - #if ( configQUEUE_REGISTRY_SIZE > 0 ) - - void MPU_vQueueUnregisterQueue( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL; - - __asm void MPU_vQueueUnregisterQueue( QueueHandle_t xQueue ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_vQueueUnregisterQueueImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_vQueueUnregisterQueue_Unpriv - MPU_vQueueUnregisterQueue_Priv - pop { - r0 - } - b MPU_vQueueUnregisterQueueImpl - MPU_vQueueUnregisterQueue_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_vQueueUnregisterQueueImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configQUEUE_REGISTRY_SIZE > 0 ) */ -/*-----------------------------------------------------------*/ - - #if ( configQUEUE_REGISTRY_SIZE > 0 ) - - const char * MPU_pcQueueGetName( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL; - - __asm const char * MPU_pcQueueGetName( QueueHandle_t xQueue ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_pcQueueGetNameImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_pcQueueGetName_Unpriv - MPU_pcQueueGetName_Priv - pop { - r0 - } - b MPU_pcQueueGetNameImpl - MPU_pcQueueGetName_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_pcQueueGetNameImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configQUEUE_REGISTRY_SIZE > 0 ) */ -/*-----------------------------------------------------------*/ - - #if ( configUSE_TIMERS == 1 ) - - void * MPU_pvTimerGetTimerID( const TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; - - __asm void * MPU_pvTimerGetTimerID( const TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_pvTimerGetTimerIDImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_pvTimerGetTimerID_Unpriv - MPU_pvTimerGetTimerID_Priv - pop { - r0 - } - b MPU_pvTimerGetTimerIDImpl - MPU_pvTimerGetTimerID_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_pvTimerGetTimerIDImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configUSE_TIMERS == 1 ) */ -/*-----------------------------------------------------------*/ - - #if ( configUSE_TIMERS == 1 ) - - void MPU_vTimerSetTimerID( TimerHandle_t xTimer, - void * pvNewID ) FREERTOS_SYSTEM_CALL; - - __asm void MPU_vTimerSetTimerID( TimerHandle_t xTimer, - void * pvNewID ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_vTimerSetTimerIDImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_vTimerSetTimerID_Unpriv - MPU_vTimerSetTimerID_Priv - pop { - r0 - } - b MPU_vTimerSetTimerIDImpl - MPU_vTimerSetTimerID_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetTimerIDImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configUSE_TIMERS == 1 ) */ -/*-----------------------------------------------------------*/ - - #if ( configUSE_TIMERS == 1 ) - - BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; - - __asm BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTimerIsTimerActiveImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTimerIsTimerActive_Unpriv - MPU_xTimerIsTimerActive_Priv - pop { - r0 - } - b MPU_xTimerIsTimerActiveImpl - MPU_xTimerIsTimerActive_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerIsTimerActiveImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configUSE_TIMERS == 1 ) */ -/*-----------------------------------------------------------*/ - - #if ( configUSE_TIMERS == 1 ) - - TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) FREERTOS_SYSTEM_CALL; - - __asm TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTimerGetTimerDaemonTaskHandleImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTimerGetTimerDaemonTaskHandle_Unpriv - MPU_xTimerGetTimerDaemonTaskHandle_Priv - pop { - r0 - } - b MPU_xTimerGetTimerDaemonTaskHandleImpl - MPU_xTimerGetTimerDaemonTaskHandle_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetTimerDaemonTaskHandleImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configUSE_TIMERS == 1 ) */ -/*-----------------------------------------------------------*/ - - #if ( configUSE_TIMERS == 1 ) - - BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; - - __asm BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer, - const BaseType_t xCommandID, - const TickType_t xOptionalValue, - BaseType_t * const pxHigherPriorityTaskWoken, - const TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTimerGenericCommandFromTaskImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTimerGenericCommandFromTask_Unpriv - MPU_xTimerGenericCommandFromTask_Priv - pop { - r0 - } - b MPU_xTimerGenericCommandFromTaskImpl - MPU_xTimerGenericCommandFromTask_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xTimerGenericCommandFromTaskImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configUSE_TIMERS == 1 ) */ -/*-----------------------------------------------------------*/ - - #if ( configUSE_TIMERS == 1 ) - - const char * MPU_pcTimerGetName( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; - - __asm const char * MPU_pcTimerGetName( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_pcTimerGetNameImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_pcTimerGetName_Unpriv - MPU_pcTimerGetName_Priv - pop { - r0 - } - b MPU_pcTimerGetNameImpl - MPU_pcTimerGetName_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_pcTimerGetNameImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configUSE_TIMERS == 1 ) */ -/*-----------------------------------------------------------*/ - - #if ( configUSE_TIMERS == 1 ) - - void MPU_vTimerSetReloadMode( TimerHandle_t xTimer, - const BaseType_t uxAutoReload ) FREERTOS_SYSTEM_CALL; - - __asm void MPU_vTimerSetReloadMode( TimerHandle_t xTimer, - const BaseType_t uxAutoReload ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_vTimerSetReloadModeImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_vTimerSetReloadMode_Unpriv - MPU_vTimerSetReloadMode_Priv - pop { - r0 - } - b MPU_vTimerSetReloadModeImpl - MPU_vTimerSetReloadMode_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_vTimerSetReloadModeImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configUSE_TIMERS == 1 ) */ -/*-----------------------------------------------------------*/ - - #if ( configUSE_TIMERS == 1 ) - - BaseType_t MPU_xTimerGetReloadMode( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; - - __asm BaseType_t MPU_xTimerGetReloadMode( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTimerGetReloadModeImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTimerGetReloadMode_Unpriv - MPU_xTimerGetReloadMode_Priv - pop { - r0 - } - b MPU_xTimerGetReloadModeImpl - MPU_xTimerGetReloadMode_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetReloadModeImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configUSE_TIMERS == 1 ) */ -/*-----------------------------------------------------------*/ - - #if ( configUSE_TIMERS == 1 ) - - UBaseType_t MPU_uxTimerGetReloadMode( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; - - __asm UBaseType_t MPU_uxTimerGetReloadMode( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_uxTimerGetReloadModeImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_uxTimerGetReloadMode_Unpriv - MPU_uxTimerGetReloadMode_Priv - pop { - r0 - } - b MPU_uxTimerGetReloadModeImpl - MPU_uxTimerGetReloadMode_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_uxTimerGetReloadModeImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configUSE_TIMERS == 1 ) */ -/*-----------------------------------------------------------*/ - - #if ( configUSE_TIMERS == 1 ) - - TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; - - __asm TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTimerGetPeriodImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTimerGetPeriod_Unpriv - MPU_xTimerGetPeriod_Priv - pop { - r0 - } - b MPU_xTimerGetPeriodImpl - MPU_xTimerGetPeriod_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetPeriodImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configUSE_TIMERS == 1 ) */ -/*-----------------------------------------------------------*/ - - #if ( configUSE_TIMERS == 1 ) - - TickType_t MPU_xTimerGetExpiryTime( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; - - __asm TickType_t MPU_xTimerGetExpiryTime( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xTimerGetExpiryTimeImpl - - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xTimerGetExpiryTime_Unpriv - MPU_xTimerGetExpiryTime_Priv - pop { - r0 - } - b MPU_xTimerGetExpiryTimeImpl - MPU_xTimerGetExpiryTime_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xTimerGetExpiryTimeImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } - - #endif /* if ( configUSE_TIMERS == 1 ) */ -/*-----------------------------------------------------------*/ - - EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, +BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; - __asm EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToWaitFor, - const BaseType_t xClearOnExit, - const BaseType_t xWaitForAllBits, +__asm BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xEventGroupWaitBitsImpl +{ + PRESERVE8 + extern MPU_xQueueTakeMutexRecursiveImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xEventGroupWaitBits_Unpriv - MPU_xEventGroupWaitBits_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xQueueTakeMutexRecursive_Unpriv +MPU_xQueueTakeMutexRecursive_Priv + pop {r0} + b MPU_xQueueTakeMutexRecursiveImpl +MPU_xQueueTakeMutexRecursive_Unpriv + pop {r0} + svc #SYSTEM_CALL_xQueueTakeMutexRecursive +} + +#endif /* if ( configUSE_RECURSIVE_MUTEXES == 1 ) */ +/*-----------------------------------------------------------*/ + +#if ( configUSE_RECURSIVE_MUTEXES == 1 ) + +BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) FREERTOS_SYSTEM_CALL; + +__asm BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xQueueGiveMutexRecursiveImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xQueueGiveMutexRecursive_Unpriv +MPU_xQueueGiveMutexRecursive_Priv + pop {r0} + b MPU_xQueueGiveMutexRecursiveImpl +MPU_xQueueGiveMutexRecursive_Unpriv + pop {r0} + svc #SYSTEM_CALL_xQueueGiveMutexRecursive +} + +#endif /* if ( configUSE_RECURSIVE_MUTEXES == 1 ) */ +/*-----------------------------------------------------------*/ + +#if ( configUSE_QUEUE_SETS == 1 ) + +QueueSetMemberHandle_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet, + const TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; + +__asm QueueSetMemberHandle_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet, + const TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xQueueSelectFromSetImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xQueueSelectFromSet_Unpriv +MPU_xQueueSelectFromSet_Priv + pop {r0} + b MPU_xQueueSelectFromSetImpl +MPU_xQueueSelectFromSet_Unpriv + pop {r0} + svc #SYSTEM_CALL_xQueueSelectFromSet +} + +#endif /* if ( configUSE_QUEUE_SETS == 1 ) */ +/*-----------------------------------------------------------*/ + +#if ( configUSE_QUEUE_SETS == 1 ) + +BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, + QueueSetHandle_t xQueueSet ) FREERTOS_SYSTEM_CALL; + +__asm BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, + QueueSetHandle_t xQueueSet ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xQueueAddToSetImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xQueueAddToSet_Unpriv +MPU_xQueueAddToSet_Priv + pop {r0} + b MPU_xQueueAddToSetImpl +MPU_xQueueAddToSet_Unpriv + pop {r0} + svc #SYSTEM_CALL_xQueueAddToSet +} + +#endif /* if ( configUSE_QUEUE_SETS == 1 ) */ +/*-----------------------------------------------------------*/ + +#if ( configQUEUE_REGISTRY_SIZE > 0 ) + +void MPU_vQueueAddToRegistry( QueueHandle_t xQueue, + const char * pcName ) FREERTOS_SYSTEM_CALL; + +__asm void MPU_vQueueAddToRegistry( QueueHandle_t xQueue, + const char * pcName ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_vQueueAddToRegistryImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_vQueueAddToRegistry_Unpriv +MPU_vQueueAddToRegistry_Priv + pop {r0} + b MPU_vQueueAddToRegistryImpl +MPU_vQueueAddToRegistry_Unpriv + pop {r0} + svc #SYSTEM_CALL_vQueueAddToRegistry +} + +#endif /* if ( configQUEUE_REGISTRY_SIZE > 0 ) */ +/*-----------------------------------------------------------*/ + +#if ( configQUEUE_REGISTRY_SIZE > 0 ) + +void MPU_vQueueUnregisterQueue( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL; + +__asm void MPU_vQueueUnregisterQueue( QueueHandle_t xQueue ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_vQueueUnregisterQueueImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_vQueueUnregisterQueue_Unpriv +MPU_vQueueUnregisterQueue_Priv + pop {r0} + b MPU_vQueueUnregisterQueueImpl +MPU_vQueueUnregisterQueue_Unpriv + pop {r0} + svc #SYSTEM_CALL_vQueueUnregisterQueue +} + +#endif /* if ( configQUEUE_REGISTRY_SIZE > 0 ) */ +/*-----------------------------------------------------------*/ + +#if ( configQUEUE_REGISTRY_SIZE > 0 ) + +const char * MPU_pcQueueGetName( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL; + +__asm const char * MPU_pcQueueGetName( QueueHandle_t xQueue ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_pcQueueGetNameImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_pcQueueGetName_Unpriv +MPU_pcQueueGetName_Priv + pop {r0} + b MPU_pcQueueGetNameImpl +MPU_pcQueueGetName_Unpriv + pop {r0} + svc #SYSTEM_CALL_pcQueueGetName +} + +#endif /* if ( configQUEUE_REGISTRY_SIZE > 0 ) */ +/*-----------------------------------------------------------*/ + +#if ( configUSE_TIMERS == 1 ) + +void * MPU_pvTimerGetTimerID( const TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; + +__asm void * MPU_pvTimerGetTimerID( const TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_pvTimerGetTimerIDImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_pvTimerGetTimerID_Unpriv +MPU_pvTimerGetTimerID_Priv + pop {r0} + b MPU_pvTimerGetTimerIDImpl +MPU_pvTimerGetTimerID_Unpriv + pop {r0} + svc #SYSTEM_CALL_pvTimerGetTimerID +} + +#endif /* if ( configUSE_TIMERS == 1 ) */ +/*-----------------------------------------------------------*/ + +#if ( configUSE_TIMERS == 1 ) + +void MPU_vTimerSetTimerID( TimerHandle_t xTimer, + void * pvNewID ) FREERTOS_SYSTEM_CALL; + +__asm void MPU_vTimerSetTimerID( TimerHandle_t xTimer, + void * pvNewID ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_vTimerSetTimerIDImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_vTimerSetTimerID_Unpriv +MPU_vTimerSetTimerID_Priv + pop {r0} + b MPU_vTimerSetTimerIDImpl +MPU_vTimerSetTimerID_Unpriv + pop {r0} + svc #SYSTEM_CALL_vTimerSetTimerID +} + +#endif /* if ( configUSE_TIMERS == 1 ) */ +/*-----------------------------------------------------------*/ + +#if ( configUSE_TIMERS == 1 ) + +BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; + +__asm BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTimerIsTimerActiveImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTimerIsTimerActive_Unpriv +MPU_xTimerIsTimerActive_Priv + pop {r0} + b MPU_xTimerIsTimerActiveImpl +MPU_xTimerIsTimerActive_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTimerIsTimerActive +} + +#endif /* if ( configUSE_TIMERS == 1 ) */ +/*-----------------------------------------------------------*/ + +#if ( configUSE_TIMERS == 1 ) + +TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) FREERTOS_SYSTEM_CALL; + +__asm TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTimerGetTimerDaemonTaskHandleImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTimerGetTimerDaemonTaskHandle_Unpriv +MPU_xTimerGetTimerDaemonTaskHandle_Priv + pop {r0} + b MPU_xTimerGetTimerDaemonTaskHandleImpl +MPU_xTimerGetTimerDaemonTaskHandle_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle +} + +#endif /* if ( configUSE_TIMERS == 1 ) */ +/*-----------------------------------------------------------*/ + +#if ( configUSE_TIMERS == 1 ) + +BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) FREERTOS_SYSTEM_CALL; + +__asm BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTimerGenericCommandFromTaskImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTimerGenericCommandFromTask_Unpriv +MPU_xTimerGenericCommandFromTask_Priv + pop {r0} + b MPU_xTimerGenericCommandFromTaskImpl +MPU_xTimerGenericCommandFromTask_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTimerGenericCommandFromTask +} + +#endif /* if ( configUSE_TIMERS == 1 ) */ +/*-----------------------------------------------------------*/ + +#if ( configUSE_TIMERS == 1 ) + +const char * MPU_pcTimerGetName( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; + +__asm const char * MPU_pcTimerGetName( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_pcTimerGetNameImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_pcTimerGetName_Unpriv +MPU_pcTimerGetName_Priv + pop {r0} + b MPU_pcTimerGetNameImpl +MPU_pcTimerGetName_Unpriv + pop {r0} + svc #SYSTEM_CALL_pcTimerGetName +} + +#endif /* if ( configUSE_TIMERS == 1 ) */ +/*-----------------------------------------------------------*/ + +#if ( configUSE_TIMERS == 1 ) + +void MPU_vTimerSetReloadMode( TimerHandle_t xTimer, + const BaseType_t uxAutoReload ) FREERTOS_SYSTEM_CALL; + +__asm void MPU_vTimerSetReloadMode( TimerHandle_t xTimer, + const BaseType_t uxAutoReload ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_vTimerSetReloadModeImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_vTimerSetReloadMode_Unpriv +MPU_vTimerSetReloadMode_Priv + pop {r0} + b MPU_vTimerSetReloadModeImpl +MPU_vTimerSetReloadMode_Unpriv + pop {r0} + svc #SYSTEM_CALL_vTimerSetReloadMode +} + +#endif /* if ( configUSE_TIMERS == 1 ) */ +/*-----------------------------------------------------------*/ + +#if ( configUSE_TIMERS == 1 ) + +BaseType_t MPU_xTimerGetReloadMode( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; + +__asm BaseType_t MPU_xTimerGetReloadMode( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTimerGetReloadModeImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTimerGetReloadMode_Unpriv +MPU_xTimerGetReloadMode_Priv + pop {r0} + b MPU_xTimerGetReloadModeImpl +MPU_xTimerGetReloadMode_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTimerGetReloadMode +} + +#endif /* if ( configUSE_TIMERS == 1 ) */ +/*-----------------------------------------------------------*/ + +#if ( configUSE_TIMERS == 1 ) + +UBaseType_t MPU_uxTimerGetReloadMode( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; + +__asm UBaseType_t MPU_uxTimerGetReloadMode( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_uxTimerGetReloadModeImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_uxTimerGetReloadMode_Unpriv +MPU_uxTimerGetReloadMode_Priv + pop {r0} + b MPU_uxTimerGetReloadModeImpl +MPU_uxTimerGetReloadMode_Unpriv + pop {r0} + svc #SYSTEM_CALL_uxTimerGetReloadMode +} + +#endif /* if ( configUSE_TIMERS == 1 ) */ +/*-----------------------------------------------------------*/ + +#if ( configUSE_TIMERS == 1 ) + +TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; + +__asm TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTimerGetPeriodImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTimerGetPeriod_Unpriv +MPU_xTimerGetPeriod_Priv + pop {r0} + b MPU_xTimerGetPeriodImpl +MPU_xTimerGetPeriod_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTimerGetPeriod +} + +#endif /* if ( configUSE_TIMERS == 1 ) */ +/*-----------------------------------------------------------*/ + +#if ( configUSE_TIMERS == 1 ) + +TickType_t MPU_xTimerGetExpiryTime( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; + +__asm TickType_t MPU_xTimerGetExpiryTime( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xTimerGetExpiryTimeImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xTimerGetExpiryTime_Unpriv +MPU_xTimerGetExpiryTime_Priv + pop {r0} + b MPU_xTimerGetExpiryTimeImpl +MPU_xTimerGetExpiryTime_Unpriv + pop {r0} + svc #SYSTEM_CALL_xTimerGetExpiryTime +} + +#endif /* if ( configUSE_TIMERS == 1 ) */ +/*-----------------------------------------------------------*/ + +EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) FREERTOS_SYSTEM_CALL; + +__asm EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xEventGroupWaitBitsImpl + + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xEventGroupWaitBits_Unpriv +MPU_xEventGroupWaitBits_Priv + pop {r0} b MPU_xEventGroupWaitBitsImpl - MPU_xEventGroupWaitBits_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER_1 - bl MPU_xEventGroupWaitBitsImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xEventGroupWaitBits_Unpriv + pop {r0} + svc #SYSTEM_CALL_xEventGroupWaitBits +} /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToClear ) FREERTOS_SYSTEM_CALL; +EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup, + const EventBits_t uxBitsToClear ) FREERTOS_SYSTEM_CALL; - __asm EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToClear ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xEventGroupClearBitsImpl +__asm EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup, + const EventBits_t uxBitsToClear ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xEventGroupClearBitsImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xEventGroupClearBits_Unpriv - MPU_xEventGroupClearBits_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xEventGroupClearBits_Unpriv +MPU_xEventGroupClearBits_Priv + pop {r0} b MPU_xEventGroupClearBitsImpl - MPU_xEventGroupClearBits_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupClearBitsImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xEventGroupClearBits_Unpriv + pop {r0} + svc #SYSTEM_CALL_xEventGroupClearBits +} /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToSet ) FREERTOS_SYSTEM_CALL; +EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup, + const EventBits_t uxBitsToSet ) FREERTOS_SYSTEM_CALL; - __asm EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToSet ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xEventGroupSetBitsImpl +__asm EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup, + const EventBits_t uxBitsToSet ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xEventGroupSetBitsImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xEventGroupSetBits_Unpriv - MPU_xEventGroupSetBits_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xEventGroupSetBits_Unpriv +MPU_xEventGroupSetBits_Priv + pop {r0} b MPU_xEventGroupSetBitsImpl - MPU_xEventGroupSetBits_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSetBitsImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xEventGroupSetBits_Unpriv + pop {r0} + svc #SYSTEM_CALL_xEventGroupSetBits +} /*-----------------------------------------------------------*/ - EventBits_t MPU_xEventGroupSync( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToSet, - const EventBits_t uxBitsToWaitFor, - TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; +EventBits_t MPU_xEventGroupSync( EventGroupHandle_t xEventGroup, + const EventBits_t uxBitsToSet, + const EventBits_t uxBitsToWaitFor, + TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; - __asm EventBits_t MPU_xEventGroupSync( EventGroupHandle_t xEventGroup, - const EventBits_t uxBitsToSet, - const EventBits_t uxBitsToWaitFor, - TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xEventGroupSyncImpl +__asm EventBits_t MPU_xEventGroupSync( EventGroupHandle_t xEventGroup, + const EventBits_t uxBitsToSet, + const EventBits_t uxBitsToWaitFor, + TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xEventGroupSyncImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xEventGroupSync_Unpriv - MPU_xEventGroupSync_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xEventGroupSync_Unpriv +MPU_xEventGroupSync_Priv + pop {r0} b MPU_xEventGroupSyncImpl - MPU_xEventGroupSync_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xEventGroupSyncImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xEventGroupSync_Unpriv + pop {r0} + svc #SYSTEM_CALL_xEventGroupSync +} /*-----------------------------------------------------------*/ - #if ( configUSE_TRACE_FACILITY == 1 ) +#if ( configUSE_TRACE_FACILITY == 1 ) - UBaseType_t MPU_uxEventGroupGetNumber( void * xEventGroup ) FREERTOS_SYSTEM_CALL; +UBaseType_t MPU_uxEventGroupGetNumber( void * xEventGroup ) FREERTOS_SYSTEM_CALL; - __asm UBaseType_t MPU_uxEventGroupGetNumber( void * xEventGroup ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_uxEventGroupGetNumberImpl +__asm UBaseType_t MPU_uxEventGroupGetNumber( void * xEventGroup ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_uxEventGroupGetNumberImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_uxEventGroupGetNumber_Unpriv - MPU_uxEventGroupGetNumber_Priv - pop { - r0 - } - b MPU_uxEventGroupGetNumberImpl - MPU_uxEventGroupGetNumber_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_uxEventGroupGetNumberImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_uxEventGroupGetNumber_Unpriv +MPU_uxEventGroupGetNumber_Priv + pop {r0} + b MPU_uxEventGroupGetNumberImpl +MPU_uxEventGroupGetNumber_Unpriv + pop {r0} + svc #SYSTEM_CALL_uxEventGroupGetNumber +} - #endif /*( configUSE_TRACE_FACILITY == 1 )*/ +#endif /*( configUSE_TRACE_FACILITY == 1 )*/ /*-----------------------------------------------------------*/ - #if ( configUSE_TRACE_FACILITY == 1 ) +#if ( configUSE_TRACE_FACILITY == 1 ) - void MPU_vEventGroupSetNumber( void * xEventGroup, - UBaseType_t uxEventGroupNumber ) FREERTOS_SYSTEM_CALL; +void MPU_vEventGroupSetNumber( void * xEventGroup, + UBaseType_t uxEventGroupNumber ) FREERTOS_SYSTEM_CALL; - __asm void MPU_vEventGroupSetNumber( void * xEventGroup, - UBaseType_t uxEventGroupNumber ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_vEventGroupSetNumberImpl +__asm void MPU_vEventGroupSetNumber( void * xEventGroup, + UBaseType_t uxEventGroupNumber ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_vEventGroupSetNumberImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_vEventGroupSetNumber_Unpriv - MPU_vEventGroupSetNumber_Priv - pop { - r0 - } - b MPU_vEventGroupSetNumberImpl - MPU_vEventGroupSetNumber_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_vEventGroupSetNumberImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_vEventGroupSetNumber_Unpriv +MPU_vEventGroupSetNumber_Priv + pop {r0} + b MPU_vEventGroupSetNumberImpl +MPU_vEventGroupSetNumber_Unpriv + pop {r0} + svc #SYSTEM_CALL_vEventGroupSetNumber +} - #endif /*( configUSE_TRACE_FACILITY == 1 )*/ +#endif /*( configUSE_TRACE_FACILITY == 1 )*/ /*-----------------------------------------------------------*/ - size_t MPU_xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, - const void * pvTxData, - size_t xDataLengthBytes, - TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; +size_t MPU_xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, + const void * pvTxData, + size_t xDataLengthBytes, + TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; - __asm size_t MPU_xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, - const void * pvTxData, - size_t xDataLengthBytes, - TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xStreamBufferSendImpl +__asm size_t MPU_xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, + const void * pvTxData, + size_t xDataLengthBytes, + TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xStreamBufferSendImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xStreamBufferSend_Unpriv - MPU_xStreamBufferSend_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xStreamBufferSend_Unpriv +MPU_xStreamBufferSend_Priv + pop {r0} b MPU_xStreamBufferSendImpl - MPU_xStreamBufferSend_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSendImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xStreamBufferSend_Unpriv + pop {r0} + svc #SYSTEM_CALL_xStreamBufferSend +} /*-----------------------------------------------------------*/ - size_t MPU_xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer, - void * pvRxData, - size_t xBufferLengthBytes, - TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; +size_t MPU_xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer, + void * pvRxData, + size_t xBufferLengthBytes, + TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; - __asm size_t MPU_xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer, - void * pvRxData, - size_t xBufferLengthBytes, - TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xStreamBufferReceiveImpl +__asm size_t MPU_xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer, + void * pvRxData, + size_t xBufferLengthBytes, + TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xStreamBufferReceiveImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xStreamBufferReceive_Unpriv - MPU_xStreamBufferReceive_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xStreamBufferReceive_Unpriv +MPU_xStreamBufferReceive_Priv + pop {r0} b MPU_xStreamBufferReceiveImpl - MPU_xStreamBufferReceive_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferReceiveImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xStreamBufferReceive_Unpriv + pop {r0} + svc #SYSTEM_CALL_xStreamBufferReceive +} /*-----------------------------------------------------------*/ - BaseType_t MPU_xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; - __asm BaseType_t MPU_xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xStreamBufferIsFullImpl +__asm BaseType_t MPU_xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xStreamBufferIsFullImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xStreamBufferIsFull_Unpriv - MPU_xStreamBufferIsFull_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xStreamBufferIsFull_Unpriv +MPU_xStreamBufferIsFull_Priv + pop {r0} b MPU_xStreamBufferIsFullImpl - MPU_xStreamBufferIsFull_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsFullImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xStreamBufferIsFull_Unpriv + pop {r0} + svc #SYSTEM_CALL_xStreamBufferIsFull +} /*-----------------------------------------------------------*/ - BaseType_t MPU_xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; - __asm BaseType_t MPU_xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xStreamBufferIsEmptyImpl +__asm BaseType_t MPU_xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xStreamBufferIsEmptyImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xStreamBufferIsEmpty_Unpriv - MPU_xStreamBufferIsEmpty_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xStreamBufferIsEmpty_Unpriv +MPU_xStreamBufferIsEmpty_Priv + pop {r0} b MPU_xStreamBufferIsEmptyImpl - MPU_xStreamBufferIsEmpty_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferIsEmptyImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xStreamBufferIsEmpty_Unpriv + pop {r0} + svc #SYSTEM_CALL_xStreamBufferIsEmpty +} /*-----------------------------------------------------------*/ - size_t MPU_xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; +size_t MPU_xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; - __asm size_t MPU_xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xStreamBufferSpacesAvailableImpl +__asm size_t MPU_xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xStreamBufferSpacesAvailableImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xStreamBufferSpacesAvailable_Unpriv - MPU_xStreamBufferSpacesAvailable_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xStreamBufferSpacesAvailable_Unpriv +MPU_xStreamBufferSpacesAvailable_Priv + pop {r0} b MPU_xStreamBufferSpacesAvailableImpl - MPU_xStreamBufferSpacesAvailable_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSpacesAvailableImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xStreamBufferSpacesAvailable_Unpriv + pop {r0} + svc #SYSTEM_CALL_xStreamBufferSpacesAvailable +} /*-----------------------------------------------------------*/ - size_t MPU_xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; +size_t MPU_xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; - __asm size_t MPU_xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xStreamBufferBytesAvailableImpl +__asm size_t MPU_xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xStreamBufferBytesAvailableImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xStreamBufferBytesAvailable_Unpriv - MPU_xStreamBufferBytesAvailable_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xStreamBufferBytesAvailable_Unpriv +MPU_xStreamBufferBytesAvailable_Priv + pop {r0} b MPU_xStreamBufferBytesAvailableImpl - MPU_xStreamBufferBytesAvailable_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferBytesAvailableImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xStreamBufferBytesAvailable_Unpriv + pop {r0} + svc #SYSTEM_CALL_xStreamBufferBytesAvailable +} /*-----------------------------------------------------------*/ - BaseType_t MPU_xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, - size_t xTriggerLevel ) FREERTOS_SYSTEM_CALL; +BaseType_t MPU_xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, + size_t xTriggerLevel ) FREERTOS_SYSTEM_CALL; - __asm BaseType_t MPU_xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, - size_t xTriggerLevel ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xStreamBufferSetTriggerLevelImpl +__asm BaseType_t MPU_xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, + size_t xTriggerLevel ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xStreamBufferSetTriggerLevelImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xStreamBufferSetTriggerLevel_Unpriv - MPU_xStreamBufferSetTriggerLevel_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xStreamBufferSetTriggerLevel_Unpriv +MPU_xStreamBufferSetTriggerLevel_Priv + pop {r0} b MPU_xStreamBufferSetTriggerLevelImpl - MPU_xStreamBufferSetTriggerLevel_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferSetTriggerLevelImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xStreamBufferSetTriggerLevel_Unpriv + pop {r0} + svc #SYSTEM_CALL_xStreamBufferSetTriggerLevel +} /*-----------------------------------------------------------*/ - size_t MPU_xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; +size_t MPU_xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; - __asm size_t MPU_xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */ - { - PRESERVE8 - extern MPU_xStreamBufferNextMessageLengthBytesImpl +__asm size_t MPU_xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */ +{ + PRESERVE8 + extern MPU_xStreamBufferNextMessageLengthBytesImpl - push { - r0 - } - mrs r0, control - tst r0, # 1 - bne MPU_xStreamBufferNextMessageLengthBytes_Unpriv - MPU_xStreamBufferNextMessageLengthBytes_Priv - pop { - r0 - } + push {r0} + mrs r0, control + tst r0, #1 + bne MPU_xStreamBufferNextMessageLengthBytes_Unpriv +MPU_xStreamBufferNextMessageLengthBytes_Priv + pop {r0} b MPU_xStreamBufferNextMessageLengthBytesImpl - MPU_xStreamBufferNextMessageLengthBytes_Unpriv - pop { - r0 - } - svc # portSVC_SYSTEM_CALL_ENTER - bl MPU_xStreamBufferNextMessageLengthBytesImpl - svc # portSVC_SYSTEM_CALL_EXIT - bx lr - } +MPU_xStreamBufferNextMessageLengthBytes_Unpriv + pop {r0} + svc #SYSTEM_CALL_xStreamBufferNextMessageLengthBytes +} /*-----------------------------------------------------------*/ #endif /* configUSE_MPU_WRAPPERS_V1 == 0 */ diff --git a/portable/RVDS/ARM_CM4_MPU/port.c b/portable/RVDS/ARM_CM4_MPU/port.c index e7e26b969..566d4f737 100644 --- a/portable/RVDS/ARM_CM4_MPU/port.c +++ b/portable/RVDS/ARM_CM4_MPU/port.c @@ -38,6 +38,7 @@ /* Scheduler includes. */ #include "FreeRTOS.h" #include "task.h" +#include "mpu_syscall_numbers.h" #ifndef __TARGET_FPU_VFP #error This port can only be used when the project options are configured to enable hardware floating point support. @@ -139,7 +140,16 @@ /* Each task maintains its own interrupt status in the critical nesting * variable. Note this is not saved as part of the task context as context * switches can only occur when uxCriticalNesting is zero. */ -static UBaseType_t uxCriticalNesting = 0xaaaaaaaa; +PRIVILEGED_DATA static UBaseType_t uxCriticalNesting = 0xaaaaaaaa; + +#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + +/* + * This variable is set to pdTRUE when the scheduler is started. + */ + PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE; + +#endif /* * Setup the timer to generate the tick interrupts. @@ -242,24 +252,12 @@ void vPortSwitchToUserMode( void ); void vPortExitCritical( void ) PRIVILEGED_FUNCTION; #endif -/** - * @brief Triggers lazy stacking of FPU registers. - */ -static void prvTriggerLazyStacking( void ) PRIVILEGED_FUNCTION; - #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) /** - * @brief Sets up the system call stack so that upon returning from - * SVC, the system call stack is used. - * - * It is used for the system calls with up to 4 parameters. - * - * @param pulTaskStack The current SP when the SVC was raised. - * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @brief Triggers lazy stacking of FPU registers. */ - void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + static void prvTriggerLazyStacking( void ) PRIVILEGED_FUNCTION; #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -269,13 +267,22 @@ static void prvTriggerLazyStacking( void ) PRIVILEGED_FUNCTION; * @brief Sets up the system call stack so that upon returning from * SVC, the system call stack is used. * - * It is used for the system calls with 5 parameters. - * * @param pulTaskStack The current SP when the SVC was raised. * @param ulLR The value of Link Register (EXC_RETURN) in the SVC handler. + * @param ucSystemCallNumber The system call number of the system call. */ - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) PRIVILEGED_FUNCTION; + void vSystemCallEnter( uint32_t * pulTaskStack, + uint32_t ulLR, + uint8_t ucSystemCallNumber ) PRIVILEGED_FUNCTION; + +#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ + +#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) + +/** + * @brief Raise SVC for exiting from a system call. + */ + void vRequestSystemCallExit( void ) PRIVILEGED_FUNCTION; #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -360,12 +367,16 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack, void vSVCHandler_C( uint32_t * pulParam ) { uint8_t ucSVCNumber; - uint32_t ulPC, ulReg; + uint32_t ulPC; - #if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) + #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) + uint32_t ulReg; + #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) */ + + #if ( ( configUSE_MPU_WRAPPERS_V1 == 1 ) && ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) ) extern uint32_t __syscalls_flash_start__; extern uint32_t __syscalls_flash_end__; - #endif /* #if( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ + #endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 1 ) && ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) ) */ /* The stack contains: r0, r1, r2, r3, r12, LR, PC and xPSR. The first * argument (r0) is pulParam[ 0 ]. */ @@ -391,27 +402,15 @@ void vSVCHandler_C( uint32_t * pulParam ) break; - #if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) - case portSVC_RAISE_PRIVILEGE: /* Only raise the privilege, if the - * svc was raised from any of the - * system calls. */ + #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) + #if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) + case portSVC_RAISE_PRIVILEGE: /* Only raise the privilege, if the + * svc was raised from any of the + * system calls. */ - if( ( ulPC >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulPC <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - __asm - { - /* *INDENT-OFF* */ - mrs ulReg, control /* Obtain current control value. */ - bic ulReg, # 1 /* Set privilege bit. */ - msr control, ulReg /* Write back new control value. */ - /* *INDENT-ON* */ - } - } - - break; - #else /* if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ - case portSVC_RAISE_PRIVILEGE: + if( ( ulPC >= ( uint32_t ) __syscalls_flash_start__ ) && + ( ulPC <= ( uint32_t ) __syscalls_flash_end__ ) ) + { __asm { /* *INDENT-OFF* */ @@ -420,33 +419,53 @@ void vSVCHandler_C( uint32_t * pulParam ) msr control, ulReg /* Write back new control value. */ /* *INDENT-ON* */ } - break; - #endif /* #if( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ + } - default: /* Unknown SVC call. */ - break; + break; + #else /* if ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ + case portSVC_RAISE_PRIVILEGE: + __asm + { + /* *INDENT-OFF* */ + mrs ulReg, control /* Obtain current control value. */ + bic ulReg, # 1 /* Set privilege bit. */ + msr control, ulReg /* Write back new control value. */ + /* *INDENT-ON* */ + } + break; + #endif /* #if( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY == 1 ) */ + #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) */ + + default: /* Unknown SVC call. */ + break; } } /*-----------------------------------------------------------*/ -__asm void prvTriggerLazyStacking( void ) /* PRIVILEGED_FUNCTION */ -{ -/* *INDENT-OFF* */ - PRESERVE8 - - vpush {s0} /* Trigger lazy stacking. */ - vpop {s0} /* Nullify the affect of the above instruction. */ - -/* *INDENT-ON* */ -} -/*-----------------------------------------------------------*/ - +#if ( configUSE_MPU_WRAPPERS_V1 == 0 ) + + __asm void prvTriggerLazyStacking( void ) /* PRIVILEGED_FUNCTION */ + { + /* *INDENT-OFF* */ + PRESERVE8 + + vpush {s0} /* Trigger lazy stacking. */ + vpop {s0} /* Nullify the affect of the above instruction. */ + + /* *INDENT-ON* */ + } + +#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ +/*-----------------------------------------------------------*/ + #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) void vSystemCallEnter( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + uint32_t ulLR, + uint8_t ucSystemCallNumber ) /* PRIVILEGED_FUNCTION */ { extern TaskHandle_t pxCurrentTCB; + extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ]; xMPU_SETTINGS * pxMpuSettings; uint32_t * pulSystemCallStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i, r1; @@ -454,17 +473,27 @@ __asm void prvTriggerLazyStacking( void ) /* PRIVILEGED_FUNCTION */ extern uint32_t __syscalls_flash_end__; ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ + /* Checks: + * 1. SVC is raised from the system call section (i.e. application is + * not raising SVC directly). + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must be NULL as + * it is non-NULL only during the execution of a system call (i.e. + * between system call enter and exit). + * 3. System call is not for a kernel API disabled by the configuration + * in FreeRTOSConfig.h. + * 4. We do not need to check that ucSystemCallNumber is within range + * because the assembly SVC handler checks that before calling + * this function. + */ if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) && + ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) { /* Extended frame i.e. FPU in use. */ @@ -504,10 +533,18 @@ __asm void prvTriggerLazyStacking( void ) /* PRIVILEGED_FUNCTION */ * the system call. */ pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - /* Store the value of the Link Register before the SVC was raised. We need to - * restore it when we exit from the system call. */ + /* Store the value of the Link Register before the SVC was raised. + * It contains the address of the caller of the System Call entry + * point (i.e. the caller of the MPU_). We need to restore it + * when we exit from the system call. */ pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; + /* Start executing the system call upon returning from this handler. */ + pulSystemCallStack[ portOFFSET_TO_PC ] = uxSystemCallImplementations[ ucSystemCallNumber ]; + /* Raise a request to exit from the system call upon finishing the + * system call. */ + pulSystemCallStack[ portOFFSET_TO_LR ] = ( uint32_t ) vRequestSystemCallExit; + /* Record if the hardware used padding to force the stack pointer * to be double word aligned. */ if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) @@ -531,97 +568,11 @@ __asm void prvTriggerLazyStacking( void ) /* PRIVILEGED_FUNCTION */ #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) - void vSystemCallEnter_1( uint32_t * pulTaskStack, - uint32_t ulLR ) /* PRIVILEGED_FUNCTION */ + __asm void vRequestSystemCallExit( void ) /* PRIVILEGED_FUNCTION */ { - extern TaskHandle_t pxCurrentTCB; - xMPU_SETTINGS * pxMpuSettings; - uint32_t * pulSystemCallStack; - uint32_t ulStackFrameSize, ulSystemCallLocation, i, r1; - extern uint32_t __syscalls_flash_start__; - extern uint32_t __syscalls_flash_end__; + PRESERVE8 - ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ]; - - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) - { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack; - - /* This is not NULL only for the duration of the system call. */ - configASSERT( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ); - - if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) - { - /* Extended frame i.e. FPU in use. */ - ulStackFrameSize = 26; - prvTriggerLazyStacking(); - } - else - { - /* Standard frame i.e. FPU not in use. */ - ulStackFrameSize = 8; - } - - /* Make space on the system call stack for the stack frame and - * the parameter passed on the stack. We only need to copy one - * parameter but we still reserve 2 spaces to keep the stack - * double word aligned. */ - pulSystemCallStack = pulSystemCallStack - ulStackFrameSize - 2UL; - - /* Copy the stack frame. */ - for( i = 0; i < ulStackFrameSize; i++ ) - { - pulSystemCallStack[ i ] = pulTaskStack[ i ]; - } - - /* Copy the parameter which is passed the stack. */ - if( ( pulTaskStack[ portOFFSET_TO_PSR ] & portPSR_STACK_PADDING_MASK ) == portPSR_STACK_PADDING_MASK ) - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize + 1 ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG; - } - else - { - pulSystemCallStack[ ulStackFrameSize ] = pulTaskStack[ ulStackFrameSize ]; - - /* Record if the hardware used padding to force the stack pointer - * to be double word aligned. */ - pxMpuSettings->ulTaskFlags &= ( ~portSTACK_FRAME_HAS_PADDING_FLAG ); - } - - /* Use the pulSystemCallStack in thread mode. */ - __asm - { - msr psp, pulSystemCallStack - }; - - /* Raise the privilege for the duration of the system call. */ - __asm - { - mrs r1, control /* Obtain current control value. */ - bic r1, # 1 /* Clear nPRIV bit. */ - msr control, r1 /* Write back new control value. */ - }; - - /* Remember the location where we should copy the stack frame when we exit from - * the system call. */ - pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize; - - /* Store the value of the Link Register before the SVC was raised. We need to - * restore it when we exit from the system call. */ - pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry = pulTaskStack[ portOFFSET_TO_LR ]; - - /* We ensure in pxPortInitialiseStack that the system call stack is - * double word aligned and therefore, there is no need of padding. - * Clear the bit[9] of stacked xPSR. */ - pulSystemCallStack[ portOFFSET_TO_PSR ] &= ( ~portPSR_STACK_PADDING_MASK ); - } + svc #portSVC_SYSTEM_CALL_EXIT } #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ @@ -636,16 +587,25 @@ __asm void prvTriggerLazyStacking( void ) /* PRIVILEGED_FUNCTION */ xMPU_SETTINGS * pxMpuSettings; uint32_t * pulTaskStack; uint32_t ulStackFrameSize, ulSystemCallLocation, i, r1; - extern uint32_t __syscalls_flash_start__; - extern uint32_t __syscalls_flash_end__; + extern uint32_t __privileged_functions_start__; + extern uint32_t __privileged_functions_end__; ulSystemCallLocation = pulSystemCallStack[ portOFFSET_TO_PC ]; + pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); - /* If the request did not come from the system call section, do nothing. */ - if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) && - ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) ) + /* Checks: + * 1. SVC is raised from the privileged code (i.e. application is not + * raising SVC directly). This SVC is only raised from + * vRequestSystemCallExit which is in the privileged code section. + * 2. pxMpuSettings->xSystemCallStackInfo.pulTaskStack must not be NULL - + * this means that we previously entered a system call and the + * application is not attempting to exit without entering a system + * call. + */ + if( ( ulSystemCallLocation >= ( uint32_t ) __privileged_functions_start__ ) && + ( ulSystemCallLocation <= ( uint32_t ) __privileged_functions_end__ ) && + ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack != NULL ) ) { - pxMpuSettings = xTaskGetMPUSettings( pxCurrentTCB ); pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack; if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL ) @@ -683,8 +643,10 @@ __asm void prvTriggerLazyStacking( void ) /* PRIVILEGED_FUNCTION */ msr control, r1 /* Write back new control value. */ }; - /* Restore the stacked link register to what it was at the time of - * system call entry. */ + /* Return to the caller of the System Call entry point (i.e. the + * caller of the MPU_). */ + pulTaskStack[ portOFFSET_TO_PC ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; + /* Ensure that LR has a valid value.*/ pulTaskStack[ portOFFSET_TO_LR ] = pxMpuSettings->xSystemCallStackInfo.ulLinkRegisterAtSystemCallEntry; /* If the hardware used padding to force the stack pointer @@ -727,7 +689,6 @@ BaseType_t xPortIsTaskPrivileged( void ) /* PRIVILEGED_FUNCTION */ { extern vSVCHandler_C extern vSystemCallEnter - extern vSystemCallEnter_1 extern vSystemCallExit /* *INDENT-OFF* */ @@ -740,10 +701,8 @@ BaseType_t xPortIsTaskPrivileged( void ) /* PRIVILEGED_FUNCTION */ 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 vSVCHandler_C @@ -752,10 +711,6 @@ syscall_enter mov r1, lr b vSystemCallEnter -syscall_enter_1 - mov r1, lr - b vSystemCallEnter_1 - syscall_exit mov r1, lr b vSystemCallExit @@ -967,6 +922,12 @@ BaseType_t xPortStartScheduler( void ) /* Initialise the critical nesting count ready for the first task. */ uxCriticalNesting = 0; + #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + xSchedulerRunning = pdTRUE; + } + #endif + /* Ensure the VFP is enabled - it should be anyway. */ vPortEnableVFP(); @@ -1235,8 +1196,6 @@ __asm void vPortEnableVFP( void ) orr r1, r1, #( 0xf << 20 ) /* Enable CP10 and CP11 coprocessors, then save back. */ str r1, [ r0 ] bx r14 - nop - nop /* *INDENT-ON* */ } /*-----------------------------------------------------------*/ @@ -1657,21 +1616,34 @@ __asm uint32_t prvPortGetIPSR( void ) { uint32_t ulAccessControlListEntryIndex, ulAccessControlListEntryBit; BaseType_t xAccessGranted = pdFALSE; - const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + const xMPU_SETTINGS * xTaskMpuSettings; - ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); - ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); - - if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) + if( xSchedulerRunning == pdFALSE ) { + /* Grant access to all the kernel objects before the scheduler + * is started. It is necessary because there is no task running + * yet and therefore, we cannot use the permissions of any + * task. */ xAccessGranted = pdTRUE; } else { - if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */ + + ulAccessControlListEntryIndex = ( ( uint32_t ) lInternalIndexOfKernelObject / portACL_ENTRY_SIZE_BITS ); + ulAccessControlListEntryBit = ( ( uint32_t ) lInternalIndexOfKernelObject % portACL_ENTRY_SIZE_BITS ); + + if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG ) { xAccessGranted = pdTRUE; } + else + { + if( ( xTaskMpuSettings->ulAccessControlList[ ulAccessControlListEntryIndex ] & ( 1U << ulAccessControlListEntryBit ) ) != 0 ) + { + xAccessGranted = pdTRUE; + } + } } return xAccessGranted; diff --git a/portable/RVDS/ARM_CM4_MPU/portmacro.h b/portable/RVDS/ARM_CM4_MPU/portmacro.h index 1d17b4c10..455aa84cd 100644 --- a/portable/RVDS/ARM_CM4_MPU/portmacro.h +++ b/portable/RVDS/ARM_CM4_MPU/portmacro.h @@ -253,12 +253,10 @@ typedef struct MPU_SETTINGS /*-----------------------------------------------------------*/ /* SVC numbers for various services. */ -#define portSVC_START_SCHEDULER 0 -#define portSVC_YIELD 1 -#define portSVC_RAISE_PRIVILEGE 2 -#define portSVC_SYSTEM_CALL_ENTER 3 /* System calls with upto 4 parameters. */ -#define portSVC_SYSTEM_CALL_ENTER_1 4 /* System calls with 5 parameters. */ -#define portSVC_SYSTEM_CALL_EXIT 5 +#define portSVC_START_SCHEDULER 100 +#define portSVC_YIELD 101 +#define portSVC_RAISE_PRIVILEGE 102 +#define portSVC_SYSTEM_CALL_EXIT 103 /* Scheduler utilities. */