diff options
author | James Mintram <me@jamesrm.com> | 2021-11-21 01:08:07 +0000 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-11-28 22:01:21 -0800 |
commit | c2d7e200eb1cc01567e635b2d84ab59505521feb (patch) | |
tree | 245fedf5754c8ddf9ad25f0ce4b4ac56acb6d3b4 /Kernel/Prekernel | |
parent | 68b5d00f422bb05ca7d4ffdc692dd0c38411332e (diff) | |
download | serenity-c2d7e200eb1cc01567e635b2d84ab59505521feb.zip |
Kernel: Move common aarch64 asm functions into kernel folder and NS
Diffstat (limited to 'Kernel/Prekernel')
-rw-r--r-- | Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.S | 8 | ||||
-rw-r--r-- | Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h | 8 | ||||
-rw-r--r-- | Kernel/Prekernel/Arch/aarch64/PrekernelExceptions.cpp | 3 | ||||
-rw-r--r-- | Kernel/Prekernel/Arch/aarch64/init.cpp | 3 | ||||
-rw-r--r-- | Kernel/Prekernel/CMakeLists.txt | 3 |
5 files changed, 7 insertions, 18 deletions
diff --git a/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.S b/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.S index e9eba54b8f..026d5c625f 100644 --- a/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.S +++ b/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.S @@ -5,14 +5,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -.global get_current_exception_level -.type get_current_exception_level, @function -get_current_exception_level: - mrs x0, CurrentEL - lsr x0, x0, #2 - and x0, x0, #0x3 - ret - .global wait_cycles .type wait_cycles, @function wait_cycles: diff --git a/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h b/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h index f95d89f754..5bae046bfe 100644 --- a/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h +++ b/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h @@ -6,14 +6,6 @@ #pragma once -enum class ExceptionLevel : u8 { - EL0 = 0, - EL1 = 1, - EL2 = 2, - EL3 = 3, -}; - -extern "C" ExceptionLevel get_current_exception_level(); extern "C" void wait_cycles(int n); // CPU initialization functions diff --git a/Kernel/Prekernel/Arch/aarch64/PrekernelExceptions.cpp b/Kernel/Prekernel/Arch/aarch64/PrekernelExceptions.cpp index 052675399a..d7de7fccd7 100644 --- a/Kernel/Prekernel/Arch/aarch64/PrekernelExceptions.cpp +++ b/Kernel/Prekernel/Arch/aarch64/PrekernelExceptions.cpp @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include <Kernel/Arch/aarch64/Aarch64Asm.h> #include <Kernel/Arch/aarch64/Aarch64Registers.h> #include <Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h> #include <Kernel/Prekernel/Arch/aarch64/Prekernel.h> @@ -81,7 +82,7 @@ static void set_up_el1() void drop_to_exception_level_1() { - switch (get_current_exception_level()) { + switch (Kernel::get_current_exception_level()) { case ExceptionLevel::EL3: drop_to_el2(); [[fallthrough]]; diff --git a/Kernel/Prekernel/Arch/aarch64/init.cpp b/Kernel/Prekernel/Arch/aarch64/init.cpp index ced40d4f64..254ee5936b 100644 --- a/Kernel/Prekernel/Arch/aarch64/init.cpp +++ b/Kernel/Prekernel/Arch/aarch64/init.cpp @@ -7,6 +7,7 @@ #include <AK/Types.h> +#include <Kernel/Arch/aarch64/Aarch64Asm.h> #include <Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h> #include <Kernel/Prekernel/Arch/aarch64/BootPPMParser.h> #include <Kernel/Prekernel/Arch/aarch64/Framebuffer.h> @@ -36,7 +37,7 @@ extern "C" [[noreturn]] void init() uart.print_str("\r\n"); uart.print_str("CPU started in: EL"); - uart.print_num(static_cast<u64>(get_current_exception_level())); + uart.print_num(static_cast<u64>(Kernel::get_current_exception_level())); uart.print_str("\r\n"); uart.print_str("Drop CPU to EL1\r\n"); diff --git a/Kernel/Prekernel/CMakeLists.txt b/Kernel/Prekernel/CMakeLists.txt index 859d85856c..de2bb6fa06 100644 --- a/Kernel/Prekernel/CMakeLists.txt +++ b/Kernel/Prekernel/CMakeLists.txt @@ -23,6 +23,9 @@ if ("${SERENITY_ARCH}" STREQUAL "aarch64") # Assembly Arch/aarch64/boot.S Arch/aarch64/Aarch64_asm_utils.S + + # Shared with kernel + ../Arch/aarch64/Aarch64Asm.cpp ) else() set(SOURCES |