From e80d8d697c0464d1cd86dccf183998615b9f43fc Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Mon, 9 May 2022 13:33:35 +0200 Subject: [PATCH] Kernel: Replace Prekernel::halt with Processor::halt in aarch64 build This allows us to get rid of one more Prekernel file. --- Kernel/Arch/aarch64/Prekernel/Prekernel.h | 2 -- .../aarch64/Prekernel/PrekernelCommon.cpp | 21 ------------------- Kernel/Arch/aarch64/Prekernel/boot.S | 2 +- Kernel/Arch/aarch64/Processor.cpp | 7 +++++++ Kernel/Arch/aarch64/Processor.h | 5 +---- Kernel/Arch/aarch64/init.cpp | 2 +- Kernel/CMakeLists.txt | 1 - 7 files changed, 10 insertions(+), 30 deletions(-) delete mode 100644 Kernel/Arch/aarch64/Prekernel/PrekernelCommon.cpp diff --git a/Kernel/Arch/aarch64/Prekernel/Prekernel.h b/Kernel/Arch/aarch64/Prekernel/Prekernel.h index d86e05b1793..8763be3ccd8 100644 --- a/Kernel/Arch/aarch64/Prekernel/Prekernel.h +++ b/Kernel/Arch/aarch64/Prekernel/Prekernel.h @@ -11,6 +11,4 @@ namespace Prekernel { void drop_to_exception_level_1(); void init_prekernel_page_tables(); -[[noreturn]] void halt(); - } diff --git a/Kernel/Arch/aarch64/Prekernel/PrekernelCommon.cpp b/Kernel/Arch/aarch64/Prekernel/PrekernelCommon.cpp deleted file mode 100644 index a7836a04003..00000000000 --- a/Kernel/Arch/aarch64/Prekernel/PrekernelCommon.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2021, James Mintram - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include - -#include -#include - -namespace Prekernel { - -[[noreturn]] void halt() -{ - for (;;) { - asm volatile("wfi"); - } -} - -} diff --git a/Kernel/Arch/aarch64/Prekernel/boot.S b/Kernel/Arch/aarch64/Prekernel/boot.S index 4c44b5288ab..f4ec015a4b6 100644 --- a/Kernel/Arch/aarch64/Prekernel/boot.S +++ b/Kernel/Arch/aarch64/Prekernel/boot.S @@ -13,7 +13,7 @@ start: // Let only core 0 continue, put other cores to sleep. mrs x13, MPIDR_EL1 and x13, x13, 0xff - cbnz x13, _ZN9Prekernel4haltEv + cbnz x13, _ZN6Kernel9Processor4haltEv // Let stack start before .text for now. // 512 kiB (0x80000) of stack are probably not sufficient, especially once we give the other cores some stack too, diff --git a/Kernel/Arch/aarch64/Processor.cpp b/Kernel/Arch/aarch64/Processor.cpp index 1cc104dfbdf..85d15037f9e 100644 --- a/Kernel/Arch/aarch64/Processor.cpp +++ b/Kernel/Arch/aarch64/Processor.cpp @@ -32,4 +32,11 @@ void Processor::initialize(u32 cpu) g_current_processor = this; } + +[[noreturn]] void Processor::halt() +{ + for (;;) + asm volatile("wfi"); +} + } diff --git a/Kernel/Arch/aarch64/Processor.h b/Kernel/Arch/aarch64/Processor.h index 17393471cf1..01a1d5c134c 100644 --- a/Kernel/Arch/aarch64/Processor.h +++ b/Kernel/Arch/aarch64/Processor.h @@ -143,10 +143,7 @@ public: VERIFY_NOT_REACHED(); } - [[noreturn]] static void halt() - { - for (;;) { } - } + [[noreturn]] static void halt(); }; } diff --git a/Kernel/Arch/aarch64/init.cpp b/Kernel/Arch/aarch64/init.cpp index da2222ffbbe..9049ac3b37a 100644 --- a/Kernel/Arch/aarch64/init.cpp +++ b/Kernel/Arch/aarch64/init.cpp @@ -102,7 +102,7 @@ extern "C" [[noreturn]] void __stack_chk_fail(); void __stack_chk_fail() { - Prekernel::halt(); + Kernel::Processor::halt(); } using namespace Kernel; diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index cae9bb2fd01..4a5d5720f83 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -400,7 +400,6 @@ else() set(PREKERNEL_SOURCES Arch/aarch64/Prekernel/Aarch64_asm_utils.S Arch/aarch64/Prekernel/boot.S - Arch/aarch64/Prekernel/PrekernelCommon.cpp Arch/aarch64/Prekernel/PrekernelExceptions.cpp Arch/aarch64/Prekernel/PrekernelMMU.cpp