summaryrefslogtreecommitdiff
path: root/Kernel/Arch/aarch64/Aarch64_asm_utils.S
diff options
context:
space:
mode:
authorJakub V. Flasar <38976370+Kubiisek@users.noreply.github.com>2022-03-08 18:21:40 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2022-03-12 14:54:12 -0800
commit6d2c298b66a9dedbb0c32623e2aef187edce77b3 (patch)
treede441af6769da016638632af14d472568e210915 /Kernel/Arch/aarch64/Aarch64_asm_utils.S
parentf94293f1216f4843dcba87c8809f17cb619e154f (diff)
downloadserenity-6d2c298b66a9dedbb0c32623e2aef187edce77b3.zip
Kernel: Move aarch64 Prekernel into Kernel
As there is no need for a Prekernel on aarch64, the Prekernel code was moved into Kernel itself. The functionality remains the same. SERENITY_KERNEL_AND_INITRD in run.sh specifies a kernel and an inital ramdisk to be used by the emulator. This is needed because aarch64 does not need a Prekernel and the other ones do.
Diffstat (limited to 'Kernel/Arch/aarch64/Aarch64_asm_utils.S')
-rw-r--r--Kernel/Arch/aarch64/Aarch64_asm_utils.S48
1 files changed, 48 insertions, 0 deletions
diff --git a/Kernel/Arch/aarch64/Aarch64_asm_utils.S b/Kernel/Arch/aarch64/Aarch64_asm_utils.S
new file mode 100644
index 0000000000..33f2d4de7f
--- /dev/null
+++ b/Kernel/Arch/aarch64/Aarch64_asm_utils.S
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2021, Nico Weber <thakis@chromium.org>
+ * Copyright (c) 2021, Marcin Undak <mcinek@gmail.com>
+ * Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+.global wait_cycles
+.type wait_cycles, @function
+wait_cycles:
+Lstart:
+ // This is probably too fast when caching and branch prediction is turned on.
+ // FIXME: Make timer-based.
+ subs x0, x0, #1
+ bne Lstart
+ ret
+
+.global enter_el2_from_el3
+.type enter_el2_from_el3, @function
+enter_el2_from_el3:
+ adr x0, entered_el2
+ msr elr_el3, x0
+ eret
+entered_el2:
+ ret
+
+.global enter_el1_from_el2
+.type enter_el1_from_el2, @function
+enter_el1_from_el2:
+ adr x0, entered_el1
+ msr elr_el2, x0
+ eret
+entered_el1:
+ ret
+
+//
+// Installs the EL1 vector table
+// Args:
+// x0 - Address of vector table
+//
+// This function doesn't return a value
+//
+.global el1_vector_table_install
+.type el1_vector_table_install, @function
+el1_vector_table_install:
+ msr VBAR_EL1, x0
+ ret