Exemple #1
0
def DMAR(val):
    """Create class based on decode of an DMAR table from filename."""
    base_length = ctypes.sizeof(dmar_factory(list()))
    data = open(val, mode='rb').read()
    buf = ctypes.create_string_buffer(data, len(data))
    addr = ctypes.addressof(buf)
    hdr = TableHeader.from_address(addr)
    field_list = dmar_subtable_list(addr + base_length, hdr.length - base_length)
    return dmar_factory(field_list).from_buffer_copy(data)
Exemple #2
0
def APIC(val):
    """Create class based on decode of an APIC table from filename."""
    preamble_length = ctypes.sizeof(apic_factory(list()))
    data = open(val, mode='rb').read()
    buf = ctypes.create_string_buffer(data, len(data))
    addr = ctypes.addressof(buf)
    hdr = TableHeader.from_address(addr)
    subtable_list = apic_subtable_list(addr + preamble_length, hdr.length - preamble_length)
    return apic_factory(subtable_list).from_buffer_copy(data)
Exemple #3
0
def RTCT(val):
    """Create class based on decode of an RTCT table from filename."""
    base_length = ctypes.sizeof(rtct_factory(list(), 0))
    data = open(val, mode='rb').read()
    buf = ctypes.create_string_buffer(data, len(data))
    addr = ctypes.addressof(buf)
    hdr = TableHeader.from_address(addr)
    version, field_list = rtct_version_and_subtable_list(
        addr + base_length, hdr.length - base_length)
    return rtct_factory(field_list, version).from_buffer_copy(data)
Exemple #4
0
def FACP(val):
    """Create class based on decode of an FACP table from filename."""
    data = open(val, mode='rb').read()
    buf = ctypes.create_string_buffer(data, len(data))
    addr = ctypes.addressof(buf)
    hdr = TableHeader.from_address(addr)
    if hdr.revision < 3:
        cls = FACP_v1
    elif hdr.revision == 3:
        cls = FACP_v3
    elif hdr.revision == 4:
        cls = FACP_v4
    else:
        cls = FACP_v5
    return cls.from_buffer_copy(data)