mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-29 16:10:58 +00:00
ARM: Align stack to 8 bytes
The ARM ABI requires that the stack be aligned to 8 bytes as it is noted in Procedure Call Standard for the ARM Architecture: http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042d/index.html Unaligned SP also causes the problem with variable-length arrays allocation when VLA address becomes less than stack pointer during aligning of this address, so the next 'push' in the stack overwrites first 4 bytes of VLA. Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
This commit is contained in:
parent
96b35730a4
commit
1a27f7d9c2
14 changed files with 15 additions and 6 deletions
|
@ -185,6 +185,7 @@ stack_setup:
|
|||
#endif
|
||||
sub sp, r0, #12 /* leave 3 words for abort-stack */
|
||||
#endif /* CONFIG_PRELOADER */
|
||||
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
|
||||
|
||||
clear_bss:
|
||||
ldr r0, _bss_start /* find start of bss segment */
|
||||
|
|
|
@ -276,6 +276,7 @@ stack_setup:
|
|||
sub r0, r0, #CONFIG_SYS_MALLOC_LEN /* malloc area */
|
||||
sub r0, r0, #CONFIG_SYS_GBL_DATA_SIZE /* bdinfo */
|
||||
sub sp, r0, #12 /* leave 3 words for abort-stack */
|
||||
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
|
||||
|
||||
clear_bss:
|
||||
ldr r0, _bss_start /* find start of bss segment */
|
||||
|
|
|
@ -172,6 +172,7 @@ stack_setup:
|
|||
sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
|
||||
#endif
|
||||
sub sp, r0, #12 /* leave 3 words for abort-stack */
|
||||
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
|
||||
|
||||
clear_bss:
|
||||
ldr r0, _bss_start /* find start of bss segment */
|
||||
|
|
|
@ -204,6 +204,7 @@ stack_setup:
|
|||
sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
|
||||
#endif
|
||||
sub sp, r0, #12 /* leave 3 words for abort-stack */
|
||||
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
|
||||
|
||||
clear_bss:
|
||||
ldr r0, _bss_start /* find start of bss segment */
|
||||
|
|
|
@ -196,6 +196,7 @@ stack_setup:
|
|||
sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
|
||||
#endif
|
||||
sub sp, r0, #12 /* leave 3 words for abort-stack */
|
||||
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
|
||||
|
||||
clear_bss:
|
||||
ldr r0, _bss_start /* find start of bss segment */
|
||||
|
|
|
@ -196,7 +196,7 @@ stack_setup:
|
|||
#endif
|
||||
#endif /* CONFIG_PRELOADER */
|
||||
sub sp, r0, #12 /* leave 3 words for abort-stack */
|
||||
bic sp, r0, #7 /* 8-byte align stack for ABI compliance */
|
||||
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
|
||||
|
||||
clear_bss:
|
||||
ldr r0, _bss_start /* find start of bss segment */
|
||||
|
|
|
@ -163,6 +163,7 @@ stack_setup:
|
|||
sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
|
||||
#endif
|
||||
sub sp, r0, #12 /* leave 3 words for abort-stack */
|
||||
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
|
||||
|
||||
clear_bss:
|
||||
ldr r0, _bss_start /* find start of bss segment */
|
||||
|
|
|
@ -164,7 +164,7 @@ stack_setup:
|
|||
sub r0, r0, #(CONFIG_STACKSIZE_IRQ + CONFIG_STACKSIZE_FIQ)
|
||||
#endif
|
||||
sub sp, r0, #12 @ leave 3 words for abort-stack
|
||||
and sp, sp, #~7 @ 8 byte alinged for (ldr/str)d
|
||||
bic sp, sp, #7 @ 8-byte alignment for ABI compliance
|
||||
|
||||
/* Clear BSS (if any). Is below tx (watch load addr - need space) */
|
||||
clear_bss:
|
||||
|
|
|
@ -161,6 +161,7 @@ stack_setup:
|
|||
sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
|
||||
#endif
|
||||
sub sp, r0, #12 /* leave 3 words for abort-stack */
|
||||
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
|
||||
|
||||
clear_bss:
|
||||
ldr r0, _bss_start /* find start of bss segment */
|
||||
|
|
|
@ -289,6 +289,7 @@ stack_setup:
|
|||
sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
|
||||
#endif
|
||||
sub sp, r0, #12 /* leave 3 words for abort-stack */
|
||||
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
|
||||
|
||||
clear_bss:
|
||||
ldr r0, _bss_start /* find start of bss segment */
|
||||
|
|
|
@ -178,6 +178,7 @@ stack_setup:
|
|||
sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
|
||||
#endif
|
||||
sub sp, r0, #12 /* leave 3 words for abort-stack */
|
||||
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
|
||||
|
||||
clear_bss:
|
||||
ldr r0, _bss_start /* find start of bss segment */
|
||||
|
|
|
@ -140,10 +140,8 @@ stack_setup:
|
|||
#ifdef CONFIG_USE_IRQ
|
||||
sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
|
||||
#endif /* CONFIG_USE_IRQ */
|
||||
sub r0, r0, #12 /* leave 3 words for abort-stack */
|
||||
bic sp, r0, #7 /* NOTE: stack MUST be aligned to */
|
||||
/* 8 bytes in case we want to use */
|
||||
/* 64bit datatypes (eg. VSPRINTF64) */
|
||||
sub sp, r0, #12 /* leave 3 words for abort-stack */
|
||||
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
|
||||
|
||||
clear_bss:
|
||||
ldr r0, _bss_start /* find start of bss segment */
|
||||
|
|
|
@ -163,6 +163,7 @@ stack_setup:
|
|||
sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
|
||||
#endif
|
||||
sub sp, r0, #12 /* leave 3 words for abort-stack */
|
||||
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
|
||||
|
||||
ldr pc, _start_armboot
|
||||
|
||||
|
|
|
@ -153,6 +153,7 @@ stack_setup:
|
|||
sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
|
||||
#endif
|
||||
sub sp, r0, #12 /* leave 3 words for abort-stack */
|
||||
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
|
||||
|
||||
clear_bss:
|
||||
ldr r0, _bss_start /* find start of bss segment */
|
||||
|
|
Loading…
Reference in a new issue