1/*
2 * Userland implementation of clock_getres() for 32 bits processes in a
3 * s390 kernel for use in the vDSO
4 *
5 *  Copyright IBM Corp. 2008
6 *  Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License (version 2 only)
10 * as published by the Free Software Foundation.
11 */
12#include <asm/vdso.h>
13#include <asm/asm-offsets.h>
14#include <asm/unistd.h>
15
16	.text
17	.align 4
18	.globl __kernel_clock_getres
19	.type  __kernel_clock_getres,@function
20__kernel_clock_getres:
21	.cfi_startproc
22	basr	%r1,0
23	la	%r1,4f-.(%r1)
24	chi	%r2,__CLOCK_REALTIME
25	je	0f
26	chi	%r2,__CLOCK_MONOTONIC
27	je	0f
28	la	%r1,5f-4f(%r1)
29	chi	%r2,__CLOCK_REALTIME_COARSE
30	je	0f
31	chi	%r2,__CLOCK_MONOTONIC_COARSE
32	jne	3f
330:	ltr	%r3,%r3
34	jz	2f				/* res == NULL */
351:	l	%r0,0(%r1)
36	xc	0(4,%r3),0(%r3)			/* set tp->tv_sec to zero */
37	st	%r0,4(%r3)			/* store tp->tv_usec */
382:	lhi	%r2,0
39	br	%r14
403:	lhi	%r1,__NR_clock_getres		/* fallback to svc */
41	svc	0
42	br	%r14
434:	.long	__CLOCK_REALTIME_RES
445:	.long	__CLOCK_COARSE_RES
45	.cfi_endproc
46	.size	__kernel_clock_getres,.-__kernel_clock_getres
47