Merge remote-tracking branches 'asoc/topic/max98373', 'asoc/topic/mtk', 'asoc/topic...
[linux-2.6-microblaze.git] / arch / s390 / kernel / vdso64 / clock_getres.S
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Userland implementation of clock_getres() for 64 bits processes in a
4  * s390 kernel for use in the vDSO
5  *
6  *  Copyright IBM Corp. 2008
7  *  Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
8  */
9 #include <asm/vdso.h>
10 #include <asm/asm-offsets.h>
11 #include <asm/unistd.h>
12
13         .text
14         .align 4
15         .globl __kernel_clock_getres
16         .type  __kernel_clock_getres,@function
17 __kernel_clock_getres:
18         .cfi_startproc
19         larl    %r1,4f
20         cghi    %r2,__CLOCK_REALTIME_COARSE
21         je      0f
22         cghi    %r2,__CLOCK_MONOTONIC_COARSE
23         je      0f
24         larl    %r1,3f
25         cghi    %r2,__CLOCK_REALTIME
26         je      0f
27         cghi    %r2,__CLOCK_MONOTONIC
28         je      0f
29         cghi    %r2,__CLOCK_THREAD_CPUTIME_ID
30         je      0f
31         cghi    %r2,-2          /* Per-thread CPUCLOCK with PID=0, VIRT=1 */
32         jne     2f
33         larl    %r5,_vdso_data
34         icm     %r0,15,__LC_ECTG_OK(%r5)
35         jz      2f
36 0:      ltgr    %r3,%r3
37         jz      1f                              /* res == NULL */
38         lg      %r0,0(%r1)
39         xc      0(8,%r3),0(%r3)                 /* set tp->tv_sec to zero */
40         stg     %r0,8(%r3)                      /* store tp->tv_usec */
41 1:      lghi    %r2,0
42         br      %r14
43 2:      lghi    %r1,__NR_clock_getres           /* fallback to svc */
44         svc     0
45         br      %r14
46 3:      .quad   __CLOCK_REALTIME_RES
47 4:      .quad   __CLOCK_COARSE_RES
48         .cfi_endproc
49         .size   __kernel_clock_getres,.-__kernel_clock_getres