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>
pull/865/head^2
Moral-Hao 1 year ago committed by GitHub
parent 83083a8a13
commit 8ede50cafd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
}

Loading…
Cancel
Save