Skip to content

AML: PkgLength handling in *Field #187

@alnyan

Description

@alnyan

While working on my PR, I noticed that PkgLength may sometimes be handled incorrectly for *Field opcode parsing: it seems like the length needs to be checked against the corresponding Operation Region length and not the AML bytecode slice length.

The following code should be valid, but parsing it results in InvalidPkgLength if there's "not enough" bytes after the Field opcode:

OperationRegion (GIO0, SystemIO, 0x125, 0x100)

Field (GIO0, ByteAcc, NoLock, WriteAsZeros) {
   IDX0, 8,
   DAT0, 8,
   IDX1, 8,
   DAT1, 16,
   Offset(0x90),  // This line fails, but should be valid, as it's still within the GIO0 opreg
   IDX2, 8,
   DAT2, 8
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions