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)
25 : "0" (__NR_clock_gettime), "D" (clock), "S" (ts)
26 : "rcx", "r11", "memory");
30 int clock_gettime(clockid_t, struct timespec *)
31 __attribute__((weak, alias("__vdso_clock_gettime")));
33 int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
39 : "0" (__NR_gettimeofday), "D" (tv), "S" (tz)
40 : "rcx", "r11", "memory");
44 int gettimeofday(struct timeval *, struct timezone *)
45 __attribute__((weak, alias("__vdso_gettimeofday")));
47 time_t __vdso_time(time_t *t)
51 asm volatile("syscall"
53 : "0" (__NR_time), "D" (t) : "cc", "r11", "cx", "memory");
57 int time(time_t *t) __attribute__((weak, alias("__vdso_time")));
60 __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
63 * UML does not support SMP, we can cheat here. :)
74 long getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
75 __attribute__((weak, alias("__vdso_getcpu")));