miasm
Reverse engineering framework
JitCore.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  block_id
 
struct  JitCpu
 
struct  _reg_dict
 

Macros

#define _MIASM_EXPORT
 
#define RAISE(errtype, msg)   {PyObject* p; p = PyErr_Format( errtype, msg ); return p;}
 
#define RAISE_ret0(errtype, msg)   {PyObject* p; p = PyErr_Format( errtype, msg ); return 0;}
 
#define getset_reg_bn(regname, size)
 
#define getset_reg_u64(regname)
 
#define getset_reg_u32(regname)
 
#define getset_reg_u16(regname)
 
#define getset_reg_u8(regname)
 
#define get_reg(reg)
 
#define get_reg_bn(reg, size)
 
#define get_reg_off(reg)
 
#define Resolve_dst(b, arg_addr, arg_is_local)   do {(b)->address = (arg_addr); (b)->is_local = (arg_is_local);} while(0)
 
#define VM_exception_flag   (jitcpu->pyvm->vm_mngr.exception_flags)
 
#define CPU_exception_flag   (((struct vm_cpu*)jitcpu->cpu)->exception_flags)
 
#define CPU_exception_flag_at_instr   ((CPU_exception_flag) && ((CPU_exception_flag) > EXCEPT_NUM_UPDT_EIP))
 
#define JIT_RET_EXCEPTION   1
 
#define JIT_RET_NO_EXCEPTION   0
 

Typedefs

typedef struct _reg_dict reg_dict
 

Functions

void JitCpu_dealloc (JitCpu *self)
 
PyObject * JitCpu_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
 
PyObject * JitCpu_get_vmmngr (JitCpu *self, void *closure)
 
PyObject * JitCpu_set_vmmngr (JitCpu *self, PyObject *value, void *closure)
 
PyObject * JitCpu_get_vmcpu (JitCpu *self, void *closure)
 
PyObject * JitCpu_set_vmcpu (JitCpu *self, PyObject *value, void *closure)
 
PyObject * JitCpu_get_jitter (JitCpu *self, void *closure)
 
PyObject * JitCpu_set_jitter (JitCpu *self, PyObject *value, void *closure)
 
void Resolve_dst (block_id *BlockDst, uint64_t addr, uint64_t is_local)
 
_MIASM_EXPORT uint8_t MEM_LOOKUP_08 (JitCpu *jitcpu, uint64_t addr)
 
_MIASM_EXPORT uint16_t MEM_LOOKUP_16 (JitCpu *jitcpu, uint64_t addr)
 
_MIASM_EXPORT uint32_t MEM_LOOKUP_32 (JitCpu *jitcpu, uint64_t addr)
 
_MIASM_EXPORT uint64_t MEM_LOOKUP_64 (JitCpu *jitcpu, uint64_t addr)
 
_MIASM_EXPORT bn_t MEM_LOOKUP_BN_BN (JitCpu *jitcpu, int size, bn_t addr)
 
_MIASM_EXPORT bn_t MEM_LOOKUP_INT_BN (JitCpu *jitcpu, int size, uint64_t addr)
 
_MIASM_EXPORT uint64_t MEM_LOOKUP_BN_INT (JitCpu *jitcpu, int size, bn_t addr)
 
_MIASM_EXPORT void MEM_WRITE_BN_BN (JitCpu *jitcpu, int size, bn_t addr, bn_t src)
 
_MIASM_EXPORT void MEM_WRITE_BN_INT (JitCpu *jitcpu, int size, bn_t addr, uint64_t src)
 
_MIASM_EXPORT void MEM_WRITE_INT_BN (JitCpu *jitcpu, int size, uint64_t addr, bn_t src)
 
_MIASM_EXPORT void MEM_LOOKUP_INT_BN_TO_PTR (JitCpu *jitcpu, int size, uint64_t addr, char *ptr)
 
_MIASM_EXPORT void MEM_WRITE_INT_BN_FROM_PTR (JitCpu *jitcpu, int size, uint64_t addr, char *ptr)
 

Macro Definition Documentation

◆ _MIASM_EXPORT

#define _MIASM_EXPORT

◆ CPU_exception_flag

#define CPU_exception_flag   (((struct vm_cpu*)jitcpu->cpu)->exception_flags)

◆ CPU_exception_flag_at_instr

#define CPU_exception_flag_at_instr   ((CPU_exception_flag) && ((CPU_exception_flag) > EXCEPT_NUM_UPDT_EIP))

◆ get_reg

#define get_reg (   reg)
Value:
do { \
o = PyLong_FromUnsignedLongLong((uint64_t)self->cpu->reg); \
PyDict_SetItemString(dict, #reg, o); \
Py_DECREF(o); \
} while(0);

◆ get_reg_bn

#define get_reg_bn (   reg,
  size 
)
Value:
do { \
bn_t bn; \
PyObject* py_long; \
bn = self->cpu->reg; \
bn = bignum_mask(bn, size); \
py_long = bn_to_PyLong(bn); \
PyDict_SetItemString(dict, #reg, py_long); \
Py_DECREF(py_long); \
} while(0);

◆ get_reg_off

#define get_reg_off (   reg)
Value:
do { \
o = PyLong_FromUnsignedLongLong((uint64_t)offsetof(struct vm_cpu, reg)); \
PyDict_SetItemString(dict, #reg, o); \
Py_DECREF(o); \
} while(0);

◆ getset_reg_bn

#define getset_reg_bn (   regname,
  size 
)

◆ getset_reg_u16

#define getset_reg_u16 (   regname)
Value:
static PyObject *JitCpu_get_ ## regname (JitCpu *self, void *closure) \
{ \
return PyLong_FromUnsignedLongLong(self->cpu->regname); \
} \
static int JitCpu_set_ ## regname (JitCpu *self, PyObject *value, void *closure) \
{ \
uint16_t val; \
PyGetInt_uint16_t_retneg(value, val); \
self->cpu->regname = val; \
return 0; \
}

◆ getset_reg_u32

#define getset_reg_u32 (   regname)
Value:
static PyObject *JitCpu_get_ ## regname (JitCpu *self, void *closure) \
{ \
return PyLong_FromUnsignedLongLong(self->cpu->regname); \
} \
static int JitCpu_set_ ## regname (JitCpu *self, PyObject *value, void *closure) \
{ \
uint32_t val; \
PyGetInt_uint32_t_retneg(value, val); \
self->cpu->regname = val; \
return 0; \
}

◆ getset_reg_u64

#define getset_reg_u64 (   regname)
Value:
static PyObject *JitCpu_get_ ## regname (JitCpu *self, void *closure) \
{ \
return PyLong_FromUnsignedLongLong(self->cpu->regname); \
} \
static int JitCpu_set_ ## regname (JitCpu *self, PyObject *value, void *closure) \
{ \
uint64_t val; \
PyGetInt_uint64_t_retneg(value, val); \
self->cpu->regname = val; \
return 0; \
}

◆ getset_reg_u8

#define getset_reg_u8 (   regname)
Value:
static PyObject *JitCpu_get_ ## regname (JitCpu *self, void *closure) \
{ \
return PyLong_FromUnsignedLongLong(self->cpu->regname); \
} \
static int JitCpu_set_ ## regname (JitCpu *self, PyObject *value, void *closure) \
{ \
uint8_t val; \
PyGetInt_uint8_t_retneg(value, val); \
self->cpu->regname = val; \
return 0; \
}

◆ JIT_RET_EXCEPTION

#define JIT_RET_EXCEPTION   1

◆ JIT_RET_NO_EXCEPTION

#define JIT_RET_NO_EXCEPTION   0

◆ RAISE

#define RAISE (   errtype,
  msg 
)    {PyObject* p; p = PyErr_Format( errtype, msg ); return p;}

◆ RAISE_ret0

#define RAISE_ret0 (   errtype,
  msg 
)    {PyObject* p; p = PyErr_Format( errtype, msg ); return 0;}

◆ Resolve_dst

#define Resolve_dst (   b,
  arg_addr,
  arg_is_local 
)    do {(b)->address = (arg_addr); (b)->is_local = (arg_is_local);} while(0)

◆ VM_exception_flag

#define VM_exception_flag   (jitcpu->pyvm->vm_mngr.exception_flags)

Typedef Documentation

◆ reg_dict

typedef struct _reg_dict reg_dict

Function Documentation

◆ JitCpu_dealloc()

void JitCpu_dealloc ( JitCpu self)

◆ JitCpu_get_jitter()

PyObject* JitCpu_get_jitter ( JitCpu self,
void *  closure 
)

◆ JitCpu_get_vmcpu()

PyObject* JitCpu_get_vmcpu ( JitCpu self,
void *  closure 
)
Here is the call graph for this function:

◆ JitCpu_get_vmmngr()

PyObject* JitCpu_get_vmmngr ( JitCpu self,
void *  closure 
)

◆ JitCpu_new()

PyObject* JitCpu_new ( PyTypeObject *  type,
PyObject *  args,
PyObject *  kwds 
)

◆ JitCpu_set_jitter()

PyObject* JitCpu_set_jitter ( JitCpu self,
PyObject *  value,
void *  closure 
)

◆ JitCpu_set_vmcpu()

PyObject* JitCpu_set_vmcpu ( JitCpu self,
PyObject *  value,
void *  closure 
)

◆ JitCpu_set_vmmngr()

PyObject* JitCpu_set_vmmngr ( JitCpu self,
PyObject *  value,
void *  closure 
)

◆ MEM_LOOKUP_08()

_MIASM_EXPORT uint8_t MEM_LOOKUP_08 ( JitCpu jitcpu,
uint64_t  addr 
)
Here is the call graph for this function:

◆ MEM_LOOKUP_16()

_MIASM_EXPORT uint16_t MEM_LOOKUP_16 ( JitCpu jitcpu,
uint64_t  addr 
)
Here is the call graph for this function:

◆ MEM_LOOKUP_32()

_MIASM_EXPORT uint32_t MEM_LOOKUP_32 ( JitCpu jitcpu,
uint64_t  addr 
)
Here is the call graph for this function:

◆ MEM_LOOKUP_64()

_MIASM_EXPORT uint64_t MEM_LOOKUP_64 ( JitCpu jitcpu,
uint64_t  addr 
)
Here is the call graph for this function:

◆ MEM_LOOKUP_BN_BN()

_MIASM_EXPORT bn_t MEM_LOOKUP_BN_BN ( JitCpu jitcpu,
int  size,
bn_t  addr 
)
Here is the call graph for this function:

◆ MEM_LOOKUP_BN_INT()

_MIASM_EXPORT uint64_t MEM_LOOKUP_BN_INT ( JitCpu jitcpu,
int  size,
bn_t  addr 
)
Here is the call graph for this function:

◆ MEM_LOOKUP_INT_BN()

_MIASM_EXPORT bn_t MEM_LOOKUP_INT_BN ( JitCpu jitcpu,
int  size,
uint64_t  addr 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ MEM_LOOKUP_INT_BN_TO_PTR()

_MIASM_EXPORT void MEM_LOOKUP_INT_BN_TO_PTR ( JitCpu jitcpu,
int  size,
uint64_t  addr,
char *  ptr 
)
Here is the call graph for this function:

◆ MEM_WRITE_BN_BN()

_MIASM_EXPORT void MEM_WRITE_BN_BN ( JitCpu jitcpu,
int  size,
bn_t  addr,
bn_t  src 
)
Here is the call graph for this function:

◆ MEM_WRITE_BN_INT()

_MIASM_EXPORT void MEM_WRITE_BN_INT ( JitCpu jitcpu,
int  size,
bn_t  addr,
uint64_t  src 
)
Here is the call graph for this function:

◆ MEM_WRITE_INT_BN()

_MIASM_EXPORT void MEM_WRITE_INT_BN ( JitCpu jitcpu,
int  size,
uint64_t  addr,
bn_t  src 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ MEM_WRITE_INT_BN_FROM_PTR()

_MIASM_EXPORT void MEM_WRITE_INT_BN_FROM_PTR ( JitCpu jitcpu,
int  size,
uint64_t  addr,
char *  ptr 
)
Here is the call graph for this function:

◆ Resolve_dst()

void Resolve_dst ( block_id BlockDst,
uint64_t  addr,
uint64_t  is_local 
)
bn
Definition: bn.h:97
export_llvm.value
value
Definition: export_llvm.py:69
miasm.arch.x86.arch.reg
reg
Definition: arch.py:3263
bignum_mask
bn_t bignum_mask(bn_t src, int bits)
Definition: bn.c:699
simplification_tools.o
o
Definition: simplification_tools.py:24
example_types.val
val
Definition: example_types.py:218
bn_to_PyLong
PyObject * bn_to_PyLong(bn_t bn)
Definition: vm_mngr_py.c:1064
shellcode.size
size
Definition: shellcode.py:32
JitCpu
Definition: JitCore.h:186
vm_cpu
Definition: JitCore_aarch64.h:2