Kernel: Fix AML Register/Reference accesses

This commit is contained in:
Bananymous 2024-08-15 20:55:18 +03:00
parent eaf06d239c
commit 4dc107f77a
3 changed files with 10 additions and 5 deletions

View File

@ -69,9 +69,12 @@ namespace Kernel::ACPI::AML
if (!parse_result.success())
return ParseResult::Failure;
object = parse_result.node();
}
if (object && object->type == AML::Node::Type::Reference)
object = static_cast<AML::Reference*>(object.ptr())->node;
if (object && object->type == AML::Node::Type::Register)
object = static_cast<AML::Register*>(object.ptr())->value;
}
if (!conditional)
{

View File

@ -22,6 +22,8 @@ namespace Kernel::ACPI::AML
if (!object_result.success())
return ParseResult::Failure;
auto object_node = object_result.node();
if (object_node && object_node->type == AML::Node::Type::Register)
object_node = static_cast<AML::Register*>(object_node.ptr())->value;
if (!object_node)
{
AML_ERROR("SizeOf object is null");

View File

@ -44,9 +44,9 @@ namespace Kernel::ACPI::AML
AML_DEBUG_PRINTLN("}");
#endif
if (!destination->store(source))
if (auto stored = destination->store(source))
return ParseResult(stored);
return ParseResult::Failure;
return ParseResult(destination);
}
};