All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH 1/3] sh: Set gd->malloc_base if MALLOC_F_LEN is set
Date: Sun,  2 Aug 2020 17:05:49 +0200	[thread overview]
Message-ID: <20200802150551.114604-1-marek.vasut+renesas@gmail.com> (raw)

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>
---
 arch/sh/lib/start.S | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/sh/lib/start.S b/arch/sh/lib/start.S
index f9f26d3779..d6342a16da 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,6 @@ loop:
 ._bss_start:		.long	bss_start
 ._bss_end:		.long	bss_end
 ._gd_init:		.long	(_start - GENERATED_GBL_DATA_SIZE)
+._gd_malloc_base:	.long	(_start - GENERATED_GBL_DATA_SIZE + GD_MALLOC_BASE)
 ._stack_init:		.long	(_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
 ._sh_generic_init:	.long	board_init_f
-- 
2.27.0

             reply	other threads:[~2020-08-02 15:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-02 15:05 Marek Vasut [this message]
2020-08-02 15:05 ` [PATCH 2/3] sh: r2dplus: Add SCIF1 to the basic DT Marek Vasut
2020-08-02 15:05 ` [PATCH 3/3] sh: r2dplus: Enable DM_SERIAL and DM_CLK Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200802150551.114604-1-marek.vasut+renesas@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.