diff --git a/kernel/include/kernel/ACPI/AML/DataObject.h b/kernel/include/kernel/ACPI/AML/DataObject.h index 943830a592..e93ef2f536 100644 --- a/kernel/include/kernel/ACPI/AML/DataObject.h +++ b/kernel/include/kernel/ACPI/AML/DataObject.h @@ -58,9 +58,10 @@ namespace Kernel::ACPI::AML }; struct DataRefObject; + struct Uninitialized {}; // PackageElement := DataRefObject | NameString - using PackageElement = BAN::Variant, NameString>; + using PackageElement = BAN::Variant, NameString, Uninitialized>; // DefPackage := PackageOp PkgLength NumElements PackageElementList struct Package diff --git a/kernel/kernel/ACPI/AML/DataObject.cpp b/kernel/kernel/ACPI/AML/DataObject.cpp index 29572590ef..b4a032b887 100644 --- a/kernel/kernel/ACPI/AML/DataObject.cpp +++ b/kernel/kernel/ACPI/AML/DataObject.cpp @@ -198,7 +198,7 @@ namespace Kernel::ACPI AML_DEBUG_PRINT("Count: {}", count); \ \ BAN::Vector elements; \ - for (uint8_t i = 0; i < count; i++) \ + for (uint8_t i = 0; package_span.size() > 0 && i < count; i++) \ { \ if (DataRefObject::can_parse(package_span)) \ { \ @@ -221,6 +221,9 @@ namespace Kernel::ACPI } \ } \ \ + while (elements.size() < count) \ + MUST(elements.push_back(PackageElement { Uninitialized {} })); \ + \ return NAME { .elements = BAN::move(elements) }; \ }