pkarashchenko commented on a change in pull request #5917:
URL: https://github.com/apache/incubator-nuttx/pull/5917#discussion_r839352623



##########
File path: arch/risc-v/src/common/riscv_swint.c
##########
@@ -109,45 +109,24 @@ static void riscv_registerdump(const uintptr_t *regs)
 
 #ifdef CONFIG_LIB_SYSCALL
 static void dispatch_syscall(void) naked_function;
-#ifdef CONFIG_ARCH_RV64
 static void dispatch_syscall(void)
 {
   asm volatile
     (
-     " addi sp, sp, -8\n"         /* Create a stack frame to hold ra */
-     " sd   ra, 0(sp)\n"          /* Save ra in the stack frame */
-     " la   t0, g_stublookup\n"   /* t0=The base of the stub lookup table */
-     " slli a0, a0, 3\n"          /* a0=Offset for the stub lookup table */
-     " add  t0, t0, a0\n"         /* t0=The address in the table */
-     " ld   t0, 0(t0)\n"          /* t0=The address of the stub for this 
syscall */
-     " jalr ra, t0\n"             /* Call the stub (modifies ra) */
-     " ld   ra, 0(sp)\n"          /* Restore ra */
-     " addi sp, sp, 8\n"          /* Destroy the stack frame */
-     " mv   a2, a0\n"             /* a2=Save return value in a0 */
-     " li   a0, 3\n"              /* a0=SYS_syscall_return (3) */
-     " ecall"                     /* Return from the syscall */
+     "addi sp, sp, -" REGSSIZE "\n" /* Create a stack frame to hold ra */
+     REGSTORE " ra, 0(sp)\n"        /* Save ra in the stack frame */
+     "la   t0, g_stublookup\n"      /* t0=The base of the stub lookup table */
+     "slli a0, a0, 3\n"             /* a0=Offset for the stub lookup table */

Review comment:
       As an alternative I can make a define `PTR_INDEX_SHIFT` to 2 or 3 based 
on `CONFIG_ARCH_RV32` and use it in all similar places.




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