summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Stach <dev@lynxeye.de>2020-01-14 21:17:44 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-01-16 09:28:24 +0100
commitdd96bc73d798d1c92c0dc903e6e8ce9b368e17aa (patch)
treee9eb6e428a4a66cef46c8ac18af70bb359e1aa4d
parent6a1fca3a18ac01a183a787a3ccbd1d9c623391bc (diff)
downloadbarebox-dd96bc73d798d1c92c0dc903e6e8ce9b368e17aa.tar.gz
barebox-dd96bc73d798d1c92c0dc903e6e8ce9b368e17aa.tar.xz
ARM: qemu-virt64: convert to assembly entry
The C entry function isn't naked, so tries to push to the stack in the function prologue. This doesn't work on QEMU where there is no valid SP on entry. Convert the lowlevel entry to the assembly facilities provided for this case. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/boards/qemu-virt64/Makefile2
-rw-r--r--arch/arm/boards/qemu-virt64/lowlevel.c4
-rw-r--r--arch/arm/boards/qemu-virt64/lowlevel_init.S12
3 files changed, 16 insertions, 2 deletions
diff --git a/arch/arm/boards/qemu-virt64/Makefile b/arch/arm/boards/qemu-virt64/Makefile
index e354607548..b394dde0a1 100644
--- a/arch/arm/boards/qemu-virt64/Makefile
+++ b/arch/arm/boards/qemu-virt64/Makefile
@@ -1,3 +1,3 @@
obj-y += init.o
-lwl-y += lowlevel.o
+lwl-y += lowlevel.o lowlevel_init.o
bbenv-$(CONFIG_DEFAULT_ENVIRONMENT_GENERIC) += defaultenv-qemu-virt64
diff --git a/arch/arm/boards/qemu-virt64/lowlevel.c b/arch/arm/boards/qemu-virt64/lowlevel.c
index 629e2e9f6e..fcb052369a 100644
--- a/arch/arm/boards/qemu-virt64/lowlevel.c
+++ b/arch/arm/boards/qemu-virt64/lowlevel.c
@@ -10,7 +10,9 @@
#include <asm/barebox-arm.h>
#include <asm/system_info.h>
-void barebox_arm_reset_vector(uint32_t r0, uint32_t r1, uint32_t r2)
+void qemu_virt64_start(uint32_t, uint32_t, uint32_t);
+
+void noinline qemu_virt64_start(uint32_t r0, uint32_t r1, uint32_t r2)
{
arm_cpu_lowlevel_init();
arm_setup_stack(0x40000000 + SZ_2G - SZ_16K);
diff --git a/arch/arm/boards/qemu-virt64/lowlevel_init.S b/arch/arm/boards/qemu-virt64/lowlevel_init.S
new file mode 100644
index 0000000000..1967fadb6c
--- /dev/null
+++ b/arch/arm/boards/qemu-virt64/lowlevel_init.S
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <linux/linkage.h>
+#include <asm/barebox-arm64.h>
+
+/* The DRAM is already setup */
+#define STACK_TOP 0x80000000
+
+ENTRY_PROC(barebox_arm_reset_vector)
+ mov x0, #STACK_TOP
+ mov sp, x0
+ b qemu_virt64_start
+ENTRY_PROC_END(barebox_arm_reset_vector)