pkarashchenko commented on a change in pull request #5782: URL: https://github.com/apache/incubator-nuttx/pull/5782#discussion_r839531282
########## File path: arch/risc-v/include/syscall.h ########## @@ -259,7 +230,15 @@ static inline uintptr_t sys_call2(unsigned int nbr, uintptr_t parm1, asm volatile ( +#if defined (CONFIG_ARCH_USE_S_MODE) && defined (__KERNEL__) + " addi sp, sp, -16\n" /* Make room */ + " sd ra, 0(sp)\n" /* Save ra */ + " jal ra, riscv_syscall_dispatch\n" /* Dispatch (modifies ra) */ + " ld ra, 0(sp)\n" /* Restore ra */ + " addi sp, sp, 16\n" /* Restore sp */ +#else "ecall" +#endif Review comment: Those parts seems to be copy pasted few times. Maybe we can ``` #if defined (CONFIG_ARCH_USE_S_MODE) && defined (__KERNEL__) # define ASM_SYS_CALL \ " addi sp, sp, -16\n" /* Make room */ \ " sd ra, 0(sp)\n" /* Save ra */ \ " jal ra, riscv_syscall_dispatch\n" /* Dispatch (modifies ra) */ \ " ld ra, 0(sp)\n" /* Restore ra */ \ " addi sp, sp, 16\n" /* Restore sp */ #else # define ASM_SYS_CALL "ecall" #endif ... __asm__ __volatile__(ASM_SYS_CALL); ``` -- 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