Kernel: Fix AML if parsing

Parse else case unconditionally, even if _if_ case evaluates to true
This commit is contained in:
Bananymous 2024-04-16 17:36:04 +03:00
parent f1b2d7530d
commit e667326df5
1 changed files with 9 additions and 11 deletions

View File

@ -40,19 +40,17 @@ namespace Kernel::ACPI::AML
}
// Else
if (!predicate_integer.value())
BAN::ConstByteSpan else_pkg;
if (outer_aml_data.size() >= 1 && static_cast<Byte>(outer_aml_data[0]) == Byte::ElseOp)
{
if (outer_aml_data.size() < 1 || static_cast<Byte>(outer_aml_data[0]) != Byte::ElseOp)
context.aml_data = BAN::ConstByteSpan();
else
{
outer_aml_data = outer_aml_data.slice(1);
auto else_pkg = AML::parse_pkg(outer_aml_data);
if (!else_pkg.has_value())
return ParseResult::Failure;
context.aml_data = else_pkg.value();
}
outer_aml_data = outer_aml_data.slice(1);
auto else_pkg_result = AML::parse_pkg(outer_aml_data);
if (!else_pkg_result.has_value())
return ParseResult::Failure;
else_pkg = else_pkg_result.value();
}
if (!predicate_integer.value())
context.aml_data = else_pkg;
while (context.aml_data.size() > 0)
{