18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * MIPS64 and compat userspace implementations of gettimeofday() 48c2ecf20Sopenharmony_ci * and similar. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 2015 Imagination Technologies 78c2ecf20Sopenharmony_ci * Copyright (C) 2018 ARM Limited 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci#include <linux/time.h> 118c2ecf20Sopenharmony_ci#include <linux/types.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#if _MIPS_SIM != _MIPS_SIM_ABI64 148c2ecf20Sopenharmony_ciint __vdso_clock_gettime(clockid_t clock, 158c2ecf20Sopenharmony_ci struct old_timespec32 *ts) 168c2ecf20Sopenharmony_ci{ 178c2ecf20Sopenharmony_ci return __cvdso_clock_gettime32(clock, ts); 188c2ecf20Sopenharmony_ci} 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#ifdef CONFIG_MIPS_CLOCK_VSYSCALL 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* 238c2ecf20Sopenharmony_ci * This is behind the ifdef so that we don't provide the symbol when there's no 248c2ecf20Sopenharmony_ci * possibility of there being a usable clocksource, because there's nothing we 258c2ecf20Sopenharmony_ci * can do without it. When libc fails the symbol lookup it should fall back on 268c2ecf20Sopenharmony_ci * the standard syscall path. 278c2ecf20Sopenharmony_ci */ 288c2ecf20Sopenharmony_ciint __vdso_gettimeofday(struct __kernel_old_timeval *tv, 298c2ecf20Sopenharmony_ci struct timezone *tz) 308c2ecf20Sopenharmony_ci{ 318c2ecf20Sopenharmony_ci return __cvdso_gettimeofday(tv, tz); 328c2ecf20Sopenharmony_ci} 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */ 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ciint __vdso_clock_getres(clockid_t clock_id, 378c2ecf20Sopenharmony_ci struct old_timespec32 *res) 388c2ecf20Sopenharmony_ci{ 398c2ecf20Sopenharmony_ci return __cvdso_clock_getres_time32(clock_id, res); 408c2ecf20Sopenharmony_ci} 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciint __vdso_clock_gettime64(clockid_t clock, 438c2ecf20Sopenharmony_ci struct __kernel_timespec *ts) 448c2ecf20Sopenharmony_ci{ 458c2ecf20Sopenharmony_ci return __cvdso_clock_gettime(clock, ts); 468c2ecf20Sopenharmony_ci} 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#else 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ciint __vdso_clock_gettime(clockid_t clock, 518c2ecf20Sopenharmony_ci struct __kernel_timespec *ts) 528c2ecf20Sopenharmony_ci{ 538c2ecf20Sopenharmony_ci return __cvdso_clock_gettime(clock, ts); 548c2ecf20Sopenharmony_ci} 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci#ifdef CONFIG_MIPS_CLOCK_VSYSCALL 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci/* 598c2ecf20Sopenharmony_ci * This is behind the ifdef so that we don't provide the symbol when there's no 608c2ecf20Sopenharmony_ci * possibility of there being a usable clocksource, because there's nothing we 618c2ecf20Sopenharmony_ci * can do without it. When libc fails the symbol lookup it should fall back on 628c2ecf20Sopenharmony_ci * the standard syscall path. 638c2ecf20Sopenharmony_ci */ 648c2ecf20Sopenharmony_ciint __vdso_gettimeofday(struct __kernel_old_timeval *tv, 658c2ecf20Sopenharmony_ci struct timezone *tz) 668c2ecf20Sopenharmony_ci{ 678c2ecf20Sopenharmony_ci return __cvdso_gettimeofday(tv, tz); 688c2ecf20Sopenharmony_ci} 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */ 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ciint __vdso_clock_getres(clockid_t clock_id, 738c2ecf20Sopenharmony_ci struct __kernel_timespec *res) 748c2ecf20Sopenharmony_ci{ 758c2ecf20Sopenharmony_ci return __cvdso_clock_getres(clock_id, res); 768c2ecf20Sopenharmony_ci} 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci#endif 79