diff --git a/kernel/src/acpi/RSDT.cpp b/kernel/src/acpi/RSDT.cpp index 9446e221..ebd5fd71 100644 --- a/kernel/src/acpi/RSDT.cpp +++ b/kernel/src/acpi/RSDT.cpp @@ -12,18 +12,18 @@ ACPI::SDTHeader* ACPI::GetRSDTOrXSDT() void* ACPI::FindTable(ACPI::SDTHeader* rootSDT, const char* signature) { - bool isXSDT = strncmp(rootSDT->Signature, "XSDT", 4); - int entries = (rootSDT->Length - sizeof(SDTHeader)) / isXSDT ? 8 : 4; - - printf("%d entries in root SDT\n", entries); + bool isXSDT = (strncmp(rootSDT->Signature, "XSDT", 4) == 0); + int entries = (rootSDT->Length - sizeof(SDTHeader)) / (isXSDT ? 8 : 4); for (int i = 0; i < entries; i++) { - printf("Trying this entry\n"); SDTHeader* h; if (isXSDT) h = (SDTHeader*)((XSDT*)rootSDT)->PointerToOtherSDT[i]; else - h = (SDTHeader*)(uint64_t)((RSDT*)rootSDT)->PointerToOtherSDT[i]; + { + uint32_t entry = ((RSDT*)rootSDT)->PointerToOtherSDT[i]; + h = (SDTHeader*)(uint64_t)entry; + } if (strncmp(h->Signature, signature, 4) == 0) return (void*)h; }