def free_phys_mem(self, physical_address): raise UnimplementedNativeAPIError("free_phys_mem") out_length = 8 out_buf = (c_char * out_length)() in_buf = struct.pack('<QQ', 0, physical_address) out_buf = self._ioctl(IOCTL_FREE_PHYSMEM, in_buf, out_length) return
def map_io_space(self, physical_address, length, cache_type): raise UnimplementedNativeAPIError("map_io_space") out_length = 8 out_buf = (c_char * out_length)() in_buf = struct.pack('<3Q', physical_address, length, cache_type) out_buf = self._ioctl(IOCTL_MAP_IO_SPACE, in_buf, out_length) virtual_address = struct.unpack('<Q', out_buf)[0] return virtual_address
def send_sw_smi( self, cpu_thread_id, SMI_code_data, _rax, _rbx, _rcx, _rdx, _rsi, _rdi ): raise UnimplementedNativeAPIError( "send_sw_smi" ) out_length = 0 out_buf = (c_char * out_length)() out_size = c_ulong(out_length) in_buf = struct.pack( '=H6Q', SMI_code_data, _rax, _rbx, _rcx, _rdx, _rsi, _rdi ) out_buf = self._ioctl( IOCTL_SWSMI, in_buf, out_length ) return
def load_ucode_update( self, cpu_thread_id, ucode_update_buf ): raise UnimplementedNativeAPIError( "load_ucode_update" ) in_length = len(ucode_update_buf) + 3 out_length = 0 out_buf = (c_char * out_length)() in_buf = struct.pack( '=BH', cpu_thread_id, len(ucode_update_buf) ) + ucode_update_buf out_buf = self._ioctl( IOCTL_LOAD_UCODE_PATCH, in_buf, out_length ) return True
def va2pa(self, va): raise UnimplementedNativeAPIError("va2pa") error_code = 0 in_length = 8 out_length = 8 out_buf = (c_char * out_length)() in_buf = struct.pack('Q', va) out_buf = self._ioctl(IOCTL_GET_PHYSADDR, in_buf, out_length) pa = struct.unpack('Q', out_buf)[0] return (pa, error_code)
def hypercall( self, rcx, rdx, r8, r9, r10, r11, rax, rbx, rdi, rsi, xmm_buffer ): raise UnimplementedNativeAPIError( "hypercall" ) if self.os_machine == 'AMD64': arg_type = 'Q' out_length = 8 else: arg_type = 'I' out_length = 4 out_buf = (c_char * out_length)() in_buf = struct.pack( '<11' + arg_type, rcx, rdx, r8, r9, r10, r11, rax, rbx, rdi, rsi, xmm_buffer ) out_buf = self._ioctl( IOCTL_HYPERCALL, in_buf, out_length ) return struct.unpack( '<' + arg_type, out_buf )[0]
def native_write_phys_mem(self, phys_address_hi, phys_address_lo, length, buf): raise UnimplementedNativeAPIError("native_write_phys_mem")
def native_read_phys_mem(self, phys_address_hi, phys_address_lo, length): raise UnimplementedNativeAPIError("native_read_phys_mem")
def hypercall( self, rcx, rdx, r8, r9, r10, r11, rax, rbx, rdi, rsi, xmm_buffer ): raise UnimplementedNativeAPIError( "hypercall" )
def send_sw_smi( self, cpu_thread_id, SMI_code_data, _rax, _rbx, _rcx, _rdx, _rsi, _rdi ): raise UnimplementedNativeAPIError( "send_sw_smi" )
def get_descriptor_table( self, cpu_thread_id, desc_table_code ): raise UnimplementedNativeAPIError( "get_descriptor_table" )
def load_ucode_update( self, cpu_thread_id, ucode_update_buf ): raise UnimplementedNativeAPIError( "load_ucode_update" )
def free_phys_mem( self, physical_address ): raise UnimplementedNativeAPIError( "free_phys_mem" )
def map_io_space( self, physical_address, length, cache_type ): raise UnimplementedNativeAPIError( "map_io_space" )
def get_descriptor_table(self, cpu_thread_id, desc_table_code): raise UnimplementedNativeAPIError("get_descriptor_table") in_buf = struct.pack('BB', cpu_thread_id, desc_table_code) out_buf = self._ioctl(IOCTL_GET_CPU_DESCRIPTOR_TABLE, in_buf, 18) (limit, base, pa) = struct.unpack('=HQQ', out_buf) return (limit, base, pa)
def native_get_ACPI_table(self): raise UnimplementedNativeAPIError("native_get_ACPI_table")
def va2pa( self, va ): raise UnimplementedNativeAPIError( "va2pa" )