summaryrefslogtreecommitdiff
path: root/Kernel/Prekernel/Arch/aarch64
diff options
context:
space:
mode:
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 (;;) { }
+}