diff options
author | Nicolas Pitre <nico@cam.org> | 2006-01-14 11:18:09 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-01-14 11:18:09 -0500 |
commit | 499b2ea11ff00c624d63af23516404fa2156639a (patch) | |
tree | 7c63e058acd8f6c6a59b08cc64febf9def142852 | |
parent | 2dede2d8e925f4c2cb4e136b14df127685e15dd3 (diff) |
[ARM] 3103/1: ARM EABI: stack pointer must be 64-bit aligned (part 2)
Patch from Nicolas Pitre
We must make sure that assembly code that modifies the stack pointer
before calling a C function does it so it remains 64-bit aligned.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/kernel/semaphore.c | 17 | ||||
-rw-r--r-- | arch/arm/lib/lib1funcs.S | 4 |
2 files changed, 11 insertions, 10 deletions
diff --git a/arch/arm/kernel/semaphore.c b/arch/arm/kernel/semaphore.c index 4c31f2923055..981fe5c6ccbe 100644 --- a/arch/arm/kernel/semaphore.c +++ b/arch/arm/kernel/semaphore.c | |||
@@ -177,41 +177,42 @@ int __down_trylock(struct semaphore * sem) | |||
177 | * ip contains the semaphore pointer on entry. Save the C-clobbered | 177 | * ip contains the semaphore pointer on entry. Save the C-clobbered |
178 | * registers (r0 to r3 and lr), but not ip, as we use it as a return | 178 | * registers (r0 to r3 and lr), but not ip, as we use it as a return |
179 | * value in some cases.. | 179 | * value in some cases.. |
180 | * To remain AAPCS compliant (64-bit stack align) we save r4 as well. | ||
180 | */ | 181 | */ |
181 | asm(" .section .sched.text,\"ax\",%progbits \n\ | 182 | asm(" .section .sched.text,\"ax\",%progbits \n\ |
182 | .align 5 \n\ | 183 | .align 5 \n\ |
183 | .globl __down_failed \n\ | 184 | .globl __down_failed \n\ |
184 | __down_failed: \n\ | 185 | __down_failed: \n\ |
185 | stmfd sp!, {r0 - r3, lr} \n\ | 186 | stmfd sp!, {r0 - r4, lr} \n\ |
186 | mov r0, ip \n\ | 187 | mov r0, ip \n\ |
187 | bl __down \n\ | 188 | bl __down \n\ |
188 | ldmfd sp!, {r0 - r3, pc} \n\ | 189 | ldmfd sp!, {r0 - r4, pc} \n\ |
189 | \n\ | 190 | \n\ |
190 | .align 5 \n\ | 191 | .align 5 \n\ |
191 | .globl __down_interruptible_failed \n\ | 192 | .globl __down_interruptible_failed \n\ |
192 | __down_interruptible_failed: \n\ | 193 | __down_interruptible_failed: \n\ |
193 | stmfd sp!, {r0 - r3, lr} \n\ | 194 | stmfd sp!, {r0 - r4, lr} \n\ |
194 | mov r0, ip \n\ | 195 | mov r0, ip \n\ |
195 | bl __down_interruptible \n\ | 196 | bl __down_interruptible \n\ |
196 | mov ip, r0 \n\ | 197 | mov ip, r0 \n\ |
197 | ldmfd sp!, {r0 - r3, pc} \n\ | 198 | ldmfd sp!, {r0 - r4, pc} \n\ |
198 | \n\ | 199 | \n\ |
199 | .align 5 \n\ | 200 | .align 5 \n\ |
200 | .globl __down_trylock_failed \n\ | 201 | .globl __down_trylock_failed \n\ |
201 | __down_trylock_failed: \n\ | 202 | __down_trylock_failed: \n\ |
202 | stmfd sp!, {r0 - r3, lr} \n\ | 203 | stmfd sp!, {r0 - r4, lr} \n\ |
203 | mov r0, ip \n\ | 204 | mov r0, ip \n\ |
204 | bl __down_trylock \n\ | 205 | bl __down_trylock \n\ |
205 | mov ip, r0 \n\ | 206 | mov ip, r0 \n\ |
206 | ldmfd sp!, {r0 - r3, pc} \n\ | 207 | ldmfd sp!, {r0 - r4, pc} \n\ |
207 | \n\ | 208 | \n\ |
208 | .align 5 \n\ | 209 | .align 5 \n\ |
209 | .globl __up_wakeup \n\ | 210 | .globl __up_wakeup \n\ |
210 | __up_wakeup: \n\ | 211 | __up_wakeup: \n\ |
211 | stmfd sp!, {r0 - r3, lr} \n\ | 212 | stmfd sp!, {r0 - r4, lr} \n\ |
212 | mov r0, ip \n\ | 213 | mov r0, ip \n\ |
213 | bl __up \n\ | 214 | bl __up \n\ |
214 | ldmfd sp!, {r0 - r3, pc} \n\ | 215 | ldmfd sp!, {r0 - r4, pc} \n\ |
215 | "); | 216 | "); |
216 | 217 | ||
217 | EXPORT_SYMBOL(__down_failed); | 218 | EXPORT_SYMBOL(__down_failed); |
diff --git a/arch/arm/lib/lib1funcs.S b/arch/arm/lib/lib1funcs.S index 59026029d017..4964e5bafa0f 100644 --- a/arch/arm/lib/lib1funcs.S +++ b/arch/arm/lib/lib1funcs.S | |||
@@ -306,9 +306,9 @@ ENTRY(__modsi3) | |||
306 | 306 | ||
307 | Ldiv0: | 307 | Ldiv0: |
308 | 308 | ||
309 | str lr, [sp, #-4]! | 309 | str lr, [sp, #-8]! |
310 | bl __div0 | 310 | bl __div0 |
311 | mov r0, #0 @ About as wrong as it could be. | 311 | mov r0, #0 @ About as wrong as it could be. |
312 | ldr pc, [sp], #4 | 312 | ldr pc, [sp], #8 |
313 | 313 | ||
314 | 314 | ||