1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef ASM_VDSO_GETTIMEOFDAY_H 3 #define ASM_VDSO_GETTIMEOFDAY_H 4 5 #define VDSO_HAS_TIME 1 6 7 #define VDSO_HAS_CLOCK_GETRES 1 8 9 #define VDSO_DELTA_NOMASK 1 10 11 #include <asm/syscall.h> 12 #include <asm/timex.h> 13 #include <asm/unistd.h> 14 #include <linux/compiler.h> 15 16 17 static inline u64 __arch_get_hw_counter(s32 clock_mode, const struct vdso_time_data *vd) 18 { 19 u64 adj, now; 20 21 now = get_tod_clock(); 22 adj = vd->arch_data.tod_steering_end - now; 23 if (unlikely((s64) adj > 0)) 24 now += (vd->arch_data.tod_steering_delta < 0) ? (adj >> 15) : -(adj >> 15); 25 return now; 26 } 27 28 static __always_inline 29 long clock_gettime_fallback(clockid_t clkid, struct __kernel_timespec *ts) 30 { 31 return syscall2(__NR_clock_gettime, (long)clkid, (long)ts); 32 } 33 34 static __always_inline 35 long gettimeofday_fallback(register struct __kernel_old_timeval *tv, 36 register struct timezone *tz) 37 { 38 return syscall2(__NR_gettimeofday, (long)tv, (long)tz); 39 } 40 41 static __always_inline 42 long clock_getres_fallback(clockid_t clkid, struct __kernel_timespec *ts) 43 { 44 return syscall2(__NR_clock_getres, (long)clkid, (long)ts); 45 } 46 47 #endif 48