diff options
author | Moral-Hao <sihunzhilei@126.com> | 2023-11-06 12:50:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-06 12:50:32 +0300 |
commit | 8ede50cafd8279f0aff1da59d6d1b89a1fa5c2c3 (patch) | |
tree | a21e1b2f75a27a50d74a3a94c559ea35f4b3961b /tasks.c | |
parent | 83083a8a1371359e66af4a5aecb5e3110100f5c9 (diff) |
Fix vTaskSwitchContext for smp. (#879)
The function vTaskSwitchContext in smp has an parameter of core id,
which means this function is not only used for the core who call it.
Thus we should use the task running on the specific core id,
instead of use the task running on the core who call this function.
Co-authored-by: moral-hao <405197809@qq.com>
Diffstat (limited to 'tasks.c')
-rw-r--r-- | tasks.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -5142,7 +5142,7 @@ BaseType_t xTaskIncrementTick( void ) * are provided by the application, not the kernel. */ if( ulTotalRunTime[ xCoreID ] > ulTaskSwitchedInTime[ xCoreID ] ) { - pxCurrentTCB->ulRunTimeCounter += ( ulTotalRunTime[ xCoreID ] - ulTaskSwitchedInTime[ xCoreID ] ); + pxCurrentTCBs[ xCoreID ]->ulRunTimeCounter += ( ulTotalRunTime[ xCoreID ] - ulTaskSwitchedInTime[ xCoreID ] ); } else { @@ -5159,7 +5159,7 @@ BaseType_t xTaskIncrementTick( void ) /* Before the currently running task is switched out, save its errno. */ #if ( configUSE_POSIX_ERRNO == 1 ) { - pxCurrentTCB->iTaskErrno = FreeRTOS_errno; + pxCurrentTCBs[ xCoreID ]->iTaskErrno = FreeRTOS_errno; } #endif @@ -5170,7 +5170,7 @@ BaseType_t xTaskIncrementTick( void ) /* After the new task is switched in, update the global errno. */ #if ( configUSE_POSIX_ERRNO == 1 ) { - FreeRTOS_errno = pxCurrentTCB->iTaskErrno; + FreeRTOS_errno = pxCurrentTCBs[ xCoreID ]->iTaskErrno; } #endif @@ -5178,7 +5178,7 @@ BaseType_t xTaskIncrementTick( void ) { /* Switch C-Runtime's TLS Block to point to the TLS * Block specific to this task. */ - configSET_TLS_BLOCK( pxCurrentTCB->xTLSBlock ); + configSET_TLS_BLOCK( pxCurrentTCBs[ xCoreID ]->xTLSBlock ); } #endif } |