From: Simon Glass <sjg@chromium.org>
Date: Fri, 10 Oct 2014 13:49:16 +0000 (-0600)
Subject: dm: x86: Support pre-reloc malloc()
X-Git-Tag: v2025.01-rc5-pxa1908~14454^2~13
X-Git-Url: http://git.dujemihanovic.xyz/img/%7B%7B?a=commitdiff_plain;h=5dbcaa2128c50b4625f17ab2d9a5a8e5182441ba;p=u-boot.git

dm: x86: Support pre-reloc malloc()

Add support for this by reserving a block of memory below global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
index 71cab22e2a..338bab19e4 100644
--- a/arch/x86/cpu/start.S
+++ b/arch/x86/cpu/start.S
@@ -97,6 +97,13 @@ car_init_ret:
 	/* Reserve space for global descriptor table */
 	subl	$X86_GDT_SIZE, %esp
 
+#if defined(CONFIG_SYS_MALLOC_F_LEN)
+	subl	$CONFIG_SYS_MALLOC_F_LEN, %esp
+	movl	%eax, %edx
+	addl	$GD_MALLOC_BASE, %edx
+	movl	%esp, (%edx)
+#endif
+
 	/* Align temporary global descriptor table to 16-byte boundary */
 	andl	$0xfffffff0, %esp