acpi: Fix length of RSDP calculation

This commit is contained in:
mintsuki 2021-03-10 02:27:26 +01:00
parent 0ab68fa83e
commit ab441fecda
1 changed files with 4 additions and 1 deletions

View File

@ -78,7 +78,10 @@ void *acpi_get_table(const char *signature, int index) {
else
rsdt = (struct rsdt *)(uintptr_t)rsdp->rsdt_addr;
for (size_t i = 0; i < rsdt->length - sizeof(struct sdt); i++) {
size_t entry_count =
(rsdt->length - sizeof(struct sdt)) / (use_xsdt ? 8 : 4);
for (size_t i = 0; i < entry_count; i++) {
struct sdt *ptr;
if (use_xsdt)
ptr = (struct sdt *)(uintptr_t)((uint64_t *)rsdt->ptrs_start)[i];