Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FreeRTOS/FreeRTOS-Kernel.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoral-Hao <sihunzhilei@126.com>2023-11-06 12:50:32 +0300
committerGitHub <noreply@github.com>2023-11-06 12:50:32 +0300
commit8ede50cafd8279f0aff1da59d6d1b89a1fa5c2c3 (patch)
treea21e1b2f75a27a50d74a3a94c559ea35f4b3961b /tasks.c
parent83083a8a1371359e66af4a5aecb5e3110100f5c9 (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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tasks.c b/tasks.c
index 2e1cce402..75dded41f 100644
--- a/tasks.c
+++ b/tasks.c
@@ -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
}