summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut+renesas@gmail.com>2020-05-09 22:02:50 +0200
committerMarek Vasut <marek.vasut+renesas@gmail.com>2020-08-02 19:58:26 +0200
commit3223ca99ee5ff98b4189f1c66af64e14c7b472b1 (patch)
tree9b2e37681c44ddedea42cbe308621581971d535c
parent7bee46fd4057449eef8f698cb2f28219538f2f0a (diff)
downloadu-boot-3223ca99ee5ff98b4189f1c66af64e14c7b472b1.tar.gz
sh: Set gd->malloc_base if MALLOC_F_LEN is set
The gd->malloc_base must be set before the C runtime if the MALLOC_F_LEN is non-zero, otherwise we hit assertion in dlmalloc.c initf_malloc(). So set it. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
-rw-r--r--arch/sh/lib/start.S8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/sh/lib/start.S b/arch/sh/lib/start.S
index f9f26d3779..ddb9aa9f87 100644
--- a/arch/sh/lib/start.S
+++ b/arch/sh/lib/start.S
@@ -53,7 +53,10 @@ _start:
mov.l ._gd_init, r13 /* global data */
mov.l ._stack_init, r15 /* stack */
-
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+ mov.l ._gd_malloc_base, r14
+ mov.l r15, @r14
+#endif
mov.l ._sh_generic_init, r0
jsr @r0
mov #0, r4
@@ -70,5 +73,8 @@ loop:
._bss_start: .long bss_start
._bss_end: .long bss_end
._gd_init: .long (_start - GENERATED_GBL_DATA_SIZE)
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+._gd_malloc_base: .long (_start - GENERATED_GBL_DATA_SIZE + GD_MALLOC_BASE)
+#endif
._stack_init: .long (_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
._sh_generic_init: .long board_init_f