blob: f61df5253c23c55ed26b357a645b16f4ab2e26a4 [file] [log] [blame]
Greg Kroah-Hartmana17ae4c2017-11-24 15:00:32 +01001/* SPDX-License-Identifier: GPL-2.0 */
Martin Schwidefskyb0206322008-12-25 13:38:36 +01002/*
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 Schwidefskyb0206322008-12-25 13:38:36 +01008 */
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 Schwidefskyb7eacb52014-08-29 12:31:45 +020019 basr %r1,0
20 la %r1,4f-.(%r1)
Heiko Carstensb3423982010-10-29 16:50:41 +020021 chi %r2,__CLOCK_REALTIME
Martin Schwidefskyb0206322008-12-25 13:38:36 +010022 je 0f
Heiko Carstensb3423982010-10-29 16:50:41 +020023 chi %r2,__CLOCK_MONOTONIC
Martin Schwidefskyb7eacb52014-08-29 12:31:45 +020024 je 0f
25 la %r1,5f-4f(%r1)
26 chi %r2,__CLOCK_REALTIME_COARSE
27 je 0f
28 chi %r2,__CLOCK_MONOTONIC_COARSE
Martin Schwidefskyb0206322008-12-25 13:38:36 +010029 jne 3f
300: ltr %r3,%r3
31 jz 2f /* res == NULL */
Martin Schwidefskyb7eacb52014-08-29 12:31:45 +0200321: l %r0,0(%r1)
Martin Schwidefskyb0206322008-12-25 13:38:36 +010033 xc 0(4,%r3),0(%r3) /* set tp->tv_sec to zero */
34 st %r0,4(%r3) /* store tp->tv_usec */
352: lhi %r2,0
36 br %r14
373: lhi %r1,__NR_clock_getres /* fallback to svc */
38 svc 0
39 br %r14
Heiko Carstensb3423982010-10-29 16:50:41 +0200404: .long __CLOCK_REALTIME_RES
Martin Schwidefskyb7eacb52014-08-29 12:31:45 +0200415: .long __CLOCK_COARSE_RES
Martin Schwidefskyb0206322008-12-25 13:38:36 +010042 .cfi_endproc
43 .size __kernel_clock_getres,.-__kernel_clock_getres