1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-or-later
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * MIPS64 and compat userspace implementations of gettimeofday()
4*4882a593Smuzhiyun * and similar.
5*4882a593Smuzhiyun *
6*4882a593Smuzhiyun * Copyright (C) 2015 Imagination Technologies
7*4882a593Smuzhiyun * Copyright (C) 2018 ARM Limited
8*4882a593Smuzhiyun *
9*4882a593Smuzhiyun */
10*4882a593Smuzhiyun #include <linux/time.h>
11*4882a593Smuzhiyun #include <linux/types.h>
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun #if _MIPS_SIM != _MIPS_SIM_ABI64
__vdso_clock_gettime(clockid_t clock,struct old_timespec32 * ts)14*4882a593Smuzhiyun int __vdso_clock_gettime(clockid_t clock,
15*4882a593Smuzhiyun struct old_timespec32 *ts)
16*4882a593Smuzhiyun {
17*4882a593Smuzhiyun return __cvdso_clock_gettime32(clock, ts);
18*4882a593Smuzhiyun }
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun #ifdef CONFIG_MIPS_CLOCK_VSYSCALL
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun /*
23*4882a593Smuzhiyun * This is behind the ifdef so that we don't provide the symbol when there's no
24*4882a593Smuzhiyun * possibility of there being a usable clocksource, because there's nothing we
25*4882a593Smuzhiyun * can do without it. When libc fails the symbol lookup it should fall back on
26*4882a593Smuzhiyun * the standard syscall path.
27*4882a593Smuzhiyun */
__vdso_gettimeofday(struct __kernel_old_timeval * tv,struct timezone * tz)28*4882a593Smuzhiyun int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
29*4882a593Smuzhiyun struct timezone *tz)
30*4882a593Smuzhiyun {
31*4882a593Smuzhiyun return __cvdso_gettimeofday(tv, tz);
32*4882a593Smuzhiyun }
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun #endif /* CONFIG_MIPS_CLOCK_VSYSCALL */
35*4882a593Smuzhiyun
__vdso_clock_getres(clockid_t clock_id,struct old_timespec32 * res)36*4882a593Smuzhiyun int __vdso_clock_getres(clockid_t clock_id,
37*4882a593Smuzhiyun struct old_timespec32 *res)
38*4882a593Smuzhiyun {
39*4882a593Smuzhiyun return __cvdso_clock_getres_time32(clock_id, res);
40*4882a593Smuzhiyun }
41*4882a593Smuzhiyun
__vdso_clock_gettime64(clockid_t clock,struct __kernel_timespec * ts)42*4882a593Smuzhiyun int __vdso_clock_gettime64(clockid_t clock,
43*4882a593Smuzhiyun struct __kernel_timespec *ts)
44*4882a593Smuzhiyun {
45*4882a593Smuzhiyun return __cvdso_clock_gettime(clock, ts);
46*4882a593Smuzhiyun }
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun #else
49*4882a593Smuzhiyun
__vdso_clock_gettime(clockid_t clock,struct __kernel_timespec * ts)50*4882a593Smuzhiyun int __vdso_clock_gettime(clockid_t clock,
51*4882a593Smuzhiyun struct __kernel_timespec *ts)
52*4882a593Smuzhiyun {
53*4882a593Smuzhiyun return __cvdso_clock_gettime(clock, ts);
54*4882a593Smuzhiyun }
55*4882a593Smuzhiyun
56*4882a593Smuzhiyun #ifdef CONFIG_MIPS_CLOCK_VSYSCALL
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun /*
59*4882a593Smuzhiyun * This is behind the ifdef so that we don't provide the symbol when there's no
60*4882a593Smuzhiyun * possibility of there being a usable clocksource, because there's nothing we
61*4882a593Smuzhiyun * can do without it. When libc fails the symbol lookup it should fall back on
62*4882a593Smuzhiyun * the standard syscall path.
63*4882a593Smuzhiyun */
__vdso_gettimeofday(struct __kernel_old_timeval * tv,struct timezone * tz)64*4882a593Smuzhiyun int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
65*4882a593Smuzhiyun struct timezone *tz)
66*4882a593Smuzhiyun {
67*4882a593Smuzhiyun return __cvdso_gettimeofday(tv, tz);
68*4882a593Smuzhiyun }
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun #endif /* CONFIG_MIPS_CLOCK_VSYSCALL */
71*4882a593Smuzhiyun
__vdso_clock_getres(clockid_t clock_id,struct __kernel_timespec * res)72*4882a593Smuzhiyun int __vdso_clock_getres(clockid_t clock_id,
73*4882a593Smuzhiyun struct __kernel_timespec *res)
74*4882a593Smuzhiyun {
75*4882a593Smuzhiyun return __cvdso_clock_getres(clock_id, res);
76*4882a593Smuzhiyun }
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun #endif
79