chirping78 commented on PR #15985:
URL: https://github.com/apache/nuttx/pull/15985#issuecomment-2728509964

   @sdc-g I have some concerns about your this PR.
   
   Without your PR, in new task‘s  register save area, REG_PS's `EXCM` bit is 
clear.
   
   Before the new task is resumed , `exception_exit` will copy REG_PS from 
register save area to PS (for level1) or EPS[N] (for level2 and above).
   
   - if new task be resumed by level1: `rfe` sets PS.EXCM back to 0, and then 
jumps to the address in EPC[1].
   To prevent the resuming action be interrupted, REG_PS.EXCM is set to 1 
[here](https://github.com/apache/nuttx/blob/master/arch/xtensa/src/common/xtensa_user_handler.S#L317)
 and 
[here](https://github.com/apache/nuttx/blob/master/arch/xtensa/src/common/xtensa_int_handlers.S#L224)
   
   - if new task be resumed by level2 and above: `rfi` will restores the PS 
from EPS[N] and jump to the address in EPC[N].
   
   ----------------------
   
   
   Now with your PR, in new task‘s  register save area, REG_PS's `EXCM` bit is 
set.
   
   - If new task be resumed by level1: `rfe` sets PS.EXCM back to 0, and then 
jumps to the address in EPC[1]. No problem here, it works as before.
   
   - If new task be resumed by level2 and above: `rfi` will restores the PS 
from EPS[N] and jump to the address in EPC[N]. ***Problem will be here***, 
after the new task be resumed, ***the PS.EXCM bit is still set***. If window 
rotation related instruction is executed, error will arise.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to