Kernel: Fix ACPI DSDT address

Read x_dsdt address only if fadt's length contains it. Bochs seems
to have version 1 fadt without the x_* fields.
This commit is contained in:
Bananymous 2023-10-29 21:35:11 +02:00
parent 229082a1b2
commit 18f61c5427
1 changed files with 4 additions and 1 deletions

View File

@ -211,7 +211,10 @@ namespace Kernel
if (memcmp(header->signature, "FACP", 4) == 0)
{
auto* fadt = (FADT*)header;
paddr_t dsdt_paddr = fadt->x_dsdt;
paddr_t dsdt_paddr = 0;
if (fadt->length > 140) // 140 is the offset of x_dsdt
dsdt_paddr = fadt->x_dsdt;
if (dsdt_paddr == 0 || !PageTable::is_valid_pointer(dsdt_paddr))
dsdt_paddr = fadt->dsdt;