diff options
Diffstat (limited to 'arch/s390/kernel/vdso64/clock_gettime.S')
-rw-r--r-- | arch/s390/kernel/vdso64/clock_gettime.S | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/arch/s390/kernel/vdso64/clock_gettime.S b/arch/s390/kernel/vdso64/clock_gettime.S index 738a410b7eb2..79dbfee831ec 100644 --- a/arch/s390/kernel/vdso64/clock_gettime.S +++ b/arch/s390/kernel/vdso64/clock_gettime.S | |||
@@ -22,8 +22,10 @@ __kernel_clock_gettime: | |||
22 | larl %r5,_vdso_data | 22 | larl %r5,_vdso_data |
23 | cghi %r2,CLOCK_REALTIME | 23 | cghi %r2,CLOCK_REALTIME |
24 | je 4f | 24 | je 4f |
25 | cghi %r2,-2 /* CLOCK_THREAD_CPUTIME_ID for this thread */ | ||
26 | je 9f | ||
25 | cghi %r2,CLOCK_MONOTONIC | 27 | cghi %r2,CLOCK_MONOTONIC |
26 | jne 9f | 28 | jne 12f |
27 | 29 | ||
28 | /* CLOCK_MONOTONIC */ | 30 | /* CLOCK_MONOTONIC */ |
29 | ltgr %r3,%r3 | 31 | ltgr %r3,%r3 |
@@ -42,7 +44,7 @@ __kernel_clock_gettime: | |||
42 | alg %r0,__VDSO_WTOM_SEC(%r5) | 44 | alg %r0,__VDSO_WTOM_SEC(%r5) |
43 | clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */ | 45 | clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */ |
44 | jne 0b | 46 | jne 0b |
45 | larl %r5,10f | 47 | larl %r5,13f |
46 | 1: clg %r1,0(%r5) | 48 | 1: clg %r1,0(%r5) |
47 | jl 2f | 49 | jl 2f |
48 | slg %r1,0(%r5) | 50 | slg %r1,0(%r5) |
@@ -68,7 +70,7 @@ __kernel_clock_gettime: | |||
68 | lg %r0,__VDSO_XTIME_SEC(%r5) | 70 | lg %r0,__VDSO_XTIME_SEC(%r5) |
69 | clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */ | 71 | clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */ |
70 | jne 5b | 72 | jne 5b |
71 | larl %r5,10f | 73 | larl %r5,13f |
72 | 6: clg %r1,0(%r5) | 74 | 6: clg %r1,0(%r5) |
73 | jl 7f | 75 | jl 7f |
74 | slg %r1,0(%r5) | 76 | slg %r1,0(%r5) |
@@ -79,11 +81,38 @@ __kernel_clock_gettime: | |||
79 | 8: lghi %r2,0 | 81 | 8: lghi %r2,0 |
80 | br %r14 | 82 | br %r14 |
81 | 83 | ||
84 | /* CLOCK_THREAD_CPUTIME_ID for this thread */ | ||
85 | 9: icm %r0,15,__VDSO_ECTG_OK(%r5) | ||
86 | jz 12f | ||
87 | ear %r2,%a4 | ||
88 | llilh %r4,0x0100 | ||
89 | sar %a4,%r4 | ||
90 | lghi %r4,0 | ||
91 | sacf 512 /* Magic ectg instruction */ | ||
92 | .insn ssf,0xc80100000000,__VDSO_ECTG_BASE(4),__VDSO_ECTG_USER(4),4 | ||
93 | sacf 0 | ||
94 | sar %a4,%r2 | ||
95 | algr %r1,%r0 /* r1 = cputime as TOD value */ | ||
96 | mghi %r1,1000 /* convert to nanoseconds */ | ||
97 | srlg %r1,%r1,12 /* r1 = cputime in nanosec */ | ||
98 | lgr %r4,%r1 | ||
99 | larl %r5,13f | ||
100 | srlg %r1,%r1,9 /* divide by 1000000000 */ | ||
101 | mlg %r0,8(%r5) | ||
102 | srlg %r0,%r0,11 /* r0 = tv_sec */ | ||
103 | stg %r0,0(%r3) | ||
104 | msg %r0,0(%r5) /* calculate tv_nsec */ | ||
105 | slgr %r4,%r0 /* r4 = tv_nsec */ | ||
106 | stg %r4,8(%r3) | ||
107 | lghi %r2,0 | ||
108 | br %r14 | ||
109 | |||
82 | /* Fallback to system call */ | 110 | /* Fallback to system call */ |
83 | 9: lghi %r1,__NR_clock_gettime | 111 | 12: lghi %r1,__NR_clock_gettime |
84 | svc 0 | 112 | svc 0 |
85 | br %r14 | 113 | br %r14 |
86 | 114 | ||
87 | 10: .quad 1000000000 | 115 | 13: .quad 1000000000 |
116 | 14: .quad 19342813113834067 | ||
88 | .cfi_endproc | 117 | .cfi_endproc |
89 | .size __kernel_clock_gettime,.-__kernel_clock_gettime | 118 | .size __kernel_clock_gettime,.-__kernel_clock_gettime |