Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sparc64: vdso: Implement clock_gettime64()

To be y2038-safe, 32-bit userspace needs to explicitly call the 64-bit safe
time APIs.

Implement clock_gettime64() in the 32-bit vDSO.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Tested-by: Andreas Larsson <andreas@gaisler.com>
Reviewed-by: Andreas Larsson <andreas@gaisler.com>
Acked-by: Andreas Larsson <andreas@gaisler.com>
Link: https://patch.msgid.link/20260304-vdso-sparc64-generic-2-v6-13-d8eb3b0e1410@linutronix.de

authored by

Thomas Weißschuh and committed by
Thomas Gleixner
1628f6a7 168d23e5

+28 -2
+18 -2
arch/sparc/include/asm/vdso/gettimeofday.h
··· 101 101 "f48", "f50", "f52", "f54", "f56", "f58", "f60", "f62", \ 102 102 "cc", "memory" 103 103 104 + #ifdef CONFIG_SPARC64 105 + 104 106 static __always_inline 105 107 long clock_gettime_fallback(clockid_t clock, struct __kernel_timespec *ts) 106 108 { ··· 115 113 return o0; 116 114 } 117 115 118 - #ifndef CONFIG_SPARC64 116 + #else /* !CONFIG_SPARC64 */ 117 + 118 + static __always_inline 119 + long clock_gettime_fallback(clockid_t clock, struct __kernel_timespec *ts) 120 + { 121 + register long num __asm__("g1") = __NR_clock_gettime64; 122 + register long o0 __asm__("o0") = clock; 123 + register long o1 __asm__("o1") = (long) ts; 124 + 125 + __asm__ __volatile__(SYSCALL_STRING : "=r" (o0) : "r" (num), 126 + "0" (o0), "r" (o1) : SYSCALL_CLOBBERS); 127 + return o0; 128 + } 129 + 119 130 static __always_inline 120 131 long clock_gettime32_fallback(clockid_t clock, struct old_timespec32 *ts) 121 132 { ··· 140 125 "0" (o0), "r" (o1) : SYSCALL_CLOBBERS); 141 126 return o0; 142 127 } 143 - #endif 128 + 129 + #endif /* CONFIG_SPARC64 */ 144 130 145 131 static __always_inline 146 132 long gettimeofday_fallback(struct __kernel_old_timeval *tv, struct timezone *tz)
+8
arch/sparc/vdso/vclock_gettime.c
··· 48 48 int clock_gettime(clockid_t, struct old_timespec32 *) 49 49 __weak __alias(__vdso_clock_gettime); 50 50 51 + int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts) 52 + { 53 + return __cvdso_clock_gettime(clock, ts); 54 + } 55 + 56 + int clock_gettime64(clockid_t, struct __kernel_timespec *) 57 + __weak __alias(__vdso_clock_gettime64); 58 + 51 59 #endif
+2
arch/sparc/vdso/vdso32/vdso32.lds.S
··· 17 17 global: 18 18 clock_gettime; 19 19 __vdso_clock_gettime; 20 + clock_gettime64; 21 + __vdso_clock_gettime64; 20 22 gettimeofday; 21 23 __vdso_gettimeofday; 22 24 local: *;