This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 5c1746778e8a5dff208e13f9af1823603d1352e2
Author: zhangyuan29 <[email protected]>
AuthorDate: Wed Aug 6 10:42:05 2025 +0800

    syscall: fix TriCore syscall return error
    
    TriCore syscall stubs use D8 to save the return value, so copy D8 to
    D2 to return the value to the caller. Add the missing syscall number
    inputs to the TASKING sys_call1 through sys_call6 assembly blocks.
    
    Signed-off-by: zhangyuan29 <[email protected]>
---
 arch/tricore/include/syscall.h | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/arch/tricore/include/syscall.h b/arch/tricore/include/syscall.h
index 97a81744cdd..b857da8cb4e 100644
--- a/arch/tricore/include/syscall.h
+++ b/arch/tricore/include/syscall.h
@@ -144,7 +144,8 @@ static inline uintptr_t sys_call0(unsigned int nbr)
     );
   __asm__ __volatile__
   (
-    "syscall %1"
+    "syscall %1  \n\t"
+    "mov  %0, d8"
     : "=d"(reg0)
     : "i"(SYS_syscall), "d"(nbr)
     : "memory", "a11"
@@ -181,9 +182,10 @@ static inline uintptr_t sys_call1(unsigned int nbr, 
uintptr_t parm1)
     );
   __asm__ __volatile__
   (
-    "syscall %1"
+    "syscall %1  \n\t"
+    "mov  %0, d8"
     : "=d"(reg0)
-    : "i"(SYS_syscall)
+    : "i"(SYS_syscall), "d"(nbr)
     : "memory", "a11"
   );
 #else
@@ -221,9 +223,10 @@ static inline uintptr_t sys_call2(unsigned int nbr, 
uintptr_t parm1,
     );
   __asm__ __volatile__
   (
-    "syscall %1"
+    "syscall %1  \n\t"
+    "mov  %0, d8"
     : "=d"(reg0)
-    : "i"(SYS_syscall)
+    : "i"(SYS_syscall), "d"(nbr)
     : "memory", "a11"
   );
 #else
@@ -263,9 +266,10 @@ static inline uintptr_t sys_call3(unsigned int nbr, 
uintptr_t parm1,
     );
   __asm__ __volatile__
   (
-    "syscall %1"
+    "syscall %1  \n\t"
+    "mov  %0, d8"
     : "=d"(reg0)
-    : "i"(SYS_syscall)
+    : "i"(SYS_syscall), "d"(nbr)
     : "memory", "a11"
   );
 #else
@@ -308,9 +312,10 @@ static inline uintptr_t sys_call4(unsigned int nbr, 
uintptr_t parm1,
     );
   __asm__ __volatile__
   (
-    "syscall %1"
+    "syscall %1  \n\t"
+    "mov  %0, d8"
     : "=d"(reg0)
-    : "i"(SYS_syscall)
+    : "i"(SYS_syscall), "d"(nbr)
     : "memory", "a11"
   );
 #else
@@ -356,9 +361,10 @@ static inline uintptr_t sys_call5(unsigned int nbr, 
uintptr_t parm1,
     );
   __asm__ __volatile__
   (
-    "syscall %1"
+    "syscall %1  \n\t"
+    "mov  %0, d8"
     : "=d"(reg0)
-    : "i"(SYS_syscall)
+    : "i"(SYS_syscall), "d"(nbr)
     : "memory", "a11"
   );
 #else
@@ -408,9 +414,10 @@ static inline uintptr_t sys_call6(unsigned int nbr, 
uintptr_t parm1,
     );
   __asm__ __volatile__
   (
-    "syscall %1"
+    "syscall %1  \n\t"
+    "mov  %0, d8"
     : "=d"(reg0)
-    : "i"(SYS_syscall)
+    : "i"(SYS_syscall), "d"(nbr)
     : "memory", "a11"
   );
 #else

Reply via email to