pussuw commented on code in PR #6052:
URL: https://github.com/apache/incubator-nuttx/pull/6052#discussion_r848491941


##########
arch/risc-v/include/syscall.h:
##########
@@ -124,16 +124,10 @@
 #define SYS_signal_handler_return (7)
 #endif /* !CONFIG_BUILD_FLAT */
 
-#if defined (CONFIG_ARCH_USE_S_MODE) && defined (__KERNEL__)
-#  define ASM_SYS_CALL \
-     " addi sp, sp, -16\n"                  /* Make room */ \
-     REGSTORE " ra, 0(sp)\n"                /* Save ra */ \
-     " jal  ra, riscv_dispatch_syscall\n"   /* Dispatch (modifies ra) */ \
-     REGLOAD " ra, 0(sp)\n"                 /* Restore ra */ \
-     " addi sp, sp, 16\n"                   /* Restore sp */
+#if defined(CONFIG_ARCH_USE_S_MODE) && defined(__KERNEL__)
+#  define ASM_SYS_CALL "j riscv_dispatch_syscall\n"

Review Comment:
   Yes, this should now work, but this leaves libc without a proper 
implementation for sys_callx, does it not ? It's very unfortunate that the 
userspace uses the same definitions for sys_call() as the kernel does. Also, I 
suspect that the C compiler will now do the call to sys_call via jump-and-link, 
so do we save the instructions now?



##########
arch/risc-v/include/syscall.h:
##########
@@ -124,16 +124,10 @@
 #define SYS_signal_handler_return (7)
 #endif /* !CONFIG_BUILD_FLAT */
 
-#if defined (CONFIG_ARCH_USE_S_MODE) && defined (__KERNEL__)
-#  define ASM_SYS_CALL \
-     " addi sp, sp, -16\n"                  /* Make room */ \
-     REGSTORE " ra, 0(sp)\n"                /* Save ra */ \
-     " jal  ra, riscv_dispatch_syscall\n"   /* Dispatch (modifies ra) */ \
-     REGLOAD " ra, 0(sp)\n"                 /* Restore ra */ \
-     " addi sp, sp, 16\n"                   /* Restore sp */
+#if defined(CONFIG_ARCH_USE_S_MODE) && defined(__KERNEL__)
+#  define ASM_SYS_CALL "j riscv_dispatch_syscall\n"

Review Comment:
   Yes, this should now work, but this leaves libc without a proper 
implementation for sys_callx, does it not ? It's very unfortunate that the 
userspace uses the same definitions for sys_call() as the kernel does.
   
   Also, I suspect that the C compiler will now do the call to sys_call via 
jump-and-link, so do we save the instructions now?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to