From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andre Przywara Date: Wed, 1 Mar 2017 02:25:13 +0000 Subject: [U-Boot] [PATCH 01/17] armv8: spl: Call spl_relocate_stack_gd for ARMv8 In-Reply-To: <1488335129-12363-1-git-send-email-andre.przywara@arm.com> References: <1488335129-12363-1-git-send-email-andre.przywara@arm.com> Message-ID: <1488335129-12363-2-git-send-email-andre.przywara@arm.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Philipp Tomsich As part of the startup process for boards using the SPL, we need to call spl_relocate_stack_gd. This is needed to set up malloc with its DRAM buffer. [Andre: fix comment] Signed-off-by: Philipp Tomsich Reviewed-by: Andre Przywara Reviewed-by: Simon Glass Signed-off-by: Andre Przywara --- arch/arm/lib/crt0_64.S | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S index 19c6a98..e59fd3e 100644 --- a/arch/arm/lib/crt0_64.S +++ b/arch/arm/lib/crt0_64.S @@ -109,8 +109,18 @@ relocation_return: */ bl c_runtime_cpu_setup /* still call old routine */ #endif /* !CONFIG_SPL_BUILD */ - -/* TODO: For SPL, call spl_relocate_stack_gd() to alloc stack relocation */ +#if defined(CONFIG_SPL_BUILD) + bl spl_relocate_stack_gd /* may return NULL */ + /* + * Perform 'sp = (x0 != NULL) ? x0 : sp' while working + * around the constraint that most arm64 instructions cannot + * have 'sp' as an operand. + */ + mov x1, sp + cmp x0, #0 + csel x0, x0, x1, ne + mov sp, x0 +#endif /* * Clear BSS section -- 2.8.2