2 * Userland implementation of gettimeofday() for 32 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:
24 0: al %r5,13f-0b(%r5) /* get &_vdso_data */
25 1: ltr %r3,%r3 /* check if tz is NULL */
27 mvc 0(8,%r3),__VDSO_TIMEZONE(%r5)
28 2: ltr %r2,%r2 /* check if tv is NULL */
30 l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */
31 tml %r4,0x0001 /* pending update ? loop */
33 stcke 0(%r15) /* Store TOD clock */
34 lm %r0,%r1,__VDSO_TS_END(%r5) /* TOD steering end time */
39 14: ltr %r0,%r0 /* past end of steering? */
41 srdl %r0,15 /* 1 per 2^16 */
42 tm __VDSO_TS_DIR+3(%r5),0x01 /* steering direction? */
44 lcr %r0,%r0 /* negative TOD offset */
48 15: a %r0,1(%r15) /* add TOD timestamp */
53 16: lm %r0,%r1,1(%r15) /* load TOD timestamp */
54 17: s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
55 sl %r1,__VDSO_XTIME_STAMP+4(%r5)
58 3: ms %r0,__VDSO_TK_MULT(%r5) /* * tk->mult */
60 l %r0,__VDSO_TK_MULT(%r5)
64 a %r0,__VDSO_TK_MULT(%r5)
66 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */
67 al %r1,__VDSO_XTIME_NSEC+4(%r5)
70 5: mvc 0(4,%r15),__VDSO_XTIME_SEC+4(%r5)
71 cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */
73 l %r4,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */
74 srdl %r0,0(%r4) /* >> tk->shift */
75 l %r4,0(%r15) /* get tv_sec from stack */
86 8: st %r4,0(%r2) /* store tv->tv_sec */
92 st %r0,4(%r2) /* store tv->tv_usec */
98 13: .long _vdso_data - 0b
100 .size __kernel_gettimeofday,.-__kernel_gettimeofday