pussuw commented on a change in pull request #5782: URL: https://github.com/apache/incubator-nuttx/pull/5782#discussion_r838498346
########## File path: arch/risc-v/include/syscall.h ########## @@ -207,7 +162,15 @@ static inline uintptr_t sys_call0(unsigned int nbr) 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 */ Review comment: Yes, this works for 64-bit only, oversight by me. The handy macros REGLOAD/REGSTORE are not usable from inline assembly if I'm right ? It's the same dilemma as is in riscv_swint.c, basically 99% copypaste for the function `static void dispatch_syscall(void)` I could not think of a good way to merge the two implementations. Maybe using some kind of stringify macro like is used with this: ``` static inline irqstate_t up_irq_save(void) { irqstate_t flags; /* Read mstatus & clear machine interrupt enable (MIE) in mstatus */ __asm__ __volatile__ ( "csrrc %0, " CSR_XSTR(CSR_STATUS) ", %1\n" : "=r" (flags) : "r"(STATUS_IE) : "memory" ); /* Return the previous mstatus value so that it can be restored with * up_irq_restore(). */ return flags; } ``` -- 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