Kernel: Rename Aarch64Asm -> ASM_wrapper and add Aarch64::Asm namespace
This commit is contained in:
parent
34709c8d39
commit
4a4a3193f8
Notes:
sideshowbarker
2024-07-18 00:32:53 +09:00
Author: https://github.com/jamesmintram Commit: https://github.com/SerenityOS/serenity/commit/4a4a3193f84 Pull-request: https://github.com/SerenityOS/serenity/pull/10514 Reviewed-by: https://github.com/mundak ✅ Reviewed-by: https://github.com/nico
8 changed files with 28 additions and 34 deletions
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include <Kernel/Arch/aarch64/Registers.h>
|
||||
|
||||
namespace Kernel {
|
||||
namespace Kernel::Aarch64::Asm {
|
||||
|
||||
inline void set_ttbr1_el1(FlatPtr ttbr1_el1)
|
||||
{
|
|
@ -13,11 +13,6 @@ void init_prekernel_page_tables();
|
|||
|
||||
[[noreturn]] void panic(const char* msg);
|
||||
|
||||
[[noreturn]] inline void halt()
|
||||
{
|
||||
for (;;) {
|
||||
asm volatile("wfi");
|
||||
}
|
||||
}
|
||||
[[noreturn]] void halt();
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <Kernel/Prekernel/Arch/aarch64/Prekernel.h>
|
||||
|
||||
#include <Kernel/Arch/aarch64/Aarch64Asm.h>
|
||||
#include <Kernel/Arch/aarch64/ASM_wrapper.h>
|
||||
#include <Kernel/Prekernel/Arch/aarch64/UART.h>
|
||||
|
||||
namespace Prekernel {
|
||||
|
@ -19,7 +19,14 @@ namespace Prekernel {
|
|||
uart.print_str(msg);
|
||||
}
|
||||
|
||||
Kernel::halt();
|
||||
Prekernel::halt();
|
||||
}
|
||||
|
||||
[[noreturn]] void halt()
|
||||
{
|
||||
for (;;) {
|
||||
asm volatile("wfi");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <Kernel/Arch/aarch64/Aarch64Asm.h>
|
||||
#include <Kernel/Arch/aarch64/ASM_wrapper.h>
|
||||
#include <Kernel/Arch/aarch64/Registers.h>
|
||||
#include <Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h>
|
||||
#include <Kernel/Prekernel/Arch/aarch64/Prekernel.h>
|
||||
|
@ -82,14 +82,14 @@ static void set_up_el1()
|
|||
|
||||
void drop_to_exception_level_1()
|
||||
{
|
||||
switch (Kernel::get_current_exception_level()) {
|
||||
case ExceptionLevel::EL3:
|
||||
switch (Kernel::Aarch64::Asm::get_current_exception_level()) {
|
||||
case Kernel::Aarch64::Asm::ExceptionLevel::EL3:
|
||||
drop_to_el2();
|
||||
[[fallthrough]];
|
||||
case ExceptionLevel::EL2:
|
||||
case Kernel::Aarch64::Asm::ExceptionLevel::EL2:
|
||||
drop_to_el1();
|
||||
[[fallthrough]];
|
||||
case ExceptionLevel::EL1:
|
||||
case Kernel::Aarch64::Asm::ExceptionLevel::EL1:
|
||||
set_up_el1();
|
||||
break;
|
||||
default: {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include <Kernel/Prekernel/Arch/aarch64/Prekernel.h>
|
||||
|
||||
#include <Kernel/Arch/aarch64/Aarch64Asm.h>
|
||||
#include <Kernel/Arch/aarch64/ASM_wrapper.h>
|
||||
#include <Kernel/Arch/aarch64/Registers.h>
|
||||
#include <Kernel/Prekernel/Arch/aarch64/UART.h>
|
||||
|
||||
|
@ -108,8 +108,8 @@ static void build_identity_map(page_table_t page_table)
|
|||
|
||||
static void switch_to_page_table(u8* page_table)
|
||||
{
|
||||
set_ttbr0_el1((FlatPtr)page_table);
|
||||
set_ttbr1_el1((FlatPtr)page_table);
|
||||
Aarch64::Asm::set_ttbr0_el1((FlatPtr)page_table);
|
||||
Aarch64::Asm::set_ttbr1_el1((FlatPtr)page_table);
|
||||
}
|
||||
|
||||
static void activate_mmu()
|
||||
|
@ -144,7 +144,7 @@ static void activate_mmu()
|
|||
sctlr_el1.M = 1; //Enable MMU
|
||||
Aarch64::SCTLR_EL1::write(sctlr_el1);
|
||||
|
||||
flush();
|
||||
Aarch64::Asm::flush();
|
||||
}
|
||||
|
||||
void init_prekernel_page_tables()
|
||||
|
|
|
@ -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, halt
|
||||
cbnz x13, _ZN9Prekernel4haltEv
|
||||
|
||||
// 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,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include <AK/Types.h>
|
||||
|
||||
#include <Kernel/Arch/aarch64/Aarch64Asm.h>
|
||||
#include <Kernel/Arch/aarch64/ASM_wrapper.h>
|
||||
#include <Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h>
|
||||
#include <Kernel/Prekernel/Arch/aarch64/BootPPMParser.h>
|
||||
#include <Kernel/Prekernel/Arch/aarch64/Framebuffer.h>
|
||||
|
@ -20,6 +20,8 @@
|
|||
static void draw_logo();
|
||||
static u32 query_firmware_version();
|
||||
|
||||
extern "C" void wait_cycles(int n);
|
||||
|
||||
extern "C" [[noreturn]] void halt();
|
||||
extern "C" [[noreturn]] void init();
|
||||
|
||||
|
@ -37,7 +39,7 @@ extern "C" [[noreturn]] void init()
|
|||
uart.print_str("\r\n");
|
||||
|
||||
uart.print_str("CPU started in: EL");
|
||||
uart.print_num(static_cast<u64>(Kernel::get_current_exception_level()));
|
||||
uart.print_num(static_cast<u64>(Kernel::Aarch64::Asm::get_current_exception_level()));
|
||||
uart.print_str("\r\n");
|
||||
|
||||
uart.print_str("Drop CPU to EL1\r\n");
|
||||
|
@ -71,21 +73,14 @@ extern size_t __stack_chk_guard;
|
|||
size_t __stack_chk_guard;
|
||||
extern "C" [[noreturn]] void __stack_chk_fail();
|
||||
|
||||
[[noreturn]] void halt()
|
||||
{
|
||||
for (;;) {
|
||||
asm volatile("wfi");
|
||||
}
|
||||
}
|
||||
|
||||
void __stack_chk_fail()
|
||||
{
|
||||
halt();
|
||||
Prekernel::halt();
|
||||
}
|
||||
|
||||
[[noreturn]] void __assertion_failed(char const*, char const*, unsigned int, char const*)
|
||||
{
|
||||
halt();
|
||||
Prekernel::halt();
|
||||
}
|
||||
|
||||
class QueryFirmwareVersionMboxMessage : Prekernel::Mailbox::Message {
|
||||
|
@ -160,7 +155,7 @@ static void draw_logo()
|
|||
break;
|
||||
default:
|
||||
Prekernel::warnln("Unsupported pixel format");
|
||||
halt();
|
||||
Prekernel::halt();
|
||||
}
|
||||
|
||||
logo_pixels += 3;
|
||||
|
|
|
@ -24,9 +24,6 @@ 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
|
||||
|
|
Loading…
Add table
Reference in a new issue