Skip to contentSkip to conversation

ARM: qemu-virt64: convert to assembly entry

PATCH Applied Lucas Stach 2 participants 2 messages Jan 14, 2020 – Jan 16, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 arch/arm/boards/qemu-virt64/Makefile        |  2 +-
 arch/arm/boards/qemu-virt64/lowlevel.c      |  4 +++-
 arch/arm/boards/qemu-virt64/lowlevel_init.S | 12 ++++++++++++
 3 files changed, 16 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/boards/qemu-virt64/lowlevel_init.S
arch/arm/boards/qemu-virt64/Makefile +1 -1
index e35460754898..b394dde0a1fe 100644
@@ -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
arch/arm/boards/qemu-virt64/lowlevel.c +3 -1
index 629e2e9f6ecf..fcb052369abc 100644
@@ -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);
arch/arm/boards/qemu-virt64/lowlevel_init.S new file +12 -0
new file mode 100644
index 000000000000..1967fadb6cbe
@@ -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)
Signature · 7 lines
2.24.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#1 lore raw
Quoted 5 lines · Lucas Stach

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.

Quoted 7 lines
---
 arch/arm/boards/qemu-virt64/Makefile        |  2 +-
 arch/arm/boards/qemu-virt64/lowlevel.c      |  4 +++-
 arch/arm/boards/qemu-virt64/lowlevel_init.S | 12 ++++++++++++
 3 files changed, 16 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/boards/qemu-virt64/lowlevel_init.S

Applied, thanks

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox