From fb764e7fda5c44977f1aa5a43412a66f41694eb4 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Fri, 10 Jun 2011 10:34:41 +0000 Subject: [PATCH] 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 --- src/system/boot/platform/bios_ia32/acpi.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/system/boot/platform/bios_ia32/acpi.cpp b/src/system/boot/platform/bios_ia32/acpi.cpp index c1a49acf24..f05ccedad0 100644 --- a/src/system/boot/platform/bios_ia32/acpi.cpp +++ b/src/system/boot/platform/bios_ia32/acpi.cpp @@ -82,8 +82,9 @@ acpi_find_table(const char* signature) uint32* pointer = (uint32*)((uint8*)sAcpiRsdt + sizeof(acpi_descriptor_header)); + acpi_descriptor_header* header = NULL; for (int32 j = 0; j < sNumEntries; j++, pointer++) { - acpi_descriptor_header* header = (acpi_descriptor_header*) + header = (acpi_descriptor_header*) mmu_map_physical_memory(*pointer, sizeof(acpi_descriptor_header), kDefaultPageFlags); if (header == NULL @@ -99,11 +100,19 @@ acpi_find_table(const char* signature) } 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); }