From ef60624956e93df1da329a48570776ed963b1916 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 6 Sep 2011 00:12:18 -0400 Subject: Prefer real syscalls instead of vsyscalls on x86-64 outside libc.so --- sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S') diff --git a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S index 8ec7d3fcd2..246c955042 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S +++ b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S @@ -20,6 +20,7 @@ #include #define _ERRNO_H 1 #include +#include /* For the calculation see asm/vsyscall.h. */ #define VSYSCALL_ADDR_vgetcpu 0xffffffffff600800 @@ -38,10 +39,26 @@ ENTRY (sched_getcpu) #ifdef SHARED movq __vdso_getcpu(%rip), %rax PTR_DEMANGLE (%rax) + callq *%rax #else +# ifdef __NR_getcpu + movl $__NR_getcpu, %eax + syscall +# ifndef __ASSUME_GETCPU_SYSCALL + cmpq $-ENOSYS, %rax + jne 1f +# endif +# endif +# ifndef __ASSUME_GETCPU_SYSCALL movq $VSYSCALL_ADDR_vgetcpu, %rax -#endif callq *%rax +1: +# else +# ifndef __NR_getcpu +# error "cannot happen" +# endif +# endif +#endif cmpq $-4095, %rax jae SYSCALL_ERROR_LABEL -- cgit 1.4.1