miasm
Reverse engineering framework
vm_mngr.h
Go to the documentation of this file.
1 /*
2 ** Copyright (C) 2011 EADS France, Fabrice Desclaux <fabrice.desclaux@eads.net>
3 **
4 ** This program is free software; you can redistribute it and/or modify
5 ** it under the terms of the GNU General Public License as published by
6 ** the Free Software Foundation; either version 2 of the License, or
7 ** (at your option) any later version.
8 **
9 ** This program is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ** GNU General Public License for more details.
13 **
14 ** You should have received a copy of the GNU General Public License along
15 ** with this program; if not, write to the Free Software Foundation, Inc.,
16 ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18 #ifndef CODENAT_H
19 #define CODENAT_H
20 
21 #if defined(_WIN32) || defined(_WIN64)
22 #define _CRT_SECURE_NO_WARNINGS
23 #endif
24 
25 #if _WIN32
26 #define _MIASM_EXPORT __declspec(dllexport)
27 #else
28 #define _MIASM_EXPORT
29 #endif
30 
31 #include <Python.h>
32 #include <stdint.h>
33 
34 #include "queue.h"
35 
36 #ifdef __APPLE__
37 #define __BYTE_ORDER __BYTE_ORDER__
38 #define __BIG_ENDIAN BIG_ENDIAN
39 #define __LITTLE_ENDIAN LITTLE_ENDIAN
40 #elif defined(__NetBSD__) || defined(__OpenBSD__)
41 #define __BYTE_ORDER _BYTE_ORDER
42 #define __BIG_ENDIAN _BIG_ENDIAN
43 #define __LITTLE_ENDIAN _LITTLE_ENDIAN
44 #elif defined(_WIN32) || defined(_WIN64)
45 #define __BYTE_ORDER __LITTLE_ENDIAN
46 #define __BIG_ENDIAN '>'
47 #define __LITTLE_ENDIAN '<'
48 #elif defined(__ANDROID__)
49 #define __BYTE_ORDER __BYTE_ORDER__
50 #define __LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
51 #define __BIG_ENDIAN __ORDER_BIG_ENDIAN__
52 #endif
53 
54 
55 #define Endian16_Swap(value) \
56  ((((uint16_t)((value) & 0x00FF)) << 8) | \
57  (((uint16_t)((value) & 0xFF00)) >> 8))
58 
59 #define Endian32_Swap(value) \
60  ((((uint32_t)((value) & 0x000000FF)) << 24) | \
61  (((uint32_t)((value) & 0x0000FF00)) << 8) | \
62  (((uint32_t)((value) & 0x00FF0000)) >> 8) | \
63  (((uint32_t)((value) & 0xFF000000)) >> 24))
64 
65 #define Endian64_Swap(value) \
66  (((((uint64_t)value)<<56) & 0xFF00000000000000ULL) | \
67  ((((uint64_t)value)<<40) & 0x00FF000000000000ULL) | \
68  ((((uint64_t)value)<<24) & 0x0000FF0000000000ULL) | \
69  ((((uint64_t)value)<< 8) & 0x000000FF00000000ULL) | \
70  ((((uint64_t)value)>> 8) & 0x00000000FF000000ULL) | \
71  ((((uint64_t)value)>>24) & 0x0000000000FF0000ULL) | \
72  ((((uint64_t)value)>>40) & 0x000000000000FF00ULL) | \
73  ((((uint64_t)value)>>56) & 0x00000000000000FFULL))
74 
75 
76 LIST_HEAD(code_bloc_list_head, code_bloc_node);
77 LIST_HEAD(memory_breakpoint_info_head, memory_breakpoint_info);
78 
79 
80 #define BREAKPOINT_READ 1
81 #define BREAKPOINT_WRITE 2
82 
83 #define BREAK_SIGALARM 1<<5
84 
85 #define MAX_MEMORY_PAGE_POOL_TAB 0x100000
86 #define MEMORY_PAGE_POOL_MASK_BIT 12
87 #define VM_BIG_ENDIAN 1
88 #define VM_LITTLE_ENDIAN 2
89 
90 
92  uint64_t ad;
93  size_t size;
94  uint64_t access;
95  void* ad_hp;
96  char* name;
97 };
98 
99 struct memory_access {
100  uint64_t start;
101  uint64_t stop;
102 };
103 
106  size_t allocated;
107  size_t num;
108 };
109 
110 typedef struct {
111  int sex;
112  struct code_bloc_list_head code_bloc_pool;
113  struct memory_breakpoint_info_head memory_breakpoint_pool;
114 
117 
120 
121  uint64_t exception_flags;
123  PyObject *addr2obj;
124 
125 
126  struct memory_access_list memory_r;
127  struct memory_access_list memory_w;
128 
129 
131 
132 }vm_mngr_t;
133 
134 
135 
136 typedef struct {
137  PyObject *func;
139 
140 
141 
142 
143 //extern vm_mngr_t vmmngr;
144 
146  uint64_t ad_start;
147  uint64_t ad_stop;
148  uint64_t ad_code;
150 };
151 
152 
154  uint64_t ad;
155  uint64_t size;
156  uint64_t access;
158 };
159 
160 
161 
162 #define PAGE_READ 1
163 #define PAGE_WRITE 2
164 #define PAGE_EXEC 4
165 
166 #define EXCEPT_DO_NOT_UPDATE_PC (1<<25)
167 
168 // interrupt with eip update after instr
169 #define EXCEPT_CODE_AUTOMOD (1<<0)
170 #define EXCEPT_SOFT_BP (1<<1)
171 #define EXCEPT_INT_XX (1<<2)
172 
173 #define EXCEPT_BREAKPOINT_MEMORY (1<<10)
174 // Deprecated
175 #define EXCEPT_BREAKPOINT_INTERN (EXCEPT_BREAKPOINT_MEMORY)
176 
177 #define EXCEPT_NUM_UPDT_EIP (1<<11)
178 // interrupt with eip at instr
179 #define EXCEPT_UNK_MEM_AD ((1<<12) | EXCEPT_DO_NOT_UPDATE_PC)
180 #define EXCEPT_THROW_SEH ((1<<13) | EXCEPT_DO_NOT_UPDATE_PC)
181 #define EXCEPT_UNK_EIP ((1<<14) | EXCEPT_DO_NOT_UPDATE_PC)
182 #define EXCEPT_ACCESS_VIOL ((1<<14) | EXCEPT_DO_NOT_UPDATE_PC)
183 #define EXCEPT_INT_DIV_BY_ZERO ((1<<16) | EXCEPT_DO_NOT_UPDATE_PC)
184 #define EXCEPT_PRIV_INSN ((1<<17) | EXCEPT_DO_NOT_UPDATE_PC)
185 #define EXCEPT_ILLEGAL_INSN ((1<<18) | EXCEPT_DO_NOT_UPDATE_PC)
186 #define EXCEPT_UNK_MNEMO ((1<<19) | EXCEPT_DO_NOT_UPDATE_PC)
187 #define EXCEPT_INT_1 ((1<<20) | EXCEPT_DO_NOT_UPDATE_PC)
188 
189 
191 uint64_t get_mem_base_addr(vm_mngr_t* vm_mngr, uint64_t addr, uint64_t *addr_base);
192 unsigned int MEM_LOOKUP(vm_mngr_t* vm_mngr, unsigned int my_size, uint64_t addr);
193 
194 int is_mapped(vm_mngr_t* vm_mngr, uint64_t addr, size_t size);
195 void vm_throw(vm_mngr_t* vm_mngr, unsigned long flags);
196 
197 void vm_MEM_WRITE_08(vm_mngr_t* vm_mngr, uint64_t addr, unsigned char src);
198 void vm_MEM_WRITE_16(vm_mngr_t* vm_mngr, uint64_t addr, unsigned short src);
199 void vm_MEM_WRITE_32(vm_mngr_t* vm_mngr, uint64_t addr, unsigned int src);
200 void vm_MEM_WRITE_64(vm_mngr_t* vm_mngr, uint64_t addr, uint64_t src);
201 
202 unsigned char vm_MEM_LOOKUP_08(vm_mngr_t* vm_mngr, uint64_t addr);
203 unsigned short vm_MEM_LOOKUP_16(vm_mngr_t* vm_mngr, uint64_t addr);
204 unsigned int vm_MEM_LOOKUP_32(vm_mngr_t* vm_mngr, uint64_t addr);
205 uint64_t vm_MEM_LOOKUP_64(vm_mngr_t* vm_mngr, uint64_t addr);
206 
207 void MEM_WRITE_08_PASSTHROUGH(uint64_t addr, unsigned char src);
208 void MEM_WRITE_16_PASSTHROUGH(uint64_t addr, unsigned short src);
209 void MEM_WRITE_32_PASSTHROUGH(uint64_t addr, unsigned int src);
210 void MEM_WRITE_64_PASSTHROUGH(uint64_t addr, uint64_t src);
211 unsigned char MEM_LOOKUP_08_PASSTHROUGH(uint64_t addr);
212 unsigned short MEM_LOOKUP_16_PASSTHROUGH(uint64_t addr);
213 unsigned int MEM_LOOKUP_32_PASSTHROUGH(uint64_t addr);
214 uint64_t MEM_LOOKUP_64_PASSTHROUGH(uint64_t addr);
215 
216 int vm_read_mem(vm_mngr_t* vm_mngr, uint64_t addr, char** buffer_ptr, size_t size);
217 int vm_write_mem(vm_mngr_t* vm_mngr, uint64_t addr, char *buffer, size_t size);
218 
219 void memory_access_list_init(struct memory_access_list * access);
220 void memory_access_list_reset(struct memory_access_list * access);
221 void memory_access_list_add(struct memory_access_list * access, uint64_t start, uint64_t stop);
222 
223 uint16_t set_endian16(vm_mngr_t* vm_mngr, uint16_t val);
224 uint32_t set_endian32(vm_mngr_t* vm_mngr, uint32_t val);
225 uint64_t set_endian64(vm_mngr_t* vm_mngr, uint64_t val);
226 
227 
228 void hexdump(char* m, unsigned int l);
229 
230 struct code_bloc_node * create_code_bloc_node(uint64_t ad_start, uint64_t ad_stop);
231 void add_code_bloc(vm_mngr_t* vm_mngr, struct code_bloc_node* cbp);
232 
233 struct memory_page_node * create_memory_page_node(uint64_t ad, size_t size, unsigned int access, const char *name);//memory_page* mp);
239 void add_memory_page(vm_mngr_t* vm_mngr, struct memory_page_node* mpn_a);
240 void remove_memory_page(vm_mngr_t* vm_mngr, uint64_t ad);
241 
242 
245 void add_memory_breakpoint(vm_mngr_t* vm_mngr, uint64_t ad, uint64_t size, unsigned int access);
246 void remove_memory_breakpoint(vm_mngr_t* vm_mngr, uint64_t ad, unsigned int access);
247 
249 
250 void add_mem_read(vm_mngr_t* vm_mngr, uint64_t addr, uint64_t size);
251 void add_mem_write(vm_mngr_t* vm_mngr, uint64_t addr, uint64_t size);
255 PyObject* get_memory_read(vm_mngr_t* vm_mngr);
257 
258 
259 char* dump(vm_mngr_t* vm_mngr);
261 PyObject* addr2BlocObj(vm_mngr_t* vm_mngr, uint64_t addr);
262 
263 
264 
265 
266 /********************************************/
267 unsigned int get_memory_page_max_address(void);
269 
270 
271 int is_mpn_in_tab(vm_mngr_t* vm_mngr, struct memory_page_node* mpn_a);
272 
273 
274 void _func_free(void);
275 void _func_alloc(void);
278 unsigned int _get_memory_page_from_min_ad_py(unsigned int size);
279 
286 
287 
288 void func_free(void);
289 void func_alloc(void);
292 unsigned int get_memory_page_from_min_ad_py(unsigned int size);
293 struct memory_page_node * get_memory_page_from_address(vm_mngr_t*, uint64_t ad, int raise_exception);
298 void func_loadlib_fake(void);
299 void func_getproc_fake(void);
300 
301 unsigned int access_segment(unsigned int d);
302 unsigned int access_segment_ok(unsigned int d);
303 
304 unsigned int load_segment_limit(unsigned int d);
305 unsigned int load_segment_limit_ok(unsigned int d);
306 
307 unsigned int load_tr_segment_selector(unsigned int d);
308 
309 #endif
get_memory_read
PyObject * get_memory_read(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:452
init_code_bloc_pool
void init_code_bloc_pool(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:743
func_loadlib_fake
void func_loadlib_fake(void)
func_virtualfree_memory_page
void func_virtualfree_memory_page(void)
load_segment_limit_ok
unsigned int load_segment_limit_ok(unsigned int d)
vm_mngr_t::memory_pages_array
struct memory_page_node * memory_pages_array
Definition: vm_mngr.h:116
memory_access
Definition: vm_mngr.h:99
get_memory_write
PyObject * get_memory_write(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:457
add_mem_write
void add_mem_write(vm_mngr_t *vm_mngr, uint64_t addr, uint64_t size)
Definition: vm_mngr.c:370
load_segment_limit
unsigned int load_segment_limit(unsigned int d)
_func_alloc
void _func_alloc(void)
single_instr.l
l
Definition: single_instr.py:7
is_mem_mapped
int is_mem_mapped(vm_mngr_t *vm_mngr, uint64_t ad)
Endian16_Swap
#define Endian16_Swap(value)
Definition: vm_mngr.h:55
MEM_WRITE_32_PASSTHROUGH
void MEM_WRITE_32_PASSTHROUGH(uint64_t addr, unsigned int src)
vm_read_mem
int vm_read_mem(vm_mngr_t *vm_mngr, uint64_t addr, char **buffer_ptr, size_t size)
Definition: vm_mngr.c:514
func_alloc
void func_alloc(void)
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)
Definition: vm_mngr.c:139
expr_grapher.m
m
Definition: expr_grapher.py:11
_func_malloc_memory_page
void _func_malloc_memory_page(void)
vm_mngr.h
dump_memory_breakpoint_pool
void dump_memory_breakpoint_pool(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:940
set_endian64
uint64_t set_endian64(vm_mngr_t *vm_mngr, uint64_t val)
Definition: vm_mngr.c:98
vm_MEM_WRITE_64
void vm_MEM_WRITE_64(vm_mngr_t *vm_mngr, uint64_t addr, uint64_t src)
Definition: vm_mngr.c:478
get_memory_page_from_address
struct memory_page_node * get_memory_page_from_address(vm_mngr_t *, uint64_t ad, int raise_exception)
Definition: vm_mngr.c:139
reset_code_bloc_pool
void reset_code_bloc_pool(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:776
dump_code_bloc_pool
void dump_code_bloc_pool(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:724
memory_access_list_reset
void memory_access_list_reset(struct memory_access_list *access)
Definition: vm_mngr.c:47
access_segment_ok
unsigned int access_segment_ok(unsigned int d)
memory_breakpoint_info::ad
uint64_t ad
Definition: vm_mngr.h:154
add_mem_read
void add_mem_read(vm_mngr_t *vm_mngr, uint64_t addr, uint64_t size)
Definition: vm_mngr.c:365
code_bloc_node
Definition: vm_mngr.h:145
vm_MEM_WRITE_32
void vm_MEM_WRITE_32(vm_mngr_t *vm_mngr, uint64_t addr, unsigned int src)
Definition: vm_mngr.c:473
add_code_bloc
void add_code_bloc(vm_mngr_t *vm_mngr, struct code_bloc_node *cbp)
Definition: vm_mngr.c:715
check_invalid_code_blocs
_MIASM_EXPORT void check_invalid_code_blocs(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:375
is_mpn_in_tab
int is_mpn_in_tab(vm_mngr_t *vm_mngr, struct memory_page_node *mpn_a)
Definition: vm_mngr.c:811
add_memory_breakpoint
void add_memory_breakpoint(vm_mngr_t *vm_mngr, uint64_t ad, uint64_t size, unsigned int access)
Definition: vm_mngr.c:954
MEM_WRITE_16_PASSTHROUGH
void MEM_WRITE_16_PASSTHROUGH(uint64_t addr, unsigned short src)
find_page_node
int find_page_node(struct memory_page_node *array, uint64_t key, int imin, int imax)
Definition: vm_mngr.c:118
get_memory_pylist
PyObject * get_memory_pylist(vm_mngr_t *vm_mngr, struct memory_access_list *memory_list)
Definition: vm_mngr.c:435
reset_memory_page_pool
void reset_memory_page_pool(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:761
vm_MEM_LOOKUP_16
unsigned short vm_MEM_LOOKUP_16(vm_mngr_t *vm_mngr, uint64_t addr)
Definition: vm_mngr.c:491
modint.i
i
Definition: modint.py:70
memory_access_list::array
struct memory_access * array
Definition: vm_mngr.h:105
memory_page_node::name
char * name
Definition: vm_mngr.h:96
vm_MEM_WRITE_16
void vm_MEM_WRITE_16(vm_mngr_t *vm_mngr, uint64_t addr, unsigned short src)
Definition: vm_mngr.c:468
PAGE_READ
#define PAGE_READ
Definition: vm_mngr.h:162
memory_page_node::size
size_t size
Definition: vm_mngr.h:93
hexdump
void hexdump(char *m, unsigned int l)
Definition: vm_mngr.c:984
create_memory_page_node
struct memory_page_node * create_memory_page_node(uint64_t ad, size_t size, unsigned int access, const char *name)
Definition: vm_mngr.c:664
reset_memory_access
void reset_memory_access(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:790
_func_virtualfree_memory_page
void _func_virtualfree_memory_page(void)
set_endian32
uint32_t set_endian32(vm_mngr_t *vm_mngr, uint32_t val)
Definition: vm_mngr.c:90
vm_write_mem
int vm_write_mem(vm_mngr_t *vm_mngr, uint64_t addr, char *buffer, size_t size)
Definition: vm_mngr.c:594
memory_breakpoint_info::access
uint64_t access
Definition: vm_mngr.h:156
get_memory_read
PyObject * get_memory_read(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:452
PAGE_EXEC
#define PAGE_EXEC
Definition: vm_mngr.h:164
Endian32_Swap
#define Endian32_Swap(value)
Definition: vm_mngr.h:59
code_bloc_node::LIST_ENTRY
LIST_ENTRY(code_bloc_node) next
shellcode.ad_start
ad_start
Definition: shellcode.py:115
_get_memory_page_max_address_py
unsigned int _get_memory_page_max_address_py(void)
remove_memory_page
void remove_memory_page(vm_mngr_t *vm_mngr, uint64_t ad)
Definition: vm_mngr.c:865
LIST_HEAD
LIST_HEAD(code_bloc_list_head, code_bloc_node)
dump
char * dump(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:892
EXCEPT_CODE_AUTOMOD
#define EXCEPT_CODE_AUTOMOD
Definition: vm_mngr.h:169
LIST_REMOVE
#define LIST_REMOVE(elm, field)
Definition: queue.h:370
memory_access_list::allocated
size_t allocated
Definition: vm_mngr.h:106
memory_access_list_init
void memory_access_list_init(struct memory_access_list *access)
Definition: vm_mngr.c:40
memory_page_node::ad_hp
void * ad_hp
Definition: vm_mngr.h:95
memory_access_list_add
void memory_access_list_add(struct memory_access_list *access, uint64_t start, uint64_t stop)
Definition: vm_mngr.c:57
vm_MEM_WRITE_08
void vm_MEM_WRITE_08(vm_mngr_t *vm_mngr, uint64_t addr, unsigned char src)
Definition: vm_mngr.c:462
vm_mngr_t::exception_flags
uint64_t exception_flags
Definition: vm_mngr.h:121
range
Definition: range.py:1
full.ad
ad
Definition: full.py:147
get_memory_page_max_address_py
unsigned int get_memory_page_max_address_py(void)
memory_page_node
Definition: vm_mngr.h:91
check_invalid_code_blocs
void check_invalid_code_blocs(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:375
dump_memory_breakpoint_pool
void dump_memory_breakpoint_pool(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:940
basic_op.d
d
Definition: basic_op.py:30
midpoint
int midpoint(int imin, int imax)
Definition: vm_mngr.c:112
vm_throw
void vm_throw(vm_mngr_t *vm_mngr, unsigned long flags)
check_memory_breakpoint
void check_memory_breakpoint(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:404
vm_MEM_WRITE_64
void vm_MEM_WRITE_64(vm_mngr_t *vm_mngr, uint64_t addr, uint64_t src)
Definition: vm_mngr.c:478
load_tr_segment_selector
unsigned int load_tr_segment_selector(unsigned int d)
miasm.arch.aarch64.sem.ret
def ret(arg1)
Definition: sem.py:1796
vm_MEM_LOOKUP_08
unsigned char vm_MEM_LOOKUP_08(vm_mngr_t *vm_mngr, uint64_t addr)
Definition: vm_mngr.c:484
vm_mngr_t::write_num
int write_num
Definition: vm_mngr.h:130
_get_memory_page_from_min_ad_py
unsigned int _get_memory_page_from_min_ad_py(unsigned int size)
dump_code_bloc_pool
void dump_code_bloc_pool(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:724
_func_virtualalloc_memory_page
void _func_virtualalloc_memory_page(void)
reset_memory_breakpoint
void reset_memory_breakpoint(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:796
memory_breakpoint_info::size
uint64_t size
Definition: vm_mngr.h:155
add_mem_read
void add_mem_read(vm_mngr_t *vm_mngr, uint64_t addr, uint64_t size)
Definition: vm_mngr.c:365
arm_sc.start
start
Definition: arm_sc.py:36
access_segment
unsigned int access_segment(unsigned int d)
add_memory_breakpoint
void add_memory_breakpoint(vm_mngr_t *vm_mngr, uint64_t ad, uint64_t size, unsigned int access)
Definition: vm_mngr.c:954
set_endian16
uint16_t set_endian16(vm_mngr_t *vm_mngr, uint16_t val)
Definition: vm_mngr.c:82
vm_MEM_LOOKUP_16
unsigned short vm_MEM_LOOKUP_16(vm_mngr_t *vm_mngr, uint64_t addr)
Definition: vm_mngr.c:491
init_code_bloc_pool
void init_code_bloc_pool(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:743
vm_MEM_LOOKUP_64
uint64_t vm_MEM_LOOKUP_64(vm_mngr_t *vm_mngr, uint64_t addr)
Definition: vm_mngr.c:505
func_free
void func_free(void)
create_code_bloc_node
struct code_bloc_node * create_code_bloc_node(uint64_t ad_start, uint64_t ad_stop)
Definition: vm_mngr.c:698
reset_memory_access
_MIASM_EXPORT void reset_memory_access(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:790
code_bloc_pool
struct code_bloc_list_head code_bloc_pool
is_mapped
int is_mapped(vm_mngr_t *vm_mngr, uint64_t addr, size_t size)
Definition: vm_mngr.c:632
get_memory_page_max_user_address_py
unsigned int get_memory_page_max_user_address_py(void)
vm_mngr_t::memory_pages_number
int memory_pages_number
Definition: vm_mngr.h:115
miasm.arch.mips32.sem.j
def j(arg1)
Definition: sem.py:156
remove_memory_breakpoint
void remove_memory_breakpoint(vm_mngr_t *vm_mngr, uint64_t ad, unsigned int access)
Definition: vm_mngr.c:970
vm_write_mem
int vm_write_mem(vm_mngr_t *vm_mngr, uint64_t addr, char *buffer, size_t size)
Definition: vm_mngr.c:594
export_llvm.name
name
Definition: export_llvm.py:70
LIST_INIT
#define LIST_INIT(head)
Definition: queue.h:342
add_memory_page
void add_memory_page(vm_mngr_t *vm_mngr, struct memory_page_node *mpn_a)
Definition: vm_mngr.c:836
MEM_WRITE_08_PASSTHROUGH
void MEM_WRITE_08_PASSTHROUGH(uint64_t addr, unsigned char src)
vm_MEM_WRITE_08
void vm_MEM_WRITE_08(vm_mngr_t *vm_mngr, uint64_t addr, unsigned char src)
Definition: vm_mngr.c:462
get_memory_page_max_address
unsigned int get_memory_page_max_address(void)
reset_code_bloc_pool
void reset_code_bloc_pool(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:776
vm_mngr
Definition: vm_mngr.py:1
addr2BlocObj
PyObject * addr2BlocObj(vm_mngr_t *vm_mngr, uint64_t addr)
_func_free
void _func_free(void)
dump_code_bloc
void dump_code_bloc(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:335
get_mem_base_addr
uint64_t get_mem_base_addr(vm_mngr_t *vm_mngr, uint64_t addr, uint64_t *addr_base)
test_types.last
last
Definition: test_types.py:289
add_range_to_list
void add_range_to_list(struct memory_access_list *access, uint64_t addr1, uint64_t addr2)
Definition: vm_mngr.c:344
EXCEPT_ACCESS_VIOL
#define EXCEPT_ACCESS_VIOL
Definition: vm_mngr.h:182
init_memory_breakpoint
void init_memory_breakpoint(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:755
LIST_FIRST
#define LIST_FIRST(head)
Definition: queue.h:330
memory_breakpoint_info
Definition: vm_mngr.h:153
is_mpn_in_tab
int is_mpn_in_tab(vm_mngr_t *vm_mngr, struct memory_page_node *mpn_a)
Definition: vm_mngr.c:811
reset_memory_breakpoint
void reset_memory_breakpoint(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:796
expr_c.ptr
ptr
Definition: expr_c.py:44
queue.h
reset_memory_page_pool
void reset_memory_page_pool(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:761
MEM_LOOKUP
unsigned int MEM_LOOKUP(vm_mngr_t *vm_mngr, unsigned int my_size, uint64_t addr)
memory_access::start
uint64_t start
Definition: vm_mngr.h:100
vm_mngr_t::code_bloc_pool_ad_max
uint64_t code_bloc_pool_ad_max
Definition: vm_mngr.h:119
vm_MEM_WRITE_16
void vm_MEM_WRITE_16(vm_mngr_t *vm_mngr, uint64_t addr, unsigned short src)
Definition: vm_mngr.c:468
init_memory_page_pool
void init_memory_page_pool(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:736
dse_crackme.stderr
stderr
Definition: dse_crackme.py:320
vm_mngr_t::sex
int sex
Definition: vm_mngr.h:111
get_memory_write
PyObject * get_memory_write(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:457
add_mem_write
void add_mem_write(vm_mngr_t *vm_mngr, uint64_t addr, uint64_t size)
Definition: vm_mngr.c:370
create_memory_page_node
struct memory_page_node * create_memory_page_node(uint64_t ad, size_t size, unsigned int access, const char *name)
Definition: vm_mngr.c:664
print_val
void print_val(uint64_t base, uint64_t addr)
Definition: vm_mngr.c:106
set_endian16
uint16_t set_endian16(vm_mngr_t *vm_mngr, uint16_t val)
Definition: vm_mngr.c:82
vm_read_mem
int vm_read_mem(vm_mngr_t *vm_mngr, uint64_t addr, char **buffer_ptr, size_t size)
Definition: vm_mngr.c:514
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)
Definition: vm_mngr.c:559
func_resolver
Definition: vm_mngr.h:136
shellcode.ad_stop
ad_stop
Definition: shellcode.py:116
_MIASM_EXPORT
#define _MIASM_EXPORT
Definition: JitCore_x86.h:6
vm_MEM_LOOKUP_64
uint64_t vm_MEM_LOOKUP_64(vm_mngr_t *vm_mngr, uint64_t addr)
Definition: vm_mngr.c:505
memory_access_list
Definition: vm_mngr.h:104
miasm.arch.mips32.arch.base
base
Definition: arch.py:499
vm_MEM_LOOKUP_32
unsigned int vm_MEM_LOOKUP_32(vm_mngr_t *vm_mngr, uint64_t addr)
Definition: vm_mngr.c:498
LIST_INSERT_HEAD
#define LIST_INSERT_HEAD(head, elm, field)
Definition: queue.h:361
dump
char * dump(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:892
is_mapped
int is_mapped(vm_mngr_t *vm_mngr, uint64_t addr, size_t size)
Definition: vm_mngr.c:632
memory_access_list::num
size_t num
Definition: vm_mngr.h:107
remove_memory_breakpoint
void remove_memory_breakpoint(vm_mngr_t *vm_mngr, uint64_t ad, unsigned int access)
Definition: vm_mngr.c:970
memory_access_list_init
void memory_access_list_init(struct memory_access_list *access)
Definition: vm_mngr.c:40
memory_access_list_add
void memory_access_list_add(struct memory_access_list *access, uint64_t start, uint64_t stop)
Definition: vm_mngr.c:57
func_virtualalloc_memory_page
void func_virtualalloc_memory_page(void)
add_memory_page
void add_memory_page(vm_mngr_t *vm_mngr, struct memory_page_node *mpn_a)
Definition: vm_mngr.c:836
check_memory_breakpoint
_MIASM_EXPORT void check_memory_breakpoint(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:404
Endian64_Swap
#define Endian64_Swap(value)
Definition: vm_mngr.h:65
code_bloc_node::ad_code
uint64_t ad_code
Definition: vm_mngr.h:148
vm_MEM_WRITE_32
void vm_MEM_WRITE_32(vm_mngr_t *vm_mngr, uint64_t addr, unsigned int src)
Definition: vm_mngr.c:473
vm_MEM_LOOKUP_08
unsigned char vm_MEM_LOOKUP_08(vm_mngr_t *vm_mngr, uint64_t addr)
Definition: vm_mngr.c:484
minidump_to_pe.flags
flags
Definition: minidump_to_pe.py:38
MEM_LOOKUP_16_PASSTHROUGH
unsigned short MEM_LOOKUP_16_PASSTHROUGH(uint64_t addr)
arm_sc.stop
stop
Definition: arm_sc.py:37
MIN
#define MIN(a, b)
Definition: vm_mngr.c:35
EXCEPT_BREAKPOINT_MEMORY
#define EXCEPT_BREAKPOINT_MEMORY
Definition: vm_mngr.h:173
init_memory_breakpoint
void init_memory_breakpoint(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:755
full.key
key
Definition: full.py:209
BREAKPOINT_READ
#define BREAKPOINT_READ
Definition: vm_mngr.h:80
vm_mngr_t::code_bloc_pool_ad_min
uint64_t code_bloc_pool_ad_min
Definition: vm_mngr.h:118
dis_binary.addr
addr
Definition: dis_binary.py:24
set_endian32
uint32_t set_endian32(vm_mngr_t *vm_mngr, uint32_t val)
Definition: vm_mngr.c:90
func_resolver::func
PyObject * func
Definition: vm_mngr.h:137
get_memory_page_from_min_ad_py
unsigned int get_memory_page_from_min_ad_py(unsigned int size)
get_exception_flag
_MIASM_EXPORT uint64_t get_exception_flag(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:1025
_get_memory_page_max_user_address_py
unsigned int _get_memory_page_max_user_address_py(void)
get_memory_page_max_user_address
unsigned int get_memory_page_max_user_address(void)
init_memory_page_pool
void init_memory_page_pool(vm_mngr_t *vm_mngr)
Definition: vm_mngr.c:736
vm_mngr_t::exception_flags_new
uint64_t exception_flags_new
Definition: vm_mngr.h:122
vm_mngr_t
Definition: vm_mngr.h:110
create_code_bloc_node
struct code_bloc_node * create_code_bloc_node(uint64_t ad_start, uint64_t ad_stop)
Definition: vm_mngr.c:698
code_bloc_node::ad_start
uint64_t ad_start
Definition: vm_mngr.h:146
remove_memory_page
void remove_memory_page(vm_mngr_t *vm_mngr, uint64_t ad)
Definition: vm_mngr.c:865
code_bloc_node::ad_stop
uint64_t ad_stop
Definition: vm_mngr.h:147
_func_getproc_fake
void _func_getproc_fake(void)
set_endian64
uint64_t set_endian64(vm_mngr_t *vm_mngr, uint64_t val)
Definition: vm_mngr.c:98
MEM_LOOKUP_32_PASSTHROUGH
unsigned int MEM_LOOKUP_32_PASSTHROUGH(uint64_t addr)
func_getproc_fake
void func_getproc_fake(void)
LIST_EMPTY
#define LIST_EMPTY(head)
Definition: queue.h:328
example_types.val
val
Definition: example_types.py:218
MEM_WRITE_64_PASSTHROUGH
void MEM_WRITE_64_PASSTHROUGH(uint64_t addr, uint64_t src)
memory_access_list_reset
void memory_access_list_reset(struct memory_access_list *access)
Definition: vm_mngr.c:47
vm_MEM_LOOKUP_32
unsigned int vm_MEM_LOOKUP_32(vm_mngr_t *vm_mngr, uint64_t addr)
Definition: vm_mngr.c:498
_func_loadlib_fake
void _func_loadlib_fake(void)
_MIASM_EXPORT
#define _MIASM_EXPORT
Definition: vm_mngr.h:28
func_malloc_memory_page
void func_malloc_memory_page(void)
MEM_LOOKUP_64_PASSTHROUGH
uint64_t MEM_LOOKUP_64_PASSTHROUGH(uint64_t addr)
memory_page_node::access
uint64_t access
Definition: vm_mngr.h:94
add_code_bloc
void add_code_bloc(vm_mngr_t *vm_mngr, struct code_bloc_node *cbp)
Definition: vm_mngr.c:715
BREAKPOINT_WRITE
#define BREAKPOINT_WRITE
Definition: vm_mngr.h:81
shellcode.size
size
Definition: shellcode.py:32
basic_op.b
b
Definition: basic_op.py:10
MEM_LOOKUP_08_PASSTHROUGH
unsigned char MEM_LOOKUP_08_PASSTHROUGH(uint64_t addr)
func_free_memory_page
void func_free_memory_page(void)
_func_free_memory_page
void _func_free_memory_page(void)
memory_breakpoint_info::LIST_ENTRY
LIST_ENTRY(memory_breakpoint_info) next
memory_access::stop
uint64_t stop
Definition: vm_mngr.h:101
memory_page_node::ad
uint64_t ad
Definition: vm_mngr.h:92
LIST_FOREACH
#define LIST_FOREACH(var, head, field)
Definition: queue.h:332
hexdump
void hexdump(char *m, unsigned int l)
Definition: vm_mngr.c:984
PAGE_WRITE
#define PAGE_WRITE
Definition: vm_mngr.h:163