Commit | Line | Data |
---|---|---|
b020632e MS |
1 | /* |
2 | * Userland implementation of gettimeofday() for 64 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_gettimeofday | |
19 | .type __kernel_gettimeofday,@function | |
20 | __kernel_gettimeofday: | |
21 | .cfi_startproc | |
9b2efe03 | 22 | aghi %r15,-16 |
b020632e MS |
23 | larl %r5,_vdso_data |
24 | 0: ltgr %r3,%r3 /* check if tz is NULL */ | |
25 | je 1f | |
26 | mvc 0(8,%r3),__VDSO_TIMEZONE(%r5) | |
27 | 1: ltgr %r2,%r2 /* check if tv is NULL */ | |
28 | je 4f | |
29 | lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ | |
30 | tmll %r4,0x0001 /* pending update ? loop */ | |
31 | jnz 0b | |
9b2efe03 HC |
32 | stcke 0(%r15) /* Store TOD clock */ |
33 | lg %r1,1(%r15) | |
b020632e | 34 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ |
79c74ecb MS |
35 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ |
36 | alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ | |
37 | lg %r0,__VDSO_XTIME_SEC(%r5) /* tk->xtime_sec */ | |
b020632e MS |
38 | clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */ |
39 | jne 0b | |
79c74ecb MS |
40 | lgf %r5,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ |
41 | srlg %r1,%r1,0(%r5) /* >> tk->shift */ | |
b020632e MS |
42 | larl %r5,5f |
43 | 2: clg %r1,0(%r5) | |
44 | jl 3f | |
45 | slg %r1,0(%r5) | |
46 | aghi %r0,1 | |
47 | j 2b | |
48 | 3: stg %r0,0(%r2) /* store tv->tv_sec */ | |
49 | slgr %r0,%r0 /* tv_nsec -> tv_usec */ | |
50 | ml %r0,8(%r5) | |
51 | srlg %r0,%r0,6 | |
52 | stg %r0,8(%r2) /* store tv->tv_usec */ | |
53 | 4: lghi %r2,0 | |
9b2efe03 | 54 | aghi %r15,16 |
b020632e MS |
55 | br %r14 |
56 | 5: .quad 1000000000 | |
57 | .long 274877907 | |
58 | .cfi_endproc | |
59 | .size __kernel_gettimeofday,.-__kernel_gettimeofday |