From a8c60e56c7dc6d0b04692bf1aa8773c5ffd9cfa3 Mon Sep 17 00:00:00 2001 From: JJ Date: Tue, 2 Nov 2021 09:13:49 +1100 Subject: [PATCH] Kernel/HAL: Do not rely on identity mapping in early init --- Kernel/src/Arch/x86_64/HAL.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Kernel/src/Arch/x86_64/HAL.cpp b/Kernel/src/Arch/x86_64/HAL.cpp index 8bf192a0..40c7ed2d 100755 --- a/Kernel/src/Arch/x86_64/HAL.cpp +++ b/Kernel/src/Arch/x86_64/HAL.cpp @@ -265,6 +265,8 @@ void InitStivale2(stivale2_info_header_t* st2Info) { char* cmdLine = nullptr; while (tagPhys) { + tagPhys = Memory::GetIOMapping(tagPhys); + stivale2_tag_t* tag = reinterpret_cast(tagPhys); Log::Debug(debugLevelHAL, DebugLevelVerbose, "[HAL] [stivale2] Found tag with ID: %x", tag->id); @@ -272,7 +274,7 @@ void InitStivale2(stivale2_info_header_t* st2Info) { case Stivale2TagCmdLine: { stivale2_tag_cmdline_t* cmdLineTag = reinterpret_cast(tagPhys); - cmdLine = reinterpret_cast(cmdLineTag->cmdLine); + cmdLine = reinterpret_cast(Memory::GetIOMapping(cmdLineTag->cmdLine)); break; } case Stivale2TagMemoryMap: { @@ -348,7 +350,7 @@ void InitStivale2(stivale2_info_header_t* st2Info) { case Stivale2TagACPIRSDP: { stivale2_tag_rsdp_t* rsdpTag = reinterpret_cast(tag); - ACPI::SetRSDP(reinterpret_cast(rsdpTag->rsdp)); + ACPI::SetRSDP(new acpi_xsdp_t(*reinterpret_cast(Memory::GetIOMapping(rsdpTag->rsdp)))); break; } default: