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



##########
File path: arch/risc-v/src/common/riscv_pthread_start.c
##########
@@ -66,11 +66,17 @@
 void up_pthread_start(pthread_trampoline_t startup,
                       pthread_startroutine_t entrypt, pthread_addr_t arg)
 {
+#ifdef CONFIG_ARCH_USE_S_MODE
+  /* Let ksys_call3() do all of the work */
+
+  ksys_call3(SYS_pthread_start, (uintptr_t)startup, (uintptr_t)entrypt,
+             (uintptr_t)arg);
+#else
   /* Let sys_call3() do all of the work */
 
   sys_call3(SYS_pthread_start, (uintptr_t)startup, (uintptr_t)entrypt,

Review comment:
       There are two approach here:
   
   1. Define two functions sys_callx and ksys_callx, but we need guard the 
prototype and implementation by the related CONFIG_XXX to ensure the user and 
kernel library don't reference the wrong symbol in the compile and link.
   2. Unify to the same function sys_callx which exist in both user/kernel 
space, but change the implementation accordingly.
   
   The second approach is better since all caller can automatically work in 
both user space and kernel space without any change. Please reconsider how 
malloc fix the similar issue which is very elegant and extensible.




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