forked from Bananymous/banan-os
Kernel: Fix AML package parsing
This commit is contained in:
parent
e01c049401
commit
22bc4b4271
|
@ -58,9 +58,10 @@ namespace Kernel::ACPI::AML
|
|||
};
|
||||
|
||||
struct DataRefObject;
|
||||
struct Uninitialized {};
|
||||
|
||||
// PackageElement := DataRefObject | NameString
|
||||
using PackageElement = BAN::Variant<BAN::UniqPtr<DataRefObject>, NameString>;
|
||||
using PackageElement = BAN::Variant<BAN::UniqPtr<DataRefObject>, NameString, Uninitialized>;
|
||||
|
||||
// DefPackage := PackageOp PkgLength NumElements PackageElementList
|
||||
struct Package
|
||||
|
|
|
@ -198,7 +198,7 @@ namespace Kernel::ACPI
|
|||
AML_DEBUG_PRINT("Count: {}", count); \
|
||||
\
|
||||
BAN::Vector<PackageElement> 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) }; \
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue