+/* SPDX-License-Identifier: GPL-2.0+ */
/*
* crt0 - C-runtime startup Code for AArch64 U-Boot
*
*
* (C) Copyright 2012
* Albert ARIBAUD <albert.u.boot@aribaud.net>
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
#include <config.h>
ldr x0, =(CONFIG_TPL_STACK)
#elif defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
ldr x0, =(CONFIG_SPL_STACK)
+#elif defined(CONFIG_INIT_SP_RELATIVE)
+ adr x0, __bss_start
+ add x0, x0, #CONFIG_SYS_INIT_SP_BSS_OFFSET
#else
ldr x0, =(CONFIG_SYS_INIT_SP_ADDR)
#endif
#endif /* !CONFIG_SPL_BUILD */
#if defined(CONFIG_SPL_BUILD)
bl spl_relocate_stack_gd /* may return NULL */
+ /* set up gd here, outside any C code, if new stack is returned */
+ cmp x0, #0
+ csel x18, x0, x18, ne
/*
* Perform 'sp = (x0 != NULL) ? x0 : sp' while working
* around the constraint that conditional moves can not