xiaoxiang781216 commented on a change in pull request #5731:
URL: https://github.com/apache/incubator-nuttx/pull/5731#discussion_r835125326



##########
File path: arch/risc-v/src/common/riscv_exception_common.S
##########
@@ -119,12 +119,23 @@ exception_common:
   la sp, g_intstacktop
 #endif
 
-#endif
+  /* Call interrupt handler in C */
+
+  jal        x1, riscv_dispatch_irq
+
+#else
+  /* Reserve some space for CURRENT_REGS if interrupt stack disabled */

Review comment:
       add blank line

##########
File path: arch/risc-v/src/qemu-rv/qemu_rv_head.S
##########
@@ -77,11 +77,20 @@ __start:
   ld   sp, 0(t0)
 #endif
 
-  /* sp (stack top) = sp + idle stack size */
-
-  li   t0, CONFIG_IDLETHREAD_STACKSIZE
+  /*
+   * sp (stack top) = sp + idle stack size - XCPTCONTEXT_SIZE
+   * 
+   * Note: Reserve some space used by up_initial_state since we are already
+   * running and using the per CPU idle stack.
+   */
+
+  li   t0, CONFIG_IDLETHREAD_STACKSIZE - XCPTCONTEXT_SIZE

Review comment:
       change to STACK_ALIGN_UP(CONFIG_IDLETHREAD_STACKSIZE - XCPTCONTEXT_SIZE)
   and remove line 90-93

##########
File path: arch/risc-v/src/k210/k210_head.S
##########
@@ -73,11 +73,21 @@ __start:
 
   ld   sp, 0(t0)
 
-  /* sp (stack top) = sp + idle stack size */
-
-  li   t0, CONFIG_IDLETHREAD_STACKSIZE
+  /*
+   * sp (stack top) = sp + idle stack size - XCPTCONTEXT_SIZE
+   * 
+   * Note: Reserve some space used by up_initial_state since we are already
+   * running and using the per CPU idle stack.
+   */
+
+  li   t0, CONFIG_IDLETHREAD_STACKSIZE - XCPTCONTEXT_SIZE

Review comment:
       change to STACK_ALIGN_UP(CONFIG_IDLETHREAD_STACKSIZE - XCPTCONTEXT_SIZE)
   and remove line 90-93

##########
File path: arch/risc-v/src/common/riscv_exception_common.S
##########
@@ -119,12 +119,23 @@ exception_common:
   la sp, g_intstacktop
 #endif
 
-#endif
+  /* Call interrupt handler in C */
+
+  jal        x1, riscv_dispatch_irq
+
+#else
+  /* Reserve some space for CURRENT_REGS if interrupt stack disabled */
+  addi       sp, sp, -XCPTCONTEXT_SIZE
 
   /* Call interrupt handler in C */
 
   jal        x1, riscv_dispatch_irq
 
+  /* Restore sp */

Review comment:
       add blank line




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