Skip to content

Commit

Permalink
Kernel/HAL: Do not rely on identity mapping in early init
Browse files Browse the repository at this point in the history
  • Loading branch information
fido2020 committed Nov 3, 2021
1 parent 8716212 commit a8c60e5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Kernel/src/Arch/x86_64/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,16 @@ void InitStivale2(stivale2_info_header_t* st2Info) {
char* cmdLine = nullptr;

while (tagPhys) {
tagPhys = Memory::GetIOMapping(tagPhys);

stivale2_tag_t* tag = reinterpret_cast<stivale2_tag_t*>(tagPhys);
Log::Debug(debugLevelHAL, DebugLevelVerbose, "[HAL] [stivale2] Found tag with ID: %x", tag->id);

switch (tag->id) {
case Stivale2TagCmdLine: {
stivale2_tag_cmdline_t* cmdLineTag = reinterpret_cast<stivale2_tag_cmdline_t*>(tagPhys);

cmdLine = reinterpret_cast<char*>(cmdLineTag->cmdLine);
cmdLine = reinterpret_cast<char*>(Memory::GetIOMapping(cmdLineTag->cmdLine));
break;
}
case Stivale2TagMemoryMap: {
Expand Down Expand Up @@ -348,7 +350,7 @@ void InitStivale2(stivale2_info_header_t* st2Info) {
case Stivale2TagACPIRSDP: {
stivale2_tag_rsdp_t* rsdpTag = reinterpret_cast<stivale2_tag_rsdp_t*>(tag);

ACPI::SetRSDP(reinterpret_cast<acpi_xsdp_t*>(rsdpTag->rsdp));
ACPI::SetRSDP(new acpi_xsdp_t(*reinterpret_cast<acpi_xsdp_t*>(Memory::GetIOMapping(rsdpTag->rsdp))));
break;
}
default:
Expand Down

0 comments on commit a8c60e5

Please sign in to comment.