summaryrefslogtreecommitdiff
path: root/arch/nios2/cpu
diff options
context:
space:
mode:
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>2015-11-25 16:56:32 (GMT)
committerTom Rini <trini@konsulko.com>2016-01-14 02:05:17 (GMT)
commitecc306639e83c9019a5093b77a48685ea40eedc2 (patch)
tree7785c9d7358ccd22ddabe52489aae8a8c7035ffe /arch/nios2/cpu
parent20d08f59fa7cdde0da1eb7aca7915c91dbdeaf51 (diff)
downloadu-boot-ecc306639e83c9019a5093b77a48685ea40eedc2.tar.xz
Fix board init code to respect the C runtime environment
board_init_f_mem() alters the C runtime environment's stack it is actually already using. This is not a valid behaviour within a C runtime environment. Split board_init_f_mem into C functions which do not alter their own stack and always behave properly with respect to their C runtime environment. Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net> Acked-by: Thomas Chou <thomas@wytron.com.tw>
Diffstat (limited to 'arch/nios2/cpu')
-rw-r--r--arch/nios2/cpu/start.S14
1 files changed, 9 insertions, 5 deletions
diff --git a/arch/nios2/cpu/start.S b/arch/nios2/cpu/start.S
index 54787c5..204d0cd 100644
--- a/arch/nios2/cpu/start.S
+++ b/arch/nios2/cpu/start.S
@@ -106,14 +106,18 @@ _reloc:
stw r0, 4(sp)
mov fp, sp
- /* Allocate and zero GD, update SP */
+ /* Allocate and initialize reserved area, update SP */
mov r4, sp
- movhi r2, %hi(board_init_f_mem@h)
- ori r2, r2, %lo(board_init_f_mem@h)
+ movhi r2, %hi(board_init_f_alloc_reserve@h)
+ ori r2, r2, %lo(board_init_f_alloc_reserve@h)
callr r2
-
- /* Update stack- and frame-pointers */
mov sp, r2
+ mov r4, sp
+ movhi r2, %hi(board_init_f_init_reserve@h)
+ ori r2, r2, %lo(board_init_f_init_reserve@h)
+ callr r2
+
+ /* Update frame-pointer */
mov fp, sp
/* Call board_init_f -- never returns */