summaryrefslogtreecommitdiff
path: root/Kernel/Prekernel/Arch/aarch64
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2021-09-06 13:11:16 -0400
committerLinus Groh <mail@linusgroh.de>2021-09-06 21:57:59 +0100
commit62bc238ac3b2482033358deac0c728d351c16f57 (patch)
tree556c951034d2a4f1209e54d40dea710d620895cd /Kernel/Prekernel/Arch/aarch64
parentf1d1418256639775bfcafff51bbe920df4a30e65 (diff)
downloadserenity-62bc238ac3b2482033358deac0c728d351c16f57.zip
Kernel: Let aarch64 port call into C++
Put all but the first core into a loop, make room for some stack, and call init().
Diffstat (limited to 'Kernel/Prekernel/Arch/aarch64')
-rw-r--r--Kernel/Prekernel/Arch/aarch64/boot.S13
-rw-r--r--Kernel/Prekernel/Arch/aarch64/init.cpp11
2 files changed, 23 insertions, 1 deletions
diff --git a/Kernel/Prekernel/Arch/aarch64/boot.S b/Kernel/Prekernel/Arch/aarch64/boot.S
index 25c0fcb7ea..acb60dc455 100644
--- a/Kernel/Prekernel/Arch/aarch64/boot.S
+++ b/Kernel/Prekernel/Arch/aarch64/boot.S
@@ -9,7 +9,18 @@
.global start
.type start, @function
start:
- b Lhalt
+ // Let only core 0 continue, put other cores to sleep.
+ mrs x13, MPIDR_EL1
+ and x13, x13, 0xff
+ cbnz x13, Lhalt
+
+ // Let stack start before .text for now.
+ // 512 kiB (0x8000) of stack are probably not sufficient, especially once we give the other cores some stack too,
+ // but for now it's ok.
+ ldr x14, =start
+ mov sp, x14
+
+ b init
Lhalt:
wfi
diff --git a/Kernel/Prekernel/Arch/aarch64/init.cpp b/Kernel/Prekernel/Arch/aarch64/init.cpp
new file mode 100644
index 0000000000..86af24a419
--- /dev/null
+++ b/Kernel/Prekernel/Arch/aarch64/init.cpp
@@ -0,0 +1,11 @@
+/*
+ * Copyright (c) 2021, Nico Weber <thakis@chromium.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+extern "C" [[noreturn]] void init();
+extern "C" [[noreturn]] void init()
+{
+ for (;;) { }
+}