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