From d729d7f57074bdb4612a1973169537b6e45b210b Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 15 Aug 2024 23:12:52 +0300 Subject: [PATCH] Kernel: Implement AML storing to Buffer --- kernel/include/kernel/ACPI/AML/Buffer.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/kernel/include/kernel/ACPI/AML/Buffer.h b/kernel/include/kernel/ACPI/AML/Buffer.h index ffb6cf46..a48f3385 100644 --- a/kernel/include/kernel/ACPI/AML/Buffer.h +++ b/kernel/include/kernel/ACPI/AML/Buffer.h @@ -46,6 +46,23 @@ namespace Kernel::ACPI::AML return {}; } + BAN::RefPtr store(BAN::RefPtr node) override + { + ASSERT(node); + auto conv_node = node->convert(AML::Node::ConvBuffer); + if (!conv_node) + { + AML_ERROR("Buffer store could not convert to buffer"); + return {}; + } + + auto& conv_buffer = static_cast(conv_node.ptr())->buffer; + MUST(buffer.resize(conv_buffer.size())); + for (size_t i = 0; i < buffer.size(); i++) + buffer[i] = conv_buffer[i]; + return this; + } + static ParseResult parse(AML::ParseContext& context) { ASSERT(context.aml_data.size() >= 1);