This is an automated email from the ASF dual-hosted git repository.

archer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 3194ef0e7c arch/xtensa: set PS.EXCM initial value to 1 while new 
thread created
3194ef0e7c is described below

commit 3194ef0e7cb98e2d737eb6fbfcdfcd63959b1c5f
Author: Gao Feng <feng....@sony.com>
AuthorDate: Thu Mar 13 10:05:58 2025 +0800

    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....@sony.com>
---
 arch/xtensa/src/common/xtensa_initialstate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/xtensa/src/common/xtensa_initialstate.c 
b/arch/xtensa/src/common/xtensa_initialstate.c
index 1a0a14579c..e96790733b 100644
--- a/arch/xtensa/src/common/xtensa_initialstate.c
+++ b/arch/xtensa/src/common/xtensa_initialstate.c
@@ -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
 }

Reply via email to