diff mbox series

[11/15] s390: Consolidate Linux syscall definition

Message ID 20200210192038.23588-11-adhemerval.zanella@linaro.org
State New
Headers show
Series [01/15] powerpc: Consolidate Linux syscall definition | expand

Commit Message

Adhemerval Zanella Feb. 10, 2020, 7:20 p.m. UTC
The {INTERNAL,INLINE}_SYSCALL are defined only on s390 sysdep.h.

Checked on s390x-linux-gnu and s390-linux-gnu.
---
 sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h |  95 ----------------
 sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h |  97 -----------------
 sysdeps/unix/sysv/linux/s390/sysdep.h         | 102 ++++++++++++++++++
 3 files changed, 102 insertions(+), 192 deletions(-)

-- 
2.17.1
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
index f52b8b8735..520c9356c6 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
@@ -38,9 +38,6 @@ 
 /* in newer 2.1 kernels __NR_syscall is missing so we define it here */
 #define __NR_syscall 0
 
-#undef SYS_ify
-#define SYS_ify(syscall_name)	__NR_##syscall_name
-
 #ifdef __ASSEMBLER__
 
 /* Linux uses a negative return value to indicate syscall errors, unlike
@@ -180,98 +177,6 @@ 
 
 #endif /* __ASSEMBLER__ */
 
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...)				      \
-  ({									      \
-    unsigned int _ret = INTERNAL_SYSCALL (name, , nr, args);		      \
-    if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, )))		      \
-     {									      \
-       __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, ));			      \
-       _ret = 0xffffffff;						      \
-     }									      \
-    (int) _ret; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
-#undef INTERNAL_SYSCALL_DIRECT
-#define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...)			      \
-  ({									      \
-    DECLARGS_##nr(args)							      \
-    register int _ret __asm__("2");					      \
-    __asm__ __volatile__ (						      \
-			  "svc    %b1\n\t"				      \
-			  : "=d" (_ret)					      \
-			  : "i" (__NR_##name) ASMFMT_##nr		      \
-			  : "memory" );					      \
-    _ret; })
-
-#undef INTERNAL_SYSCALL_SVC0
-#define INTERNAL_SYSCALL_SVC0(name, err, nr, args...)			      \
-  ({									      \
-    DECLARGS_##nr(args)							      \
-    register unsigned long _nr __asm__("1") = (unsigned long)(__NR_##name);   \
-    register int _ret __asm__("2");					      \
-    __asm__ __volatile__ (						      \
-			  "svc    0\n\t"				      \
-			  : "=d" (_ret)					      \
-			  : "d" (_nr) ASMFMT_##nr			      \
-			  : "memory" );					      \
-    _ret; })
-
-#undef INTERNAL_SYSCALL_NCS
-#define INTERNAL_SYSCALL_NCS(no, err, nr, args...)			      \
-  ({									      \
-    DECLARGS_##nr(args)							      \
-    register unsigned long _nr __asm__("1") = (unsigned long)(no);	      \
-    register int _ret __asm__("2");					      \
-    __asm__ __volatile__ (						      \
-			  "svc    0\n\t"				      \
-			  : "=d" (_ret)					      \
-			  : "d" (_nr) ASMFMT_##nr			      \
-			  : "memory" );					      \
-    _ret; })
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...)			      \
-  (((__NR_##name) < 256)						      \
-   ? INTERNAL_SYSCALL_DIRECT(name, err, nr, args)			      \
-   : INTERNAL_SYSCALL_SVC0(name, err,nr, args))
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err)				      \
-  ((unsigned int) (val) >= 0xfffff001u)
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val))
-
-#define DECLARGS_0()
-#define DECLARGS_1(arg1) \
-	register unsigned long gpr2 __asm__ ("2") = (unsigned long)(arg1);
-#define DECLARGS_2(arg1, arg2) \
-	DECLARGS_1(arg1) \
-	register unsigned long gpr3 __asm__ ("3") = (unsigned long)(arg2);
-#define DECLARGS_3(arg1, arg2, arg3) \
-	DECLARGS_2(arg1, arg2) \
-	register unsigned long gpr4 __asm__ ("4") = (unsigned long)(arg3);
-#define DECLARGS_4(arg1, arg2, arg3, arg4) \
-	DECLARGS_3(arg1, arg2, arg3) \
-	register unsigned long gpr5 __asm__ ("5") = (unsigned long)(arg4);
-#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
-	DECLARGS_4(arg1, arg2, arg3, arg4) \
-	register unsigned long gpr6 __asm__ ("6") = (unsigned long)(arg5);
-#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
-	DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
-	register unsigned long gpr7 __asm__ ("7") = (unsigned long)(arg6);
-
-#define ASMFMT_0
-#define ASMFMT_1 , "0" (gpr2)
-#define ASMFMT_2 , "0" (gpr2), "d" (gpr3)
-#define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4)
-#define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
-#define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6)
-#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7)
-
 /* Pointer mangling support.  */
 #if IS_IN (rtld)
 /* We cannot use the thread descriptor because in ld.so we use setjmp
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
index 9ff4479dc3..623059135e 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
@@ -50,9 +50,6 @@ 
 # define __NR_pwrite __NR_pwrite64
 #endif
 
-#undef SYS_ify
-#define SYS_ify(syscall_name)	__NR_##syscall_name
-
 #ifdef __ASSEMBLER__
 
 /* Linux uses a negative return value to indicate syscall errors, unlike
@@ -186,100 +183,6 @@ 
 
 #endif /* __ASSEMBLER__ */
 
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...)				      \
-  ({									      \
-    long _ret = INTERNAL_SYSCALL (name, , nr, args);			      \
-    if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, )))		      \
-     {									      \
-       __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, ));			      \
-       _ret = -1;							      \
-     }									      \
-    _ret; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
-#undef INTERNAL_SYSCALL_DIRECT
-#define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...)			      \
-  ({									      \
-    DECLARGS_##nr(args)							      \
-    register long _ret __asm__("2");					      \
-    __asm__ __volatile__ (						      \
-			  "svc    %b1\n\t"				      \
-			  : "=d" (_ret)					      \
-			  : "i" (__NR_##name) ASMFMT_##nr		      \
-			  : "memory" );					      \
-    _ret; })
-
-#undef INTERNAL_SYSCALL_SVC0
-#define INTERNAL_SYSCALL_SVC0(name, err, nr, args...)			      \
-  ({									      \
-    DECLARGS_##nr(args)							      \
-    register unsigned long _nr __asm__("1") = (unsigned long)(__NR_##name);   \
-    register long _ret __asm__("2");					      \
-    __asm__ __volatile__ (						      \
-			  "svc    0\n\t"				      \
-			  : "=d" (_ret)					      \
-			  : "d" (_nr) ASMFMT_##nr			      \
-			  : "memory" );					      \
-    _ret; })
-
-#undef INTERNAL_SYSCALL_NCS
-#define INTERNAL_SYSCALL_NCS(no, err, nr, args...)			      \
-  ({									      \
-    DECLARGS_##nr(args)							      \
-    register unsigned long _nr __asm__("1") = (unsigned long)(no);	      \
-    register long _ret __asm__("2");					      \
-    __asm__ __volatile__ (						      \
-			  "svc    0\n\t"				      \
-			  : "=d" (_ret)					      \
-			  : "d" (_nr) ASMFMT_##nr			      \
-			  : "memory" );					      \
-    _ret; })
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...)			      \
-  (((__NR_##name) < 256)						      \
-   ? INTERNAL_SYSCALL_DIRECT(name, err, nr, args)			      \
-   : INTERNAL_SYSCALL_SVC0(name, err,nr, args))
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err)				      \
-  ((unsigned long) (val) >= -4095UL)
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val))
-
-#define DECLARGS_0()
-#define DECLARGS_1(arg1) \
-	register unsigned long gpr2 __asm__ ("2") = (unsigned long)(arg1);
-#define DECLARGS_2(arg1, arg2) \
-	DECLARGS_1(arg1) \
-	register unsigned long gpr3 __asm__ ("3") = (unsigned long)(arg2);
-#define DECLARGS_3(arg1, arg2, arg3) \
-	DECLARGS_2(arg1, arg2) \
-	register unsigned long gpr4 __asm__ ("4") = (unsigned long)(arg3);
-#define DECLARGS_4(arg1, arg2, arg3, arg4) \
-	DECLARGS_3(arg1, arg2, arg3) \
-	register unsigned long gpr5 __asm__ ("5") = (unsigned long)(arg4);
-#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
-	DECLARGS_4(arg1, arg2, arg3, arg4) \
-	register unsigned long gpr6 __asm__ ("6") = (unsigned long)(arg5);
-#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
-	DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
-	register unsigned long gpr7 __asm__ ("7") = (unsigned long)(arg6);
-
-#define ASMFMT_0
-#define ASMFMT_1 , "0" (gpr2)
-#define ASMFMT_2 , "0" (gpr2), "d" (gpr3)
-#define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4)
-#define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
-#define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6)
-#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7)
-
-#define SINGLE_THREAD_BY_GLOBAL		1
-
 /* Pointer mangling support.  */
 #if IS_IN (rtld)
 /* We cannot use the thread descriptor because in ld.so we use setjmp
diff --git a/sysdeps/unix/sysv/linux/s390/sysdep.h b/sysdeps/unix/sysv/linux/s390/sysdep.h
index 33ed86f252..1df0462cc4 100644
--- a/sysdeps/unix/sysv/linux/s390/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/sysdep.h
@@ -16,6 +16,106 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef __ASSEMBLY__
+
+#undef SYS_ify
+#define SYS_ify(syscall_name)	__NR_##syscall_name
+
+#undef INLINE_SYSCALL
+#define INLINE_SYSCALL(name, nr, args...)				      \
+  ({									      \
+    long _ret = INTERNAL_SYSCALL (name, , nr, args);			      \
+    if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, )))		      \
+     {									      \
+       __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, ));			      \
+       _ret = -1;							      \
+     }									      \
+    _ret; })
+
+#undef INTERNAL_SYSCALL_DECL
+#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
+
+#undef INTERNAL_SYSCALL_DIRECT
+#define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...)			      \
+  ({									      \
+    DECLARGS_##nr(args)							      \
+    register long _ret __asm__("2");					      \
+    __asm__ __volatile__ (						      \
+			  "svc    %b1\n\t"				      \
+			  : "=d" (_ret)					      \
+			  : "i" (__NR_##name) ASMFMT_##nr		      \
+			  : "memory" );					      \
+    _ret; })
+
+#undef INTERNAL_SYSCALL_SVC0
+#define INTERNAL_SYSCALL_SVC0(name, err, nr, args...)			      \
+  ({									      \
+    DECLARGS_##nr(args)							      \
+    register unsigned long _nr __asm__("1") = (unsigned long)(__NR_##name);   \
+    register long _ret __asm__("2");					      \
+    __asm__ __volatile__ (						      \
+			  "svc    0\n\t"				      \
+			  : "=d" (_ret)					      \
+			  : "d" (_nr) ASMFMT_##nr			      \
+			  : "memory" );					      \
+    _ret; })
+
+#undef INTERNAL_SYSCALL_NCS
+#define INTERNAL_SYSCALL_NCS(no, err, nr, args...)			      \
+  ({									      \
+    DECLARGS_##nr(args)							      \
+    register unsigned long _nr __asm__("1") = (unsigned long)(no);	      \
+    register long _ret __asm__("2");					      \
+    __asm__ __volatile__ (						      \
+			  "svc    0\n\t"				      \
+			  : "=d" (_ret)					      \
+			  : "d" (_nr) ASMFMT_##nr			      \
+			  : "memory" );					      \
+    _ret; })
+
+#undef INTERNAL_SYSCALL
+#define INTERNAL_SYSCALL(name, nr, args...)				      \
+  (((__NR_##name) < 256)						      \
+   ? INTERNAL_SYSCALL_DIRECT(name, nr, args)				      \
+   : INTERNAL_SYSCALL_SVC0(name, nr, args))
+
+#undef INTERNAL_SYSCALL_ERROR_P
+#define INTERNAL_SYSCALL_ERROR_P(val, err)                                    \
+  ((unsigned long) (val) >= -4095UL)
+
+#undef INTERNAL_SYSCALL_ERRNO
+#define INTERNAL_SYSCALL_ERRNO(val, err)        (-(val))
+
+#define DECLARGS_0()
+#define DECLARGS_1(arg1) \
+	register unsigned long gpr2 __asm__ ("2") = (unsigned long)(arg1);
+#define DECLARGS_2(arg1, arg2) \
+	DECLARGS_1(arg1) \
+	register unsigned long gpr3 __asm__ ("3") = (unsigned long)(arg2);
+#define DECLARGS_3(arg1, arg2, arg3) \
+	DECLARGS_2(arg1, arg2) \
+	register unsigned long gpr4 __asm__ ("4") = (unsigned long)(arg3);
+#define DECLARGS_4(arg1, arg2, arg3, arg4) \
+	DECLARGS_3(arg1, arg2, arg3) \
+	register unsigned long gpr5 __asm__ ("5") = (unsigned long)(arg4);
+#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
+	DECLARGS_4(arg1, arg2, arg3, arg4) \
+	register unsigned long gpr6 __asm__ ("6") = (unsigned long)(arg5);
+#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
+	DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
+	register unsigned long gpr7 __asm__ ("7") = (unsigned long)(arg6);
+
+#define ASMFMT_0
+#define ASMFMT_1 , "0" (gpr2)
+#define ASMFMT_2 , "0" (gpr2), "d" (gpr3)
+#define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4)
+#define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
+#define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6)
+#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7)
+
+#define SINGLE_THREAD_BY_GLOBAL		1
+
+
 #define VDSO_NAME  "LINUX_2.6.29"
 #define VDSO_HASH  123718585
 
@@ -29,3 +129,5 @@ 
 #endif
 #define HAVE_GETTIMEOFDAY_VSYSCALL	"__kernel_gettimeofday"
 #define HAVE_GETCPU_VSYSCALL		"__kernel_getcpu"
+
+#endif