2 * Userland implementation of gettimeofday() for 64 bits processes in a
3 * s390 kernel for use in the vDSO
5 * Copyright IBM Corp. 2008
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
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.
13 #include <asm/asm-offsets.h>
14 #include <asm/unistd.h>
18 .globl __kernel_gettimeofday
19 .type __kernel_gettimeofday,@function
20 __kernel_gettimeofday:
23 0: ltgr %r3,%r3 /* check if tz is NULL */
25 mvc 0(8,%r3),__VDSO_TIMEZONE(%r5)
26 1: ltgr %r2,%r2 /* check if tv is NULL */
28 lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */
29 tmll %r4,0x0001 /* pending update ? loop */
31 stck 48(%r15) /* Store TOD clock */
33 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
35 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */
36 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime.tv_nsec */
37 lg %r0,__VDSO_XTIME_SEC(%r5) /* xtime.tv_sec */
38 clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */
46 3: stg %r0,0(%r2) /* store tv->tv_sec */
47 slgr %r0,%r0 /* tv_nsec -> tv_usec */
50 stg %r0,8(%r2) /* store tv->tv_usec */
56 .size __kernel_gettimeofday,.-__kernel_gettimeofday