summaryrefslogtreecommitdiff
path: root/arch/arc
diff options
context:
space:
mode:
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>2015-11-25 17:56:32 +0100
committerTom Rini <trini@konsulko.com>2016-01-13 21:05:17 -0500
commitecc306639e83c9019a5093b77a48685ea40eedc2 (patch)
tree7785c9d7358ccd22ddabe52489aae8a8c7035ffe /arch/arc
parent20d08f59fa7cdde0da1eb7aca7915c91dbdeaf51 (diff)
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/arc')
-rw-r--r--arch/arc/lib/start.S12
1 files changed, 7 insertions, 5 deletions
diff --git a/arch/arc/lib/start.S b/arch/arc/lib/start.S
index 26a59341893..90ee7e0fe40 100644
--- a/arch/arc/lib/start.S
+++ b/arch/arc/lib/start.S
@@ -50,18 +50,20 @@ ENTRY(_start)
1:
#endif
- /* Setup stack- and frame-pointers */
+ /* Establish C runtime stack and frame */
mov %sp, CONFIG_SYS_INIT_SP_ADDR
mov %fp, %sp
- /* Allocate and zero GD, update SP */
+ /* Allocate reserved area from current top of stack */
mov %r0, %sp
- bl board_init_f_mem
-
- /* Update stack- and frame-pointers */
+ bl board_init_f_alloc_reserve
+ /* Set stack below reserved area, adjust frame pointer accordingly */
mov %sp, %r0
mov %fp, %sp
+ /* Initialize reserved area - note: r0 already contains address */
+ bl board_init_f_init_reserve
+
/* Zero the one and only argument of "board_init_f" */
mov_s %r0, 0
j board_init_f