mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
freertos: Xtensa FreeRTOS saves threadptr in solicited stack frame
The Xtensa FreeRTOS port does not save the threadptr register when doing a voluntary yield. This can result in a crash when multiple tasks used the threadptr register and call "taskYIELD()". This commit adds the threadptr register to the solicited stack frame.
This commit is contained in:
@@ -446,6 +446,10 @@ _frxt_dispatch:
|
||||
.L_frxt_dispatch_sol:
|
||||
|
||||
/* Solicited stack frame. Restore minimal context and return from vPortYield(). */
|
||||
#if XCHAL_HAVE_THREADPTR
|
||||
l32i a2, sp, XT_SOL_THREADPTR
|
||||
wur.threadptr a2
|
||||
#endif
|
||||
l32i a3, sp, XT_SOL_PS
|
||||
#ifdef __XTENSA_CALL0_ABI__
|
||||
l32i a12, sp, XT_SOL_A12
|
||||
@@ -533,6 +537,10 @@ vPortYield:
|
||||
rsr a2, PS
|
||||
s32i a0, sp, XT_SOL_PC
|
||||
s32i a2, sp, XT_SOL_PS
|
||||
#if XCHAL_HAVE_THREADPTR
|
||||
rur.threadptr a2
|
||||
s32i a2, sp, XT_SOL_THREADPTR
|
||||
#endif
|
||||
#ifdef __XTENSA_CALL0_ABI__
|
||||
s32i a12, sp, XT_SOL_A12 /* save callee-saved registers */
|
||||
s32i a13, sp, XT_SOL_A13
|
||||
|
Reference in New Issue
Block a user