public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] i686: Add INTERNAL_SYSCALL_NCS 6 argument support
@ 2020-04-17 16:40 Adhemerval Zanella
  0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2020-04-17 16:40 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4b850b1f29648f666a2fa8ceed639132830e169c

commit 4b850b1f29648f666a2fa8ceed639132830e169c
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Mon Apr 6 14:20:32 2020 -0300

    i686: Add INTERNAL_SYSCALL_NCS 6 argument support
    
    It is required for i686 BZ#12683 support when building with -Os
    or -fno-omit-frame-pointer on some gcc versions.  It is not used
    on current code.
    
    Check on i686-linux-gnu.

Diff:
---
 sysdeps/unix/sysv/linux/i386/sysdep.h | 79 ++++++++++++++++++++++-------------
 1 file changed, 49 insertions(+), 30 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index f6847a67e3..bfb5de3b45 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -311,11 +311,27 @@ struct libc_do_syscall_args
     INTERNAL_SYSCALL_MAIN_INLINE(name, 4, args)
 #define INTERNAL_SYSCALL_MAIN_5(name, args...) \
     INTERNAL_SYSCALL_MAIN_INLINE(name, 5, args)
+
+#define INTERNAL_SYSCALL_MAIN_NCS_0(name, args...) \
+    INTERNAL_SYSCALL_MAIN_NCS(name, 0, args)
+#define INTERNAL_SYSCALL_MAIN_NCS_1(name, args...) \
+    INTERNAL_SYSCALL_MAIN_NCS(name, 1, args)
+#define INTERNAL_SYSCALL_MAIN_NCS_2(name, args...) \
+    INTERNAL_SYSCALL_MAIN_NCS(name, 2, args)
+#define INTERNAL_SYSCALL_MAIN_NCS_3(name, args...) \
+    INTERNAL_SYSCALL_MAIN_NCS(name, 3, args)
+#define INTERNAL_SYSCALL_MAIN_NCS_4(name, args...) \
+    INTERNAL_SYSCALL_MAIN_NCS(name, 4, args)
+#define INTERNAL_SYSCALL_MAIN_NCS_5(name, args...) \
+    INTERNAL_SYSCALL_MAIN_NCS(name, 5, args)
+
 /* Each object using 6-argument inline syscalls must include a
    definition of __libc_do_syscall.  */
 #ifdef OPTIMIZE_FOR_GCC_5
 # define INTERNAL_SYSCALL_MAIN_6(name, args...) \
     INTERNAL_SYSCALL_MAIN_INLINE(name, 6, args)
+# define INTERNAL_SYSCALL_MAIN_NCS_6(name, args...) \
+    INTERNAL_SYSCALL_MAIN_NCS(name, 6, args)
 #else /* GCC 5  */
 # define INTERNAL_SYSCALL_MAIN_6(name, arg1, arg2, arg3,		\
 				 arg4, arg5, arg6)			\
@@ -331,12 +347,33 @@ struct libc_do_syscall_args
     : "=a" (resultvar)							\
     : "i" (__NR_##name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \
     : "memory", "cc")
+# define INTERNAL_SYSCALL_MAIN_NCS_6(name, arg1, arg2, arg3,		\
+				     arg4, arg5, arg6)			\
+  struct libc_do_syscall_args _xv =					\
+    {									\
+      (int) (arg1),							\
+      (int) (arg5),							\
+      (int) (arg6)							\
+    };									\
+    asm volatile (							\
+    "movl %1, %%eax\n\t"						\
+    "call __libc_do_syscall"						\
+    : "=a" (resultvar)							\
+    : "a" (name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv)	\
+    : "memory", "cc")
 #endif /* GCC 5  */
+
 #define INTERNAL_SYSCALL(name, nr, args...) \
   ({									      \
     register unsigned int resultvar;					      \
     INTERNAL_SYSCALL_MAIN_##nr (name, args);			      	      \
     (int) resultvar; })
+#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
+  ({									      \
+    register unsigned int resultvar;					      \
+    INTERNAL_SYSCALL_MAIN_NCS_##nr (name, args);		      	      \
+    (int) resultvar; })
+
 #if I386_USE_SYSENTER
 # ifdef OPTIMIZE_FOR_GCC_5
 #  ifdef PIC
@@ -347,16 +384,13 @@ struct libc_do_syscall_args
     : "=a" (resultvar)							\
     : "a" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo))		\
       ASMARGS_##nr(args) : "memory", "cc")
-#   define INTERNAL_SYSCALL_NCS(name, nr, args...) \
-  ({									\
-    register unsigned int resultvar;					\
+#   define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
     LOADREGS_##nr(args)							\
     asm volatile (							\
     "call *%%gs:%P2"							\
     : "=a" (resultvar)							\
     : "a" (name), "i" (offsetof (tcbhead_t, sysinfo))			\
-      ASMARGS_##nr(args) : "memory", "cc");				\
-    (int) resultvar; })
+      ASMARGS_##nr(args) : "memory", "cc")
 #  else
 #   define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
     LOADREGS_##nr(args)							\
@@ -364,15 +398,12 @@ struct libc_do_syscall_args
     "call *_dl_sysinfo"							\
     : "=a" (resultvar)							\
     : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc")
-#   define INTERNAL_SYSCALL_NCS(name, nr, args...) \
-  ({									\
-    register unsigned int resultvar;					\
+#   define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
     LOADREGS_##nr(args)							\
     asm volatile (							\
     "call *_dl_sysinfo"							\
     : "=a" (resultvar)							\
-    : "a" (name) ASMARGS_##nr(args) : "memory", "cc");			\
-    (int) resultvar; })
+    : "a" (name) ASMARGS_##nr(args) : "memory", "cc")
 #  endif
 # else /* GCC 5  */
 #  ifdef PIC
@@ -386,9 +417,7 @@ struct libc_do_syscall_args
     : "=a" (resultvar)							      \
     : "i" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo))		      \
       ASMFMT_##nr(args) : "memory", "cc")
-#   define INTERNAL_SYSCALL_NCS(name, nr, args...) \
-  ({									      \
-    register unsigned int resultvar;					      \
+#   define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
     EXTRAVAR_##nr							      \
     asm volatile (							      \
     LOADARGS_##nr							      \
@@ -396,8 +425,7 @@ struct libc_do_syscall_args
     RESTOREARGS_##nr							      \
     : "=a" (resultvar)							      \
     : "0" (name), "i" (offsetof (tcbhead_t, sysinfo))			      \
-      ASMFMT_##nr(args) : "memory", "cc");				      \
-    (int) resultvar; })
+      ASMFMT_##nr(args) : "memory", "cc")
 #  else
 #   define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
     EXTRAVAR_##nr							      \
@@ -408,17 +436,14 @@ struct libc_do_syscall_args
     RESTOREARGS_##nr							      \
     : "=a" (resultvar)							      \
     : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc")
-#   define INTERNAL_SYSCALL_NCS(name, nr, args...) \
-  ({									      \
-    register unsigned int resultvar;					      \
+#   define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
     EXTRAVAR_##nr							      \
     asm volatile (							      \
     LOADARGS_##nr							      \
     "call *_dl_sysinfo\n\t"						      \
     RESTOREARGS_##nr							      \
     : "=a" (resultvar)							      \
-    : "0" (name) ASMFMT_##nr(args) : "memory", "cc");			      \
-    (int) resultvar; })
+    : "0" (name) ASMFMT_##nr(args) : "memory", "cc")
 #  endif
 # endif /* GCC 5  */
 #else
@@ -429,15 +454,12 @@ struct libc_do_syscall_args
     "int $0x80"								\
     : "=a" (resultvar)							\
     : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc")
-#  define INTERNAL_SYSCALL_NCS(name, nr, args...) \
-  ({									\
-    register unsigned int resultvar;					\
+#  define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
     LOADREGS_##nr(args)							\
     asm volatile (							\
     "int $0x80"								\
     : "=a" (resultvar)							\
-    : "a" (name) ASMARGS_##nr(args) : "memory", "cc");			\
-    (int) resultvar; })
+    : "a" (name) ASMARGS_##nr(args) : "memory", "cc")
 # else /* GCC 5  */
 #  define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
     EXTRAVAR_##nr							      \
@@ -448,17 +470,14 @@ struct libc_do_syscall_args
     RESTOREARGS_##nr							      \
     : "=a" (resultvar)							      \
     : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc")
-#  define INTERNAL_SYSCALL_NCS(name, nr, args...) \
-  ({									      \
-    register unsigned int resultvar;					      \
+#  define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
     EXTRAVAR_##nr							      \
     asm volatile (							      \
     LOADARGS_##nr							      \
     "int $0x80\n\t"							      \
     RESTOREARGS_##nr							      \
     : "=a" (resultvar)							      \
-    : "0" (name) ASMFMT_##nr(args) : "memory", "cc");			      \
-    (int) resultvar; })
+    : "0" (name) ASMFMT_##nr(args) : "memory", "cc")
 # endif /* GCC 5  */
 #endif


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-17 16:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-17 16:40 [glibc] i686: Add INTERNAL_SYSCALL_NCS 6 argument support Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).