mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
LibACPI: Add support for reading DeviceOp
Co-authored-by: RatcheT2497 <[email protected]>
This commit is contained in:
1 parent
70f7715bca
commit
afbe9b228c
3 files changed
+27
No files matched your search
@@ -255,6 +255,18 @@ ErrorOr<void> Interpreter::finalize_term_opcode(OpcodeFrame& frame, TableStream&
|
||||
m_current_field_offset = 0;
|
||||
return {};
|
||||
|
||||
case Opcode::DeviceOp: {
|
||||
auto length = TRY(frame.operand(0).as<u64>());
|
||||
auto path = TRY(frame.operand(1).as<NameString>());
|
||||
|
||||
auto node = TRY(try_make_ref_counted<DeviceNode>());
|
||||
TRY(m_scope_frames.last().insert_node(path, node));
|
||||
|
||||
auto scope_frame = ScopeFrame(m_namespace_root, node, frame.start(), frame.start() + length, m_loaded_tables.size() - 1);
|
||||
TRY(m_scope_frames.try_append(scope_frame));
|
||||
return {};
|
||||
}
|
||||
|
||||
default:
|
||||
INTERPRETER_ERROR("Unimplemented!", EINVAL, "Unimplemented term opcode {}!", frame.opcode());
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ enum class NodeType : u8 {
|
||||
Method,
|
||||
OperationRegion,
|
||||
Field,
|
||||
Device,
|
||||
};
|
||||
|
||||
class Node : public AtomicRefCounted<Node>
|
||||
@@ -171,4 +172,10 @@ private:
|
||||
u64 m_length;
|
||||
};
|
||||
|
||||
class DeviceNode : public Node {
|
||||
public:
|
||||
virtual NodeType type() const override { return NodeType::Device; }
|
||||
virtual StringView kind() const override { return "Device"sv; }
|
||||
};
|
||||
|
||||
}
|
||||
@@ -51,6 +51,12 @@ constexpr static Array<OperandType, 7> FIELD_OPERANDS = {
|
||||
OperandType::End,
|
||||
};
|
||||
|
||||
constexpr static Array<OperandType, 3> DEVICE_OPERANDS = {
|
||||
OperandType::PackageLength,
|
||||
OperandType::NameString,
|
||||
OperandType::End,
|
||||
};
|
||||
|
||||
static ErrorOr<ReadonlySpan<OperandType>> get_opcode_operand_template(Opcode opcode)
|
||||
{
|
||||
switch (opcode) {
|
||||
@@ -73,6 +79,8 @@ static ErrorOr<ReadonlySpan<OperandType>> get_opcode_operand_template(Opcode opc
|
||||
return OP_REGION_OPERANDS.span();
|
||||
case Opcode::FieldOp:
|
||||
return FIELD_OPERANDS.span();
|
||||
case Opcode::DeviceOp:
|
||||
return DEVICE_OPERANDS.span();
|
||||
|
||||
case Opcode::ZeroOp:
|
||||
case Opcode::OneOp:
|
||||
|
||||
Reference in new issue
Block a user