+2011-09-06 Ulrich Drepper <drepper@gmail.com>
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: Add entry for getcpu
+ syscall on x86-64.
+ * sysdeps/unix/sysv/linux/x86_64/gettimeofday.c [!SHARED]: Use real
+ syscall.
+ * sysdeps/unix/sysv/linux/x86_64/time.c: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S [!SHARED]: Use real
+ syscall if possible.
+
2011-09-05 Ulrich Drepper <drepper@gmail.com>
* elf/pldd.c (get_process_info): Don't read whole ELF header, just
#if __LINUX_KERNEL_VERSION >= 0x020627
# define __ASSUME_SENDMMSG 1
#endif
+
+/* getcpu is a syscall for x86-64 since 3.1. */
+#if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
+# define __ASSUME_GETCPU_SYSCALL 1
+#endif
__asm (".type __gettimeofday, %gnu_indirect_function");
#else
# include <sys/time.h>
+# include <sysdep.h>
int
__gettimeofday (struct timeval *tv, struct timezone *tz)
{
- return ((int (*) (struct timeval *, struct timezone *)) VSYSCALL_ADDR_vgettimeofday) (tv, tz);
+ return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
}
#endif
#include <tls.h>
#define _ERRNO_H 1
#include <bits/errno.h>
+#include <kernel-features.h>
/* For the calculation see asm/vsyscall.h. */
#define VSYSCALL_ADDR_vgetcpu 0xffffffffff600800
#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
__asm (".type time, %gnu_indirect_function");
#else
# include <time.h>
+# include <sysdep.h>
time_t
time (time_t *t)
{
- return ((time_t (*) (time_t *)) VSYSCALL_ADDR_vtime) (t);
+ INTERNAL_SYSCALL_DECL (err);
+ return INTERNAL_SYSCALL (time, err, 1, t);
}
#endif