1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Userland implementation of clock_getres() for 64 bits processes in a
4 * s390 kernel for use in the vDSO
6 * Copyright IBM Corp. 2008
7 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
10 #include <asm/asm-offsets.h>
11 #include <asm/unistd.h>
15 .globl __kernel_clock_getres
16 .type __kernel_clock_getres,@function
17 __kernel_clock_getres:
20 cghi %r2,__CLOCK_REALTIME_COARSE
22 cghi %r2,__CLOCK_MONOTONIC_COARSE
25 cghi %r2,__CLOCK_REALTIME
27 cghi %r2,__CLOCK_MONOTONIC
29 cghi %r2,__CLOCK_THREAD_CPUTIME_ID
31 cghi %r2,-2 /* Per-thread CPUCLOCK with PID=0, VIRT=1 */
34 icm %r0,15,__LC_ECTG_OK(%r5)
37 jz 1f /* res == NULL */
39 xc 0(8,%r3),0(%r3) /* set tp->tv_sec to zero */
40 stg %r0,8(%r3) /* store tp->tv_usec */
43 2: lghi %r1,__NR_clock_getres /* fallback to svc */
46 3: .quad __CLOCK_REALTIME_RES
47 4: .quad __CLOCK_COARSE_RES
49 .size __kernel_clock_getres,.-__kernel_clock_getres