entries.bend checks
raw source on the hub · import bend-osdev-acpi@0.1.2.0/entries.bend as Entries
bend-osdev-acpi, entries.bend: the variable-length sub-structures that the MADT (ACPI 6.5, section 5.2.12) and the SRAT (5.2.16) carry after their fixed fields. Each begins with a type byte and a length byte (the structure's whole length, these two bytes included).
4 imports
import Base import bend-osdev-bytes@0.1.1.1/bytes.bend as B import ./error.bend as E import ./fields.bend as F
Types
type AcpiRawEntry source · line 12 · raw
Data
one structure: its type, its offset from the start of the table, and its bytes (the type and length bytes included)
AcpiRawEntry@kind:U32 -> @offset:Nat -> @data:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> AcpiRawEntry
type AcpiEntNext source · line 27 · raw
Data
what comes next in the bytes: nothing, a structure of type k and length l, or a structure of type k whose length is bad
AcpiEntEndAcpiEntNext
AcpiEntOk@kind:U32 -> @len:Nat -> AcpiEntNext
AcpiEntBad@kind:U32 -> AcpiEntNext
Definitions
def AcpiRawEntry.kind source · line 15 · raw
@e:AcpiRawEntry -> U32
def AcpiRawEntry.data source · line 20 · raw
@e:AcpiRawEntry -> 0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets
def ent.next.pick source · line 32 · raw
@ok:Bool -> @+k:U32 -> @l:Nat -> AcpiEntNext
def ent.next.go source · line 39 · raw
@empty:Bool -> @+o:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> @+n:Nat -> AcpiEntNext
def ent.next source · line 47 · raw
@+o:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> AcpiEntNext
def ent.rev source · line 51 · raw
@xs:List<&2, AcpiRawEntry> -> @acc:List<&2, AcpiRawEntry> -> List<&2, AcpiRawEntry>
def ent.go source · line 59 · raw
@fuel:Nat -> @nx:AcpiEntNext -> @+o:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> @+off:Nat -> @acc:List<&2, AcpiRawEntry> -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, List<&2, AcpiRawEntry>>
every structure consumes at least 2 bytes, so len(o) steps are enough
def AcpiRawEntry.split source · line 75 · raw
@+o:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> @+off:Nat -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, List<&2, AcpiRawEntry>>
the structures in o, which starts at offset off of its table; AcpiBadEntry names the first one whose length is below 2 or runs past the end
def AcpiRawEntry.encode source · line 80 · raw
@+k:U32 -> @+body:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> 0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets
the structure as bytes: its type, its length, then body (the bytes after the two header bytes)