BUGFIX: arm: data abort in get_bad_stack_swi
authorTetsuyuki Kobayashi <koba@kmckk.co.jp>
Fri, 5 Apr 2013 00:12:51 +0000 (00:12 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Sat, 13 Apr 2013 09:12:46 +0000 (11:12 +0200)
When swi instruction is executed, it is expected to get message
"software interrupt" in console and dump registers and reboot, as
do_software_interrupt() in arch/arm/lib/interrupts.c.
But, actually it causes data abort accessing wrong address in get_bad_stack_swi
macro in arch/arm/cpu/v7/start.S.
This patch fixes this problem.

The same mistake in arch/arm/cpu/{arm1136,arm1176,pxa}/start.S.

Signed-off-by: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
arch/arm/cpu/arm1136/start.S
arch/arm/cpu/arm1176/start.S
arch/arm/cpu/armv7/start.S
arch/arm/cpu/pxa/start.S

index ad24b80641d0491196dfdcb849b9478865bd5f39..ccea2d5cb4248e9fb1c7f13978d2842984b83e1d 100644 (file)
@@ -388,8 +388,9 @@ cpu_init_crit:
        str     r0, [r13]                       @ save R0's value.
        ldr     r0, IRQ_STACK_START_IN          @ get data regions start
        str     lr, [r0]                        @ save caller lr in position 0 of saved stack
-       mrs     r0, spsr                        @ get the spsr
+       mrs     lr, spsr                        @ get the spsr
        str     lr, [r0, #4]                    @ save spsr in position 1 of saved stack
+       ldr     lr, [r0]                        @ restore lr
        ldr     r0, [r13]                       @ restore r0
        add     r13, r13, #4                    @ pop stack entry
        .endm
index 1fc1da071b4cb09fb0b1a87ac2bf387729071309..f20da8eb7bfcc73dd146789465fd7715b75b0af8 100644 (file)
@@ -393,9 +393,11 @@ c_runtime_cpu_setup:
        /* save caller lr in position 0 of saved stack */
        str     lr, [r0]
        /* get the spsr */
-       mrs     r0, spsr
+       mrs     lr, spsr
        /* save spsr in position 1 of saved stack */
        str     lr, [r0, #4]
+       /* restore lr */
+       ldr     lr, [r0]
        /* restore r0 */
        ldr     r0, [r13]
        /* pop stack entry */
index 64008ba6cf3d97dab17870c618fe99a6ca7d926f..61da7acde910d37b67b45cdad80461cb3e85a2dc 100644 (file)
@@ -463,9 +463,10 @@ ENDPROC(cpu_init_crit)
                                                @ spots for abort stack
        str     lr, [r0]                        @ save caller lr in position 0
                                                @ of saved stack
-       mrs     r0, spsr                        @ get the spsr
+       mrs     lr, spsr                        @ get the spsr
        str     lr, [r0, #4]                    @ save spsr in position 1 of
                                                @ saved stack
+       ldr     lr, [r0]                        @ restore lr
        ldr     r0, [r13]                       @ restore r0
        add     r13, r13, #4                    @ pop stack entry
        .endm
index 3e07c7c35abcce5d90b5fef462d5c6b56797aed7..ada91a66c98d27f611cc7abed4222a7453554685 100644 (file)
@@ -385,8 +385,9 @@ cpu_init_crit:
        str     r0, [r13]                       @ save R0's value.
        ldr     r0, IRQ_STACK_START_IN          @ get data regions start
        str     lr, [r0]                        @ save caller lr in position 0 of saved stack
-       mrs     r0, spsr                        @ get the spsr
+       mrs     lr, spsr                        @ get the spsr
        str     lr, [r0, #4]                    @ save spsr in position 1 of saved stack
+       ldr     lr, [r0]                        @ restore lr
        ldr     r0, [r13]                       @ restore r0
        add     r13, r13, #4                    @ pop stack entry
        .endm