diff --git a/kernel/src/acpi/RSDT.cpp b/kernel/src/acpi/RSDT.cpp index 55629461..dc055293 100644 --- a/kernel/src/acpi/RSDT.cpp +++ b/kernel/src/acpi/RSDT.cpp @@ -19,19 +19,20 @@ ACPI::SDTHeader* ACPI::get_rsdt_or_xsdt() void* physical = (void*)bootboot.arch.x86_64.acpi_ptr; kdbgln("RSDT/XSDT physical address: %lx", (uint64_t)physical); - cache = (SDTHeader*)MemoryManager::get_unaligned_mapping(physical); + SDTHeader* rsdt = (SDTHeader*)MemoryManager::get_unaligned_mapping(physical); uint64_t offset = (uint64_t)physical % PAGE_SIZE; - uint64_t rsdt_pages = Utilities::get_blocks_from_size(PAGE_SIZE, (offset + cache->Length)); + uint64_t rsdt_pages = Utilities::get_blocks_from_size(PAGE_SIZE, (offset + rsdt->Length)); if (rsdt_pages > 1) { - MemoryManager::release_unaligned_mapping(cache); - cache = (SDTHeader*)MemoryManager::get_unaligned_mappings(cache, rsdt_pages); + MemoryManager::release_unaligned_mapping(rsdt); + rsdt = (SDTHeader*)MemoryManager::get_unaligned_mappings(cache, rsdt_pages); } - kdbgln("Mapped RSDT/XSDT to virtual address %lx, uses %ld pages", (uint64_t)cache, rsdt_pages); - return cache; + kdbgln("Mapped RSDT/XSDT to virtual address %lx, uses %ld pages", (uint64_t)rsdt, rsdt_pages); + cache = rsdt; + return rsdt; } bool ACPI::validate_rsdt_or_xsdt(ACPI::SDTHeader* root_sdt)