aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/vdso32
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-11-13 22:55:58 -0500
committerPaul Mackerras <paulus@samba.org>2005-11-14 00:35:58 -0500
commit0c37ec2aa88bd8a6aaeb284ff5c86f4c6d8e8469 (patch)
treed70e4b48664b86a9abfe21ff26561318316fb9c2 /arch/powerpc/kernel/vdso32
parent50092b233afa96b4c9a4b24ac38199c34e0880cd (diff)
[PATCH] powerpc: vdso fixes (take #2)
This fixes various errors in the new functions added in the vDSO's, I've now verified all functions on both 32 and 64 bits vDSOs. It also fix a sign extension bug getting the initial time of day at boot that could cause the monotonic clock value to be completely on bogus for 64 bits applications (with either the vDSO or the syscall) on powermacs. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/vdso32')
-rw-r--r--arch/powerpc/kernel/vdso32/datapage.S3
-rw-r--r--arch/powerpc/kernel/vdso32/gettimeofday.S12
2 files changed, 10 insertions, 5 deletions
diff --git a/arch/powerpc/kernel/vdso32/datapage.S b/arch/powerpc/kernel/vdso32/datapage.S
index a08c26e87835..f6b38472318d 100644
--- a/arch/powerpc/kernel/vdso32/datapage.S
+++ b/arch/powerpc/kernel/vdso32/datapage.S
@@ -77,8 +77,9 @@ V_FUNCTION_BEGIN(__kernel_get_tbfreq)
77 mflr r12 77 mflr r12
78 .cfi_register lr,r12 78 .cfi_register lr,r12
79 bl __get_datapage@local 79 bl __get_datapage@local
80 lwz r3,CFG_TB_TICKS_PER_SEC(r3)
81 lwz r4,(CFG_TB_TICKS_PER_SEC + 4)(r3) 80 lwz r4,(CFG_TB_TICKS_PER_SEC + 4)(r3)
81 lwz r3,CFG_TB_TICKS_PER_SEC(r3)
82 mtlr r12 82 mtlr r12
83 blr
83 .cfi_endproc 84 .cfi_endproc
84V_FUNCTION_END(__kernel_get_tbfreq) 85V_FUNCTION_END(__kernel_get_tbfreq)
diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S
index aeb5fc9b87b3..0a32a41d50b0 100644
--- a/arch/powerpc/kernel/vdso32/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso32/gettimeofday.S
@@ -83,7 +83,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
83 /* Check for supported clock IDs */ 83 /* Check for supported clock IDs */
84 cmpli cr0,r3,CLOCK_REALTIME 84 cmpli cr0,r3,CLOCK_REALTIME
85 cmpli cr1,r3,CLOCK_MONOTONIC 85 cmpli cr1,r3,CLOCK_MONOTONIC
86 cror cr0,cr0,cr1 86 cror cr0*4+eq,cr0*4+eq,cr1*4+eq
87 bne cr0,99f 87 bne cr0,99f
88 88
89 mflr r12 /* r12 saves lr */ 89 mflr r12 /* r12 saves lr */
@@ -91,7 +91,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
91 mr r10,r3 /* r10 saves id */ 91 mr r10,r3 /* r10 saves id */
92 mr r11,r4 /* r11 saves tp */ 92 mr r11,r4 /* r11 saves tp */
93 bl __get_datapage@local /* get data page */ 93 bl __get_datapage@local /* get data page */
94 mr r9, r3 /* datapage ptr in r9 */ 94 mr r9,r3 /* datapage ptr in r9 */
95 beq cr1,50f /* if monotonic -> jump there */ 95 beq cr1,50f /* if monotonic -> jump there */
96 96
97 /* 97 /*
@@ -173,10 +173,14 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
173 add r4,r4,r7 173 add r4,r4,r7
174 lis r5,NSEC_PER_SEC@h 174 lis r5,NSEC_PER_SEC@h
175 ori r5,r5,NSEC_PER_SEC@l 175 ori r5,r5,NSEC_PER_SEC@l
176 cmpli cr0,r4,r5 176 cmpl cr0,r4,r5
177 cmpli cr1,r4,0
177 blt 1f 178 blt 1f
178 subf r4,r5,r4 179 subf r4,r5,r4
179 addi r3,r3,1 180 addi r3,r3,1
1811: bge cr1,1f
182 addi r3,r3,-1
183 add r4,r4,r5
1801: stw r3,TSPC32_TV_SEC(r11) 1841: stw r3,TSPC32_TV_SEC(r11)
181 stw r4,TSPC32_TV_NSEC(r11) 185 stw r4,TSPC32_TV_NSEC(r11)
182 186
@@ -210,7 +214,7 @@ V_FUNCTION_BEGIN(__kernel_clock_getres)
210 /* Check for supported clock IDs */ 214 /* Check for supported clock IDs */
211 cmpwi cr0,r3,CLOCK_REALTIME 215 cmpwi cr0,r3,CLOCK_REALTIME
212 cmpwi cr1,r3,CLOCK_MONOTONIC 216 cmpwi cr1,r3,CLOCK_MONOTONIC
213 cror cr0,cr0,cr1 217 cror cr0*4+eq,cr0*4+eq,cr1*4+eq
214 bne cr0,99f 218 bne cr0,99f
215 219
216 li r3,0 220 li r3,0