diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/init-first.c | 12 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S | 7 |
2 files changed, 17 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c index ead7dbcc38..23934fc857 100644 --- a/sysdeps/unix/sysv/linux/x86_64/init-first.c +++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2007 Free Software Foundation, Inc. +/* Copyright (C) 2007, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,6 +26,8 @@ long int (*__vdso_clock_gettime) (clockid_t, struct timespec *) __attribute__ ((nocommon)); strong_alias (__vdso_clock_gettime, __GI___vdso_clock_gettime attribute_hidden) +long int (*__vdso_getcpu) (unsigned *, unsigned *, void *); + static inline void _libc_vdso_platform_setup (void) @@ -43,6 +45,14 @@ _libc_vdso_platform_setup (void) p = _dl_vdso_vsym ("clock_gettime", &linux26); PTR_MANGLE (p); __GI___vdso_clock_gettime = p; + + p = _dl_vdso_vsym ("getcpu", &linux26); + /* If the vDSO is not available we fall back on the old vsyscall. */ +#define VSYSCALL_ADDR_vgetcpu 0xffffffffff600800 + if (p == NULL) + p = (void *) VSYSCALL_ADDR_vgetcpu; + PTR_MANGLE (p); + __vdso_getcpu = p; } # define VDSO_SETUP _libc_vdso_platform_setup diff --git a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S index a950990627..8ec7d3fcd2 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S +++ b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2007 Free Software Foundation, Inc. +/* Copyright (C) 2007, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -35,7 +35,12 @@ ENTRY (sched_getcpu) movl $VGETCPU_CACHE_OFFSET, %edx addq %fs:0, %rdx +#ifdef SHARED + movq __vdso_getcpu(%rip), %rax + PTR_DEMANGLE (%rax) +#else movq $VSYSCALL_ADDR_vgetcpu, %rax +#endif callq *%rax cmpq $-4095, %rax |