miasm
Reverse engineering framework
vm_mngr.c File Reference
#include "vm_mngr.h"
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "queue.h"
Include dependency graph for vm_mngr.c:

Macros

#define MIN(a, b)   (((a)<(b))?(a):(b))
 
#define MAX(a, b)   (((a)>(b))?(a):(b))
 

Functions

void memory_access_list_init (struct memory_access_list *access)
 
void memory_access_list_reset (struct memory_access_list *access)
 
void memory_access_list_add (struct memory_access_list *access, uint64_t start, uint64_t stop)
 
uint16_t set_endian16 (vm_mngr_t *vm_mngr, uint16_t val)
 
uint32_t set_endian32 (vm_mngr_t *vm_mngr, uint32_t val)
 
uint64_t set_endian64 (vm_mngr_t *vm_mngr, uint64_t val)
 
void print_val (uint64_t base, uint64_t addr)
 
int midpoint (int imin, int imax)
 
int find_page_node (struct memory_page_node *array, uint64_t key, int imin, int imax)
 
struct memory_page_nodeget_memory_page_from_address (vm_mngr_t *vm_mngr, uint64_t ad, int raise_exception)
 
void dump_code_bloc (vm_mngr_t *vm_mngr)
 
void add_range_to_list (struct memory_access_list *access, uint64_t addr1, uint64_t addr2)
 
void add_mem_read (vm_mngr_t *vm_mngr, uint64_t addr, uint64_t size)
 
void add_mem_write (vm_mngr_t *vm_mngr, uint64_t addr, uint64_t size)
 
void check_invalid_code_blocs (vm_mngr_t *vm_mngr)
 
void check_memory_breakpoint (vm_mngr_t *vm_mngr)
 
PyObject * get_memory_pylist (vm_mngr_t *vm_mngr, struct memory_access_list *memory_list)
 
PyObject * get_memory_read (vm_mngr_t *vm_mngr)
 
PyObject * get_memory_write (vm_mngr_t *vm_mngr)
 
void vm_MEM_WRITE_08 (vm_mngr_t *vm_mngr, uint64_t addr, unsigned char src)
 
void vm_MEM_WRITE_16 (vm_mngr_t *vm_mngr, uint64_t addr, unsigned short src)
 
void vm_MEM_WRITE_32 (vm_mngr_t *vm_mngr, uint64_t addr, unsigned int src)
 
void vm_MEM_WRITE_64 (vm_mngr_t *vm_mngr, uint64_t addr, uint64_t src)
 
unsigned char vm_MEM_LOOKUP_08 (vm_mngr_t *vm_mngr, uint64_t addr)
 
unsigned short vm_MEM_LOOKUP_16 (vm_mngr_t *vm_mngr, uint64_t addr)
 
unsigned int vm_MEM_LOOKUP_32 (vm_mngr_t *vm_mngr, uint64_t addr)
 
uint64_t vm_MEM_LOOKUP_64 (vm_mngr_t *vm_mngr, uint64_t addr)
 
int vm_read_mem (vm_mngr_t *vm_mngr, uint64_t addr, char **buffer_ptr, size_t size)
 
uint64_t vm_read_mem_ret_buf (vm_mngr_t *vm_mngr, uint64_t addr, size_t size, char *buffer)
 
int vm_write_mem (vm_mngr_t *vm_mngr, uint64_t addr, char *buffer, size_t size)
 
int is_mapped (vm_mngr_t *vm_mngr, uint64_t addr, size_t size)
 
struct memory_page_nodecreate_memory_page_node (uint64_t ad, size_t size, unsigned int access, const char *name)
 
struct code_bloc_nodecreate_code_bloc_node (uint64_t ad_start, uint64_t ad_stop)
 
void add_code_bloc (vm_mngr_t *vm_mngr, struct code_bloc_node *cbp)
 
void dump_code_bloc_pool (vm_mngr_t *vm_mngr)
 
void init_memory_page_pool (vm_mngr_t *vm_mngr)
 
void init_code_bloc_pool (vm_mngr_t *vm_mngr)
 
void init_memory_breakpoint (vm_mngr_t *vm_mngr)
 
void reset_memory_page_pool (vm_mngr_t *vm_mngr)
 
void reset_code_bloc_pool (vm_mngr_t *vm_mngr)
 
void reset_memory_access (vm_mngr_t *vm_mngr)
 
void reset_memory_breakpoint (vm_mngr_t *vm_mngr)
 
int is_mpn_in_tab (vm_mngr_t *vm_mngr, struct memory_page_node *mpn_a)
 
void add_memory_page (vm_mngr_t *vm_mngr, struct memory_page_node *mpn_a)
 
void remove_memory_page (vm_mngr_t *vm_mngr, uint64_t ad)
 
char * dump (vm_mngr_t *vm_mngr)
 
void dump_memory_breakpoint_pool (vm_mngr_t *vm_mngr)
 
void add_memory_breakpoint (vm_mngr_t *vm_mngr, uint64_t ad, uint64_t size, unsigned int access)
 
void remove_memory_breakpoint (vm_mngr_t *vm_mngr, uint64_t ad, unsigned int access)
 
void hexdump (char *m, unsigned int l)
 
_MIASM_EXPORT uint64_t get_exception_flag (vm_mngr_t *vm_mngr)
 

Macro Definition Documentation

◆ MAX

#define MAX (   a,
 
)    (((a)>(b))?(a):(b))

◆ MIN

#define MIN (   a,
 
)    (((a)<(b))?(a):(b))

Function Documentation

◆ add_code_bloc()

void add_code_bloc ( vm_mngr_t vm_mngr,
struct code_bloc_node cbp 
)
Here is the caller graph for this function:

◆ add_mem_read()

void add_mem_read ( vm_mngr_t vm_mngr,
uint64_t  addr,
uint64_t  size 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_mem_write()

void add_mem_write ( vm_mngr_t vm_mngr,
uint64_t  addr,
uint64_t  size 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_memory_breakpoint()

void add_memory_breakpoint ( vm_mngr_t vm_mngr,
uint64_t  ad,
uint64_t  size,
unsigned int  access 
)
Here is the caller graph for this function:

◆ add_memory_page()

void add_memory_page ( vm_mngr_t vm_mngr,
struct memory_page_node mpn_a 
)
Here is the caller graph for this function:

◆ add_range_to_list()

void add_range_to_list ( struct memory_access_list access,
uint64_t  addr1,
uint64_t  addr2 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_invalid_code_blocs()

void check_invalid_code_blocs ( vm_mngr_t vm_mngr)
Here is the caller graph for this function:

◆ check_memory_breakpoint()

void check_memory_breakpoint ( vm_mngr_t vm_mngr)
Here is the caller graph for this function:

◆ create_code_bloc_node()

struct code_bloc_node* create_code_bloc_node ( uint64_t  ad_start,
uint64_t  ad_stop 
)
Here is the caller graph for this function:

◆ create_memory_page_node()

struct memory_page_node* create_memory_page_node ( uint64_t  ad,
size_t  size,
unsigned int  access,
const char *  name 
)
Here is the caller graph for this function:

◆ dump()

char* dump ( vm_mngr_t vm_mngr)
Here is the caller graph for this function:

◆ dump_code_bloc()

void dump_code_bloc ( vm_mngr_t vm_mngr)

◆ dump_code_bloc_pool()

void dump_code_bloc_pool ( vm_mngr_t vm_mngr)
Here is the caller graph for this function:

◆ dump_memory_breakpoint_pool()

void dump_memory_breakpoint_pool ( vm_mngr_t vm_mngr)
Here is the caller graph for this function:

◆ find_page_node()

int find_page_node ( struct memory_page_node array,
uint64_t  key,
int  imin,
int  imax 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_exception_flag()

_MIASM_EXPORT uint64_t get_exception_flag ( vm_mngr_t vm_mngr)

◆ get_memory_page_from_address()

struct memory_page_node* get_memory_page_from_address ( vm_mngr_t vm_mngr,
uint64_t  ad,
int  raise_exception 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_memory_pylist()

PyObject* get_memory_pylist ( vm_mngr_t vm_mngr,
struct memory_access_list memory_list 
)
Here is the caller graph for this function:

◆ get_memory_read()

PyObject* get_memory_read ( vm_mngr_t vm_mngr)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_memory_write()

PyObject* get_memory_write ( vm_mngr_t vm_mngr)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hexdump()

void hexdump ( char *  m,
unsigned int  l 
)
Here is the call graph for this function:

◆ init_code_bloc_pool()

void init_code_bloc_pool ( vm_mngr_t vm_mngr)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_memory_breakpoint()

void init_memory_breakpoint ( vm_mngr_t vm_mngr)
Here is the caller graph for this function:

◆ init_memory_page_pool()

void init_memory_page_pool ( vm_mngr_t vm_mngr)
Here is the caller graph for this function:

◆ is_mapped()

int is_mapped ( vm_mngr_t vm_mngr,
uint64_t  addr,
size_t  size 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_mpn_in_tab()

int is_mpn_in_tab ( vm_mngr_t vm_mngr,
struct memory_page_node mpn_a 
)
Here is the caller graph for this function:

◆ memory_access_list_add()

void memory_access_list_add ( struct memory_access_list access,
uint64_t  start,
uint64_t  stop 
)
Here is the caller graph for this function:

◆ memory_access_list_init()

void memory_access_list_init ( struct memory_access_list access)
Here is the caller graph for this function:

◆ memory_access_list_reset()

void memory_access_list_reset ( struct memory_access_list access)
Here is the caller graph for this function:

◆ midpoint()

int midpoint ( int  imin,
int  imax 
)
Here is the caller graph for this function:

◆ print_val()

void print_val ( uint64_t  base,
uint64_t  addr 
)

◆ remove_memory_breakpoint()

void remove_memory_breakpoint ( vm_mngr_t vm_mngr,
uint64_t  ad,
unsigned int  access 
)
Here is the caller graph for this function:

◆ remove_memory_page()

void remove_memory_page ( vm_mngr_t vm_mngr,
uint64_t  ad 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_code_bloc_pool()

void reset_code_bloc_pool ( vm_mngr_t vm_mngr)
Here is the caller graph for this function:

◆ reset_memory_access()

void reset_memory_access ( vm_mngr_t vm_mngr)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_memory_breakpoint()

void reset_memory_breakpoint ( vm_mngr_t vm_mngr)
Here is the caller graph for this function:

◆ reset_memory_page_pool()

void reset_memory_page_pool ( vm_mngr_t vm_mngr)
Here is the caller graph for this function:

◆ set_endian16()

uint16_t set_endian16 ( vm_mngr_t vm_mngr,
uint16_t  val 
)
Here is the caller graph for this function:

◆ set_endian32()

uint32_t set_endian32 ( vm_mngr_t vm_mngr,
uint32_t  val 
)
Here is the caller graph for this function:

◆ set_endian64()

uint64_t set_endian64 ( vm_mngr_t vm_mngr,
uint64_t  val 
)
Here is the caller graph for this function:

◆ vm_MEM_LOOKUP_08()

unsigned char vm_MEM_LOOKUP_08 ( vm_mngr_t vm_mngr,
uint64_t  addr 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_MEM_LOOKUP_16()

unsigned short vm_MEM_LOOKUP_16 ( vm_mngr_t vm_mngr,
uint64_t  addr 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_MEM_LOOKUP_32()

unsigned int vm_MEM_LOOKUP_32 ( vm_mngr_t vm_mngr,
uint64_t  addr 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_MEM_LOOKUP_64()

uint64_t vm_MEM_LOOKUP_64 ( vm_mngr_t vm_mngr,
uint64_t  addr 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_MEM_WRITE_08()

void vm_MEM_WRITE_08 ( vm_mngr_t vm_mngr,
uint64_t  addr,
unsigned char  src 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_MEM_WRITE_16()

void vm_MEM_WRITE_16 ( vm_mngr_t vm_mngr,
uint64_t  addr,
unsigned short  src 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_MEM_WRITE_32()

void vm_MEM_WRITE_32 ( vm_mngr_t vm_mngr,
uint64_t  addr,
unsigned int  src 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_MEM_WRITE_64()

void vm_MEM_WRITE_64 ( vm_mngr_t vm_mngr,
uint64_t  addr,
uint64_t  src 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_read_mem()

int vm_read_mem ( vm_mngr_t vm_mngr,
uint64_t  addr,
char **  buffer_ptr,
size_t  size 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_read_mem_ret_buf()

uint64_t vm_read_mem_ret_buf ( vm_mngr_t vm_mngr,
uint64_t  addr,
size_t  size,
char *  buffer 
)
Here is the call graph for this function:

◆ vm_write_mem()

int vm_write_mem ( vm_mngr_t vm_mngr,
uint64_t  addr,
char *  buffer,
size_t  size 
)
Here is the call graph for this function:
Here is the caller graph for this function: