xref: /linux/arch/s390/include/asm/vdso/gettimeofday.h (revision 746680ec6696585e30db3e18c93a63df9cbec39c)
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 	return get_tod_clock() - vd->arch_data.tod_delta;
20 }
21 
22 static __always_inline
23 long clock_gettime_fallback(clockid_t clkid, struct __kernel_timespec *ts)
24 {
25 	return syscall2(__NR_clock_gettime, (long)clkid, (long)ts);
26 }
27 
28 static __always_inline
29 long gettimeofday_fallback(register struct __kernel_old_timeval *tv,
30 			   register struct timezone *tz)
31 {
32 	return syscall2(__NR_gettimeofday, (long)tv, (long)tz);
33 }
34 
35 static __always_inline
36 long clock_getres_fallback(clockid_t clkid, struct __kernel_timespec *ts)
37 {
38 	return syscall2(__NR_clock_getres, (long)clkid, (long)ts);
39 }
40 
41 #endif
42