Greg Kroah-Hartman | a17ae4c | 2017-11-24 15:00:32 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Userland implementation of clock_getres() for 32 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) |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 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 |
Martin Schwidefsky | b7eacb5 | 2014-08-29 12:31:45 +0200 | [diff] [blame] | 19 | basr %r1,0 |
| 20 | la %r1,4f-.(%r1) |
Heiko Carstens | b342398 | 2010-10-29 16:50:41 +0200 | [diff] [blame] | 21 | chi %r2,__CLOCK_REALTIME |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 22 | je 0f |
Heiko Carstens | b342398 | 2010-10-29 16:50:41 +0200 | [diff] [blame] | 23 | chi %r2,__CLOCK_MONOTONIC |
Martin Schwidefsky | b7eacb5 | 2014-08-29 12:31:45 +0200 | [diff] [blame] | 24 | je 0f |
| 25 | la %r1,5f-4f(%r1) |
| 26 | chi %r2,__CLOCK_REALTIME_COARSE |
| 27 | je 0f |
| 28 | chi %r2,__CLOCK_MONOTONIC_COARSE |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 29 | jne 3f |
| 30 | 0: ltr %r3,%r3 |
| 31 | jz 2f /* res == NULL */ |
Martin Schwidefsky | b7eacb5 | 2014-08-29 12:31:45 +0200 | [diff] [blame] | 32 | 1: l %r0,0(%r1) |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 33 | xc 0(4,%r3),0(%r3) /* set tp->tv_sec to zero */ |
| 34 | st %r0,4(%r3) /* store tp->tv_usec */ |
| 35 | 2: lhi %r2,0 |
| 36 | br %r14 |
| 37 | 3: lhi %r1,__NR_clock_getres /* fallback to svc */ |
| 38 | svc 0 |
| 39 | br %r14 |
Heiko Carstens | b342398 | 2010-10-29 16:50:41 +0200 | [diff] [blame] | 40 | 4: .long __CLOCK_REALTIME_RES |
Martin Schwidefsky | b7eacb5 | 2014-08-29 12:31:45 +0200 | [diff] [blame] | 41 | 5: .long __CLOCK_COARSE_RES |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 42 | .cfi_endproc |
| 43 | .size __kernel_clock_getres,.-__kernel_clock_getres |