]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[ARM] 3103/1: ARM EABI: stack pointer must be 64-bit aligned (part 2)
authorNicolas Pitre <nico@cam.org>
Sat, 14 Jan 2006 16:18:09 +0000 (16:18 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 14 Jan 2006 16:18:09 +0000 (16:18 +0000)
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>
arch/arm/kernel/semaphore.c
arch/arm/lib/lib1funcs.S

index 4c31f292305563bbf5199460a75df12f6475c5f9..981fe5c6ccbed40575950bb6c71cb6fbc8f53c34 100644 (file)
@@ -177,41 +177,42 @@ int __down_trylock(struct semaphore * sem)
  * ip contains the semaphore pointer on entry. Save the C-clobbered
  * registers (r0 to r3 and lr), but not ip, as we use it as a return
  * value in some cases..
+ * To remain AAPCS compliant (64-bit stack align) we save r4 as well.
  */
 asm("  .section .sched.text,\"ax\",%progbits   \n\
        .align  5                               \n\
        .globl  __down_failed                   \n\
 __down_failed:                                 \n\
-       stmfd   sp!, {r0 - r3, lr}              \n\
+       stmfd   sp!, {r0 - r4, lr}              \n\
        mov     r0, ip                          \n\
        bl      __down                          \n\
-       ldmfd   sp!, {r0 - r3, pc}              \n\
+       ldmfd   sp!, {r0 - r4, pc}              \n\
                                                \n\
        .align  5                               \n\
        .globl  __down_interruptible_failed     \n\
 __down_interruptible_failed:                   \n\
-       stmfd   sp!, {r0 - r3, lr}              \n\
+       stmfd   sp!, {r0 - r4, lr}              \n\
        mov     r0, ip                          \n\
        bl      __down_interruptible            \n\
        mov     ip, r0                          \n\
-       ldmfd   sp!, {r0 - r3, pc}              \n\
+       ldmfd   sp!, {r0 - r4, pc}              \n\
                                                \n\
        .align  5                               \n\
        .globl  __down_trylock_failed           \n\
 __down_trylock_failed:                         \n\
-       stmfd   sp!, {r0 - r3, lr}              \n\
+       stmfd   sp!, {r0 - r4, lr}              \n\
        mov     r0, ip                          \n\
        bl      __down_trylock                  \n\
        mov     ip, r0                          \n\
-       ldmfd   sp!, {r0 - r3, pc}              \n\
+       ldmfd   sp!, {r0 - r4, pc}              \n\
                                                \n\
        .align  5                               \n\
        .globl  __up_wakeup                     \n\
 __up_wakeup:                                   \n\
-       stmfd   sp!, {r0 - r3, lr}              \n\
+       stmfd   sp!, {r0 - r4, lr}              \n\
        mov     r0, ip                          \n\
        bl      __up                            \n\
-       ldmfd   sp!, {r0 - r3, pc}              \n\
+       ldmfd   sp!, {r0 - r4, pc}              \n\
        ");
 
 EXPORT_SYMBOL(__down_failed);
index 59026029d017d33ef784f4e80ece4593cc0cea0e..4964e5bafa0fab227ea8ebb99d4d3cde2ff0bf01 100644 (file)
@@ -306,9 +306,9 @@ ENTRY(__modsi3)
 
 Ldiv0:
 
-       str     lr, [sp, #-4]!
+       str     lr, [sp, #-8]!
        bl      __div0
        mov     r0, #0                  @ About as wrong as it could be.
-       ldr     pc, [sp], #4
+       ldr     pc, [sp], #8