WIP FPC-III support
[linux/fpc-iii.git] / arch / x86 / um / vdso / um_vdso.c
blob2112b8d146688834897dde9595af02ac89d2c327
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (C) 2011 Richard Weinberger <richrd@nod.at>
5 * This vDSO turns all calls into a syscall so that UML can trap them.
6 */
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 int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts)
18 long ret;
20 asm("syscall" : "=a" (ret) :
21 "0" (__NR_clock_gettime), "D" (clock), "S" (ts) : "memory");
23 return ret;
25 int clock_gettime(clockid_t, struct __kernel_old_timespec *)
26 __attribute__((weak, alias("__vdso_clock_gettime")));
28 int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
30 long ret;
32 asm("syscall" : "=a" (ret) :
33 "0" (__NR_gettimeofday), "D" (tv), "S" (tz) : "memory");
35 return ret;
37 int gettimeofday(struct __kernel_old_timeval *, struct timezone *)
38 __attribute__((weak, alias("__vdso_gettimeofday")));
40 __kernel_old_time_t __vdso_time(__kernel_old_time_t *t)
42 long secs;
44 asm volatile("syscall"
45 : "=a" (secs)
46 : "0" (__NR_time), "D" (t) : "cc", "r11", "cx", "memory");
48 return secs;
50 __kernel_old_time_t time(__kernel_old_time_t *t) __attribute__((weak, alias("__vdso_time")));
52 long
53 __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
56 * UML does not support SMP, we can cheat here. :)
59 if (cpu)
60 *cpu = 0;
61 if (node)
62 *node = 0;
64 return 0;
67 long getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
68 __attribute__((weak, alias("__vdso_getcpu")));