summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStafford Horne <shorne@gmail.com>2018-01-04 22:57:02 +0900
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2018-01-15 20:01:26 +0000
commitc47a0379237ddb9260c5a72d6a2318b766b3261d (patch)
tree32d38ab157f02014071f09544f6db25a1152153c
parentf76de0893c0b9dff39ded38023cb6957cb09fb9f (diff)
nds32: Add syscall macros for 5 and 6 parameters
This is to fix an error after switching to use generic syscalls. libc/sysdeps/linux/common/syscall.c: In function 'syscall': libc/sysdeps/linux/common/syscall.c:27:2: warning: implicit declaration of function 'internal_syscall_ncs6' [-Wimplicit-function-declaration] return INLINE_SYSCALL_NCS(sysnum, 6, arg1, arg2, arg3, arg4, arg5, arg6); ^ Defining these functions as described by Vincent Ren-Wei Chen <vincentc@andestech.com> Signed-off-by: Stafford Horne <shorne@gmail.com>
-rw-r--r--libc/sysdeps/linux/nds32/bits/syscalls.h57
1 files changed, 54 insertions, 3 deletions
diff --git a/libc/sysdeps/linux/nds32/bits/syscalls.h b/libc/sysdeps/linux/nds32/bits/syscalls.h
index 215ce3467..a5cdda18a 100644
--- a/libc/sysdeps/linux/nds32/bits/syscalls.h
+++ b/libc/sysdeps/linux/nds32/bits/syscalls.h
@@ -68,9 +68,8 @@
#define INTERNAL_SYSCALL(name, err, nr, args...) internal_syscall##nr(__NR_##name, err, args)
/*
- The _NCS variant allows non-constant syscall numbers but it is not
- possible to use more than four parameters.
-*/
+ The _NCS variant allows non-constant syscall numbers
+ */
#undef INTERNAL_SYSCALL_NCS
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) internal_syscall_ncs##nr(name, err, args)
@@ -298,6 +297,58 @@
__res; \
})
+#define internal_syscall_ncs5(name, err, arg1, arg2, arg3, arg4, arg5) \
+ ({ \
+ register long ___res __asm__("$r0"); \
+ register long __no __asm__("$r0") = (long) (name); \
+ register long __arg1 __asm__("$r1") = (long) (arg1); \
+ register long __arg2 __asm__("$r2") = (long) (arg2); \
+ register long __arg3 __asm__("$r3") = (long) (arg3); \
+ register long __arg4 __asm__("$r4") = (long) (arg4); \
+ register long __arg5 __asm__("$r5") = (long) (arg5); \
+ __asm__ volatile ( \
+ __issue_syscall (LIB_SYSCALL) \
+ : "=r" (___res) /* output operands */ \
+ : "r" (__arg1) /* input operands */ \
+ , "r" (__arg2) /* input operands */ \
+ , "r" (__arg3) /* input operands */ \
+ , "r" (__arg4) /* input operands */ \
+ , "r" (__arg5) /* input operands */ \
+ : __SYSCALL_CLOBBERS); /* list of clobbered registers */ \
+ ___res; \
+ })
+
+#define internal_syscall_ncs6(name, err, arg1, arg2, arg3, arg4, arg5, arg6) \
+ ({ \
+ register long __res __asm__("$r0"); \
+ register long __no __asm__("$r0") = (long) (name); \
+ register long __arg1 __asm__("$r1") = (long) (arg1); \
+ register long __arg2 __asm__("$r2") = (long) (arg2); \
+ register long __arg3 __asm__("$r3") = (long) (arg3); \
+ register long __arg4 __asm__("$r4") = (long) (arg4); \
+ register long __arg5 __asm__("$r5") = (long) (arg5); \
+ __asm__ volatile ( \
+ "addi10.sp\t #-4\n\t" \
+ CFI_ADJUST_CFA_OFFSET(4)"\n\t" \
+ "push\t %7\n\t" \
+ CFI_ADJUST_CFA_OFFSET(4)"\n\t" \
+ __issue_syscall (LIB_SYSCALL) \
+ "pop\t %7\n\t" \
+ CFI_ADJUST_CFA_OFFSET(-4)"\n\t" \
+ "addi10.sp\t #4\n\t" \
+ CFI_ADJUST_CFA_OFFSET(-4)"\n\t" \
+ : "=r" (__res) /* output operands */ \
+ : "r" (__no) /* input operands */ \
+ , "r" (__arg1) /* input operands */ \
+ , "r" (__arg2) /* input operands */ \
+ , "r" (__arg3) /* input operands */ \
+ , "r" (__arg4) /* input operands */ \
+ , "r" (__arg5) /* input operands */ \
+ , "r" (arg6) /* input operands */ \
+ : __SYSCALL_CLOBBERS); /* list of clobbered registers */ \
+ __res; \
+ })
+
#define __SYSCALL_CLOBBERS "$lp", "memory"
#endif /* ! __ASSEMBLER__ */
#endif /* _BITS_SYSCALLS_H */