arch/xtensa: set PS.EXCM initial value to 1 while new thread created

To avoid level-1 interrupt break retrieve PC/A0/SP/A2 register,
PS.EXCM set to 1 by CPU HW while handling exception/interrupt.

But if context switching happens and new thread created,
the thread initial value of PS.EXCM is used.

Same behevior as ESP-IDF code:
https://github.com/espressif/esp-idf/blob/master/
components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c#L366

Signed-off-by: Gao Feng <Feng.Gao@sony.com>
This commit is contained in:
Gao Feng 2025-03-13 10:05:58 +08:00 committed by archer
parent c42431a01f
commit 3194ef0e7c

View file

@ -235,11 +235,11 @@ void up_initial_state(struct tcb_s *tcb)
/* Set initial PS to int level 0, user mode. */
#ifdef __XTENSA_CALL0_ABI__
xcp->regs[REG_PS] = PS_UM;
xcp->regs[REG_PS] = PS_UM | PS_EXCM;
#else
/* For windowed ABI set WOE and CALLINC (pretend task was 'call4'd). */
xcp->regs[REG_PS] = PS_UM | PS_WOE | PS_CALLINC(1);
xcp->regs[REG_PS] = PS_UM | PS_EXCM | PS_WOE | PS_CALLINC(1);
#endif
}