Exemple #1
0
    def get_ACPI_table( self, name, isfile = False ):
        acpi_tables_data = []
        if isfile:
            acpi_tables_data.append(chipsec.file.read_file( name ))
        else:
            try:
                # 1. Try to extract ACPI table(s) from physical memory
                #    read_physical_mem can be implemented using both
                #    CHIPSEC kernel module and OS native API
                if logger().HAL: logger().log( "[acpi] trying to extract ACPI table from physical memory..." )
                for table_address in self.tableList[name]:
                    t_size = self.cs.mem.read_physical_mem_dword( table_address + 4 )
                    t_data = self.cs.mem.read_physical_mem( table_address, t_size )
                    acpi_tables_data.append( t_data )
            except chipsec.helper.oshelper.UnimplementedNativeAPIError:
                # 2. If didn't work, try using get_ACPI_table if a helper implemented
                #    reading ACPI tables via native API which some OS may provide
                if self.cs.use_native_api():
                    if logger().HAL: logger().log( "[acpi] trying to extract ACPI table using get_ACPI_table..." )
                    t_data = self.cs.helper.get_ACPI_table( name )
                    acpi_tables_data.append( t_data )

        acpi_tables = []
        for data in acpi_tables_data:
            acpi_tables.append((data[ : ACPI_TABLE_HEADER_SIZE ], data[ ACPI_TABLE_HEADER_SIZE : ]))

        return acpi_tables
Exemple #2
0
    def get_ACPI_table( self, name, isfile = False ):
        acpi_tables_data = []
        if isfile:
            acpi_tables_data.append(chipsec.file.read_file( name ))
        else:
            try:
                # 1. Try to extract ACPI table(s) from physical memory
                #    read_physical_mem can be implemented using both
                #    CHIPSEC kernel module and OS native API
                if logger().HAL: logger().log( "[acpi] trying to extract ACPI table from physical memory..." )
                for table_address in self.tableList[name]:
                    t_size = self.cs.mem.read_physical_mem_dword( table_address + 4 )
                    t_data = self.cs.mem.read_physical_mem( table_address, t_size )
                    acpi_tables_data.append( t_data )
            except oshelper.UnimplementedNativeAPIError:
                # 2. If didn't work, try using get_ACPI_table if a helper implemented
                #    reading ACPI tables via native API which some OS may provide
                if self.cs.use_native_api():
                    if logger().HAL: logger().log( "[acpi] trying to extract ACPI table using get_ACPI_table..." )
                    t_data = self.cs.helper.get_ACPI_table( name )
                    acpi_tables_data.append( t_data )

        acpi_tables = []
        for data in acpi_tables_data:
            acpi_tables.append((data[ : ACPI_TABLE_HEADER_SIZE ], data[ ACPI_TABLE_HEADER_SIZE : ]))

        return acpi_tables
Exemple #3
0
    def get_ACPI_table( self, name, isfile = False ):
        acpi_tables_data = []
        if isfile:
            acpi_tables_data.append(chipsec.file.read_file( name ))
        else:
            for table_address in self.tableList[name]:
                t_data = None
                t_size = self.cs.mem.read_physical_mem_dword( table_address + 4 )
                t_data = self.cs.mem.read_physical_mem( table_address, t_size )

                acpi_tables_data.append( t_data )

        acpi_tables = []
        for t_data in acpi_tables_data:
            table_header_blob  = None
            table_blob = None

            if t_data is not None:
                table_header_blob  = t_data[ : ACPI_TABLE_HEADER_SIZE ]
                table_blob         = t_data[ ACPI_TABLE_HEADER_SIZE : ]

            acpi_tables.append((table_header_blob, table_blob))

        return acpi_tables
Exemple #4
0
    def get_ACPI_table(self, name, isfile=False):
        acpi_tables_data = []
        if isfile:
            acpi_tables_data.append(chipsec.file.read_file(name))
        else:
            for table_address in self.tableList[name]:
                t_data = None
                t_size = self.cs.mem.read_physical_mem_dword(table_address + 4)
                t_data = self.cs.mem.read_physical_mem(table_address, t_size)

                acpi_tables_data.append(t_data)

        acpi_tables = []
        for t_data in acpi_tables_data:
            table_header_blob = None
            table_blob = None

            if t_data is not None:
                table_header_blob = t_data[:ACPI_TABLE_HEADER_SIZE]
                table_blob = t_data[ACPI_TABLE_HEADER_SIZE:]

            acpi_tables.append((table_header_blob, table_blob))

        return acpi_tables