um: merge arch/um/sys-{i386,x86_64}
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / um / sys-x86 / vdso / um_vdso.c
blob7c441b59d3752e43623d56fb4508a710d8a93d3e
1 /*
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.
9 */
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)
21 long ret;
23 asm("syscall" : "=a" (ret) :
24 "0" (__NR_clock_gettime), "D" (clock), "S" (ts) : "memory");
26 return ret;
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)
33 long ret;
35 asm("syscall" : "=a" (ret) :
36 "0" (__NR_gettimeofday), "D" (tv), "S" (tz) : "memory");
38 return ret;
40 int gettimeofday(struct timeval *, struct timezone *)
41 __attribute__((weak, alias("__vdso_gettimeofday")));
43 time_t __vdso_time(time_t *t)
45 long secs;
47 asm volatile("syscall"
48 : "=a" (secs)
49 : "0" (__NR_time), "D" (t) : "cc", "r11", "cx", "memory");
51 return secs;
53 int time(time_t *t) __attribute__((weak, alias("__vdso_time")));
55 long
56 __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
59 * UML does not support SMP, we can cheat here. :)
62 if (cpu)
63 *cpu = 0;
64 if (node)
65 *node = 0;
67 return 0;
70 long getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
71 __attribute__((weak, alias("__vdso_getcpu")));