1 // SPDX-License-Identifier: GPL-2.0-only
5 * This vDSO turns all calls into a syscall so that UML can trap them.
9 /* Disable profiling for userspace code */
10 #define DISABLE_BRANCH_PROFILING
12 #include <linux/time.h>
13 #include <linux/getcpu.h>
14 #include <asm/unistd.h>
16 /* workaround for -Wmissing-prototypes warnings */
17 int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts);
18 int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz);
19 __kernel_old_time_t __vdso_time(__kernel_old_time_t *t);
20 long __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused);
22 int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts)
28 : "0" (__NR_clock_gettime), "D" (clock), "S" (ts)
29 : "rcx", "r11", "memory");
33 int clock_gettime(clockid_t, struct __kernel_old_timespec *)
34 __attribute__((weak, alias("__vdso_clock_gettime")));
36 int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
42 : "0" (__NR_gettimeofday), "D" (tv), "S" (tz)
43 : "rcx", "r11", "memory");
47 int gettimeofday(struct __kernel_old_timeval *, struct timezone *)
48 __attribute__((weak, alias("__vdso_gettimeofday")));
50 __kernel_old_time_t __vdso_time(__kernel_old_time_t *t)
54 asm volatile("syscall"
56 : "0" (__NR_time), "D" (t) : "cc", "r11", "cx", "memory");
60 __kernel_old_time_t time(__kernel_old_time_t *t) __attribute__((weak, alias("__vdso_time")));
63 __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused)
66 * UML does not support SMP, we can cheat here. :)
77 long getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *tcache)
78 __attribute__((weak, alias("__vdso_getcpu")));