2 * Copyright (C) 2011 Richard Weinberger <richrd@nod.at>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * This vDSO turns all calls into a syscall so that UML can trap them.
12 /* Disable profiling for userspace code */
13 #define DISABLE_BRANCH_PROFILING
15 #include <linux/time.h>
16 #include <linux/getcpu.h>
17 #include <asm/unistd.h>
19 int __vdso_clock_gettime(clockid_t clock
, struct timespec
*ts
)
23 asm("syscall" : "=a" (ret
) :
24 "0" (__NR_clock_gettime
), "D" (clock
), "S" (ts
) : "memory");
28 int clock_gettime(clockid_t
, struct timespec
*)
29 __attribute__((weak
, alias("__vdso_clock_gettime")));
31 int __vdso_gettimeofday(struct timeval
*tv
, struct timezone
*tz
)
35 asm("syscall" : "=a" (ret
) :
36 "0" (__NR_gettimeofday
), "D" (tv
), "S" (tz
) : "memory");
40 int gettimeofday(struct timeval
*, struct timezone
*)
41 __attribute__((weak
, alias("__vdso_gettimeofday")));
43 time_t __vdso_time(time_t *t
)
47 asm volatile("syscall"
49 : "0" (__NR_time
), "D" (t
) : "cc", "r11", "cx", "memory");
53 int time(time_t *t
) __attribute__((weak
, alias("__vdso_time")));
56 __vdso_getcpu(unsigned *cpu
, unsigned *node
, struct getcpu_cache
*unused
)
59 * UML does not support SMP, we can cheat here. :)
70 long getcpu(unsigned *cpu
, unsigned *node
, struct getcpu_cache
*tcache
)
71 __attribute__((weak
, alias("__vdso_getcpu")));