1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 04:58:15 +00:00

Kernel: Don't truncate physical address in ACPI table to 32 bits

We need to cast physical addresses to PhysicalPtr instead of FlatPtr,
which is currently always 64 bits. However, if one day we were to
support 32 bit non-pae mode then it would also truncate appropriately.
This commit is contained in:
Tom 2021-07-18 11:24:41 -06:00 committed by Andreas Kling
parent a635ff4e60
commit 668de76fa7

View file

@ -408,8 +408,8 @@ UNMAP_AFTER_INIT static PhysicalAddress search_table_in_xsdt(PhysicalAddress xsd
auto xsdt = map_typed<Structures::XSDT>(xsdt_address); auto xsdt = map_typed<Structures::XSDT>(xsdt_address);
for (size_t i = 0; i < ((xsdt->h.length - sizeof(Structures::SDTHeader)) / sizeof(u64)); ++i) { for (size_t i = 0; i < ((xsdt->h.length - sizeof(Structures::SDTHeader)) / sizeof(u64)); ++i) {
if (match_table_signature(PhysicalAddress((FlatPtr)xsdt->table_ptrs[i]), signature)) if (match_table_signature(PhysicalAddress((PhysicalPtr)xsdt->table_ptrs[i]), signature))
return PhysicalAddress((FlatPtr)xsdt->table_ptrs[i]); return PhysicalAddress((PhysicalPtr)xsdt->table_ptrs[i]);
} }
return {}; return {};
} }
@ -431,8 +431,8 @@ UNMAP_AFTER_INIT static PhysicalAddress search_table_in_rsdt(PhysicalAddress rsd
auto rsdt = map_typed<Structures::RSDT>(rsdt_address); auto rsdt = map_typed<Structures::RSDT>(rsdt_address);
for (u32 i = 0; i < ((rsdt->h.length - sizeof(Structures::SDTHeader)) / sizeof(u32)); i++) { for (u32 i = 0; i < ((rsdt->h.length - sizeof(Structures::SDTHeader)) / sizeof(u32)); i++) {
if (match_table_signature(PhysicalAddress((FlatPtr)rsdt->table_ptrs[i]), signature)) if (match_table_signature(PhysicalAddress((PhysicalPtr)rsdt->table_ptrs[i]), signature))
return PhysicalAddress((FlatPtr)rsdt->table_ptrs[i]); return PhysicalAddress((PhysicalPtr)rsdt->table_ptrs[i]);
} }
return {}; return {};
} }