about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/x86_64
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.com>2015-04-17 10:58:31 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2015-05-26 10:10:36 -0300
commitf534255e4d276ee7b20b45637d16a00b122e5df3 (patch)
treeabbedc3d05bdfb526d0171fccd87fb84ecb1acd9 /sysdeps/unix/sysv/linux/x86_64
parent829a679fac1fe173e81cb2c08204d2da86cf3f3a (diff)
downloadglibc-f534255e4d276ee7b20b45637d16a00b122e5df3.tar.gz
glibc-f534255e4d276ee7b20b45637d16a00b122e5df3.tar.xz
glibc-f534255e4d276ee7b20b45637d16a00b122e5df3.zip
Consolidate vDSO macros and usage
This patch consolidate the Linux vDSO define and usage across all ports
that uses it.  The common vDSO definitions and calling through
{INLINE/INTERNAL}_VSYSCALL macros are moved to a common header
sysdep-vdso.h and vDSO name declaration and prototype is defined
using a common macro.

Also PTR_{MANGLE,DEMANGLE} is added to ports that does not use them
for vDSO calls (aarch64, powerpc, s390, and tile) and thus it will
reflect in code changes.  For ports that already implement pointer
mangling/demangling in vDSO system (i386, x32, x86_64) this patch
is mainly a code refactor.

Checked on x32, x86_64, x32, ppc64le, and aarch64.
Diffstat (limited to 'sysdeps/unix/sysv/linux/x86_64')
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/init-first.c9
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysdep.h55
2 files changed, 5 insertions, 59 deletions
diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c
index 25c38e4a8d..b7bdbd17ba 100644
--- a/sysdeps/unix/sysv/linux/x86_64/init-first.c
+++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c
@@ -22,9 +22,10 @@
 # include <dl-vdso.h>
 # include <libc-vdso.h>
 
-long int (*__vdso_clock_gettime) (clockid_t, struct timespec *)
+long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
+  attribute_hidden;
+long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *)
   attribute_hidden;
-long int (*__vdso_getcpu) (unsigned *, unsigned *, void *) attribute_hidden;
 
 extern long int __syscall_clock_gettime (clockid_t, struct timespec *);
 
@@ -38,7 +39,7 @@ __vdso_platform_setup (void)
   if (p == NULL)
     p = __syscall_clock_gettime;
   PTR_MANGLE (p);
-  __vdso_clock_gettime = p;
+  VDSO_SYMBOL(clock_gettime) = p;
 
   p = _dl_vdso_vsym ("__vdso_getcpu", &linux26);
   /* If the vDSO is not available we fall back on the old vsyscall.  */
@@ -46,7 +47,7 @@ __vdso_platform_setup (void)
   if (p == NULL)
     p = (void *) VSYSCALL_ADDR_vgetcpu;
   PTR_MANGLE (p);
-  __vdso_getcpu = p;
+  VDSO_SYMBOL(getcpu) = p;
 }
 
 # define VDSO_SETUP __vdso_platform_setup
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index 3dbd7d2be4..cc6609347e 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -252,61 +252,6 @@
 # undef INTERNAL_SYSCALL_ERRNO
 # define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val))
 
-# ifdef SHARED
-#  define INLINE_VSYSCALL(name, nr, args...) \
-  ({									      \
-    __label__ out;							      \
-    __label__ iserr;							      \
-    INTERNAL_SYSCALL_DECL (sc_err);					      \
-    long int sc_ret;							      \
-									      \
-    __typeof (__vdso_##name) vdsop = __vdso_##name;			      \
-    PTR_DEMANGLE (vdsop);						      \
-    if (vdsop != NULL)							      \
-      {									      \
-	sc_ret = vdsop (args);						      \
-	if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err))			      \
-	  goto out;							      \
-	if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS)		      \
-	  goto iserr;							      \
-      }									      \
-									      \
-    sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args);		      \
-    if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err))			      \
-      {									      \
-      iserr:								      \
-	__set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err));		      \
-	sc_ret = -1L;							      \
-      }									      \
-  out:									      \
-    sc_ret;								      \
-  })
-#  define INTERNAL_VSYSCALL(name, err, nr, args...) \
-  ({									      \
-    __label__ out;							      \
-    long int v_ret;							      \
-									      \
-    __typeof (__vdso_##name) vdsop = __vdso_##name;			      \
-    PTR_DEMANGLE (vdsop);						      \
-    if (vdsop != NULL)							      \
-      {									      \
-	v_ret = vdsop (args);						      \
-	if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err)			      \
-	    || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS)		      \
-	  goto out;							      \
-      }									      \
-    v_ret = INTERNAL_SYSCALL (name, err, nr, ##args);			      \
-  out:									      \
-    v_ret;								      \
-  })
-
-# else
-#  define INLINE_VSYSCALL(name, nr, args...) \
-  INLINE_SYSCALL (name, nr, ##args)
-#  define INTERNAL_VSYSCALL(name, err, nr, args...) \
-  INTERNAL_SYSCALL (name, err, nr, ##args)
-# endif
-
 # define LOAD_ARGS_0()
 # define LOAD_REGS_0
 # define ASM_ARGS_0