rust-osdev/acpi

AML: Implement ObjReference type values

alnyan opened this issue · 0 comments

The aml crate currently does not have support for reference-typed values. Implementing them allows us to support DeRefOf/Index/RefOf/CondRefOf opcodes which are quite common in real-hardware AML.

One way to implement that may be to introduce two extra AmlValue variants as well as a reference target enum:

enum AmlReference {
  Handle(AmlHandle),
  Local(u8),
  Arg(u8)
}

enum AmlValue {
  // ...
  Reference(AmlReference), // Just a reference to some object
  IndexReference(AmlReference, u64), // Similar, but with an index
}

Extra consideration may also be needed for handling references that may be returned from functions (AFAIK the ACPI spec doesn't disallow that and iasl happily compiles methods returning references to their locals).

I opened the issue so we can discuss it and pick the best way to implement the feature.

Related issue: #141