xiaoxiang781216 commented on code in PR #15651:
URL: https://github.com/apache/nuttx/pull/15651#discussion_r1925163081


##########
arch/risc-v/src/common/supervisor/riscv_perform_syscall.c:
##########
@@ -89,5 +89,10 @@ void *riscv_perform_syscall(uintreg_t *regs)
 
   up_set_interrupt_context(false);
 
+  /* (*running_task)->xcp.regs is about to become invalid
+   * and will be marked as NULL to avoid misusage.
+   */
+
+  (*running_task)->xcp.regs = NULL;
   return tcb->xcp.regs;

Review Comment:
   do we need save regs beore zero



##########
arch/xtensa/src/common/xtensa_irqdispatch.c:
##########
@@ -114,5 +114,13 @@ uint32_t *xtensa_irq_dispatch(int irq, uint32_t *regs)
 #endif
 
   board_autoled_off(LED_INIRQ);
+
+  regs = tcb->xcp.regs;
+
+  /* (*running_task)->xcp.regs is about to become invalid
+   * and will be marked as NULL to avoid misusage.
+   */
+
+  (*running_task)->xcp.regs = NULL;
   return tcb->xcp.regs;

Review Comment:
   ```suggestion
     return regs;
   ```



##########
arch/risc-v/src/common/riscv_doirq.c:
##########
@@ -138,5 +138,11 @@ uintreg_t *riscv_doirq(int irq, uintreg_t *regs)
 
 #endif
   board_autoled_off(LED_INIRQ);
+
+  /* (*running_task)->xcp.regs is about to become invalid
+   * and will be marked as NULL to avoid misusage.
+   */
+
+  (*running_task)->xcp.regs = NULL;
   return tcb->xcp.regs;

Review Comment:
   ditto



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