Kernel: ACPI implement integer stores to registers as copies

Before storing const integer and then modifying the register it would
error.
This commit is contained in:
Bananymous 2024-06-25 23:23:15 +03:00
parent 2fccff5a35
commit f671ed7e3f
3 changed files with 5 additions and 1 deletions

View File

@ -30,6 +30,8 @@ namespace Kernel::ACPI::AML
, constant(constant) , constant(constant)
{} {}
BAN::RefPtr<Node> copy() override { return MUST(BAN::RefPtr<Integer>::create(value)); }
BAN::RefPtr<AML::Node> evaluate() override BAN::RefPtr<AML::Node> evaluate() override
{ {
return this; return this;

View File

@ -43,6 +43,8 @@ namespace Kernel::ACPI::AML
virtual bool is_scope() const { return false; } virtual bool is_scope() const { return false; }
virtual BAN::RefPtr<Node> copy() { return this; }
[[nodiscard]] BAN::Optional<uint64_t> as_integer(); [[nodiscard]] BAN::Optional<uint64_t> as_integer();
[[nodiscard]] virtual BAN::RefPtr<AML::Node> evaluate() { AML_TODO("evaluate, type {}", static_cast<uint8_t>(type)); return nullptr; } [[nodiscard]] virtual BAN::RefPtr<AML::Node> evaluate() { AML_TODO("evaluate, type {}", static_cast<uint8_t>(type)); return nullptr; }
[[nodiscard]] virtual bool store(BAN::RefPtr<AML::Node>) { AML_TODO("store, type {}", static_cast<uint8_t>(type)); return false; } [[nodiscard]] virtual bool store(BAN::RefPtr<AML::Node>) { AML_TODO("store, type {}", static_cast<uint8_t>(type)); return false; }

View File

@ -32,7 +32,7 @@ namespace Kernel::ACPI::AML
AML_ERROR("Failed to evaluate source for store"); AML_ERROR("Failed to evaluate source for store");
return false; return false;
} }
value = evaluated; value = evaluated->copy();
return true; return true;
} }