Map the whole table, and not just the header. Fix #7497 again (hopefully

correctly now)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42083 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2011-06-10 10:34:41 +00:00
parent 3e3ce16f5e
commit fb764e7fda

View File

@ -82,8 +82,9 @@ acpi_find_table(const char* signature)
uint32* pointer = (uint32*)((uint8*)sAcpiRsdt uint32* pointer = (uint32*)((uint8*)sAcpiRsdt
+ sizeof(acpi_descriptor_header)); + sizeof(acpi_descriptor_header));
acpi_descriptor_header* header = NULL;
for (int32 j = 0; j < sNumEntries; j++, pointer++) { for (int32 j = 0; j < sNumEntries; j++, pointer++) {
acpi_descriptor_header* header = (acpi_descriptor_header*) header = (acpi_descriptor_header*)
mmu_map_physical_memory(*pointer, mmu_map_physical_memory(*pointer,
sizeof(acpi_descriptor_header), kDefaultPageFlags); sizeof(acpi_descriptor_header), kDefaultPageFlags);
if (header == NULL if (header == NULL
@ -99,11 +100,19 @@ acpi_find_table(const char* signature)
} }
TRACE(("acpi: Found '%.4s' @ %p\n", signature, pointer)); TRACE(("acpi: Found '%.4s' @ %p\n", signature, pointer));
return header; break;
} }
// If we didn't find the table, return NULL.
return NULL; if (header == NULL)
return NULL;
// Map the whole table, not just the header
uint32 length = header->length;
mmu_free(header, sizeof(acpi_descriptor_header));
return (acpi_descriptor_header*)mmu_map_physical_memory(*pointer,
length, kDefaultPageFlags);
} }