summaryrefslogtreecommitdiffstats
path: root/src/mainboard/emulation/qemu-aarch64/bootblock_custom.S
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainboard/emulation/qemu-aarch64/bootblock_custom.S')
-rw-r--r--src/mainboard/emulation/qemu-aarch64/bootblock_custom.S36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/mainboard/emulation/qemu-aarch64/bootblock_custom.S b/src/mainboard/emulation/qemu-aarch64/bootblock_custom.S
new file mode 100644
index 000000000000..f9e85d0efc55
--- /dev/null
+++ b/src/mainboard/emulation/qemu-aarch64/bootblock_custom.S
@@ -0,0 +1,36 @@
+/*
+ * Early initialization code for aarch64 (a.k.a. armv8)
+ *
+ * Copyright 2019 Asami Doi <d0iasm.pub@gmail.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include <arch/asm.h>
+
+ENTRY(_start)
+ /* Setup CPU. */
+ bl arm64_init_cpu
+
+ /* Get code positions. */
+ ldr x1, =_flash
+ ldr x0, =_bootblock
+
+ /* Calculate bootblock size. */
+ ldr x2, =_ebootblock
+ sub x2, x2, x0
+
+ /* Call memcpy in arch/arm64/memcpy.S */
+ bl memcpy
+ dmb sy
+
+ /* Calculate relocation offset between bootblock in flash and in DRAM. */
+ ldr x0, =_flash
+ ldr x1, =_bootblock
+ sub x1, x1, x0
+
+ /* Jump to main() in DRAM. */
+ adr x0, main
+ add x0, x0, x1
+ blr x0
+ENDPROC(_start)