miasm
Reverse engineering framework
JitCore_x86.c File Reference
#include <Python.h>
#include "structmember.h"
#include <stdint.h>
#include <inttypes.h>
#include "../compat_py23.h"
#include "../queue.h"
#include "../vm_mngr.h"
#include "../bn.h"
#include "../vm_mngr_py.h"
#include "../JitCore.h"
#include "../op_semantics.h"
#include "JitCore_x86.h"
Include dependency graph for JitCore_x86.c:

Macros

#define getset_reg_E_u32(regname)
 
#define getset_reg_R_u16(regname)
 

Functions

PyObject * cpu_get_gpreg (JitCpu *self)
 
PyObject * cpu_set_gpreg (JitCpu *self, PyObject *args)
 
PyObject * cpu_init_regs (JitCpu *self)
 
void dump_gpregs_16 (struct vm_cpu *vmcpu)
 
void dump_gpregs_32 (struct vm_cpu *vmcpu)
 
void dump_gpregs_64 (struct vm_cpu *vmcpu)
 
PyObject * cpu_dump_gpregs (JitCpu *self, PyObject *args)
 
PyObject * cpu_dump_gpregs_with_attrib (JitCpu *self, PyObject *args)
 
PyObject * cpu_set_exception (JitCpu *self, PyObject *args)
 
PyObject * cpu_get_exception (JitCpu *self, PyObject *args)
 
PyObject * cpu_set_interrupt_num (JitCpu *self, PyObject *args)
 
PyObject * cpu_get_interrupt_num (JitCpu *self, PyObject *args)
 
PyObject * cpu_set_segm_base (JitCpu *self, PyObject *args)
 
PyObject * cpu_get_segm_base (JitCpu *self, PyObject *args)
 
uint64_t segm2addr (JitCpu *jitcpu, uint64_t segm, uint64_t addr)
 
void MEM_WRITE_08 (JitCpu *jitcpu, uint64_t addr, uint8_t src)
 
void MEM_WRITE_16 (JitCpu *jitcpu, uint64_t addr, uint16_t src)
 
void MEM_WRITE_32 (JitCpu *jitcpu, uint64_t addr, uint32_t src)
 
void MEM_WRITE_64 (JitCpu *jitcpu, uint64_t addr, uint64_t src)
 
 getset_reg_u64 (RAX)
 
 getset_reg_u64 (RBX)
 
 getset_reg_u64 (RCX)
 
 getset_reg_u64 (RDX)
 
 getset_reg_u64 (RSI)
 
 getset_reg_u64 (RDI)
 
 getset_reg_u64 (RSP)
 
 getset_reg_u64 (RBP)
 
 getset_reg_u64 (R8)
 
 getset_reg_u64 (R9)
 
 getset_reg_u64 (R10)
 
 getset_reg_u64 (R11)
 
 getset_reg_u64 (R12)
 
 getset_reg_u64 (R13)
 
 getset_reg_u64 (R14)
 
 getset_reg_u64 (R15)
 
 getset_reg_u64 (RIP)
 
 getset_reg_u8 (zf)
 
 getset_reg_u8 (nf)
 
 getset_reg_u8 (pf)
 
 getset_reg_u8 (of)
 
 getset_reg_u8 (cf)
 
 getset_reg_u8 (af)
 
 getset_reg_u8 (df)
 
 getset_reg_u16 (ES)
 
 getset_reg_u16 (CS)
 
 getset_reg_u16 (SS)
 
 getset_reg_u16 (DS)
 
 getset_reg_u16 (FS)
 
 getset_reg_u16 (GS)
 
 getset_reg_E_u32 (AX)
 
 getset_reg_E_u32 (BX)
 
 getset_reg_E_u32 (CX)
 
 getset_reg_E_u32 (DX)
 
 getset_reg_E_u32 (SI)
 
 getset_reg_E_u32 (DI)
 
 getset_reg_E_u32 (SP)
 
 getset_reg_E_u32 (BP)
 
 getset_reg_E_u32 (IP)
 
 getset_reg_R_u16 (AX)
 
 getset_reg_R_u16 (BX)
 
 getset_reg_R_u16 (CX)
 
 getset_reg_R_u16 (DX)
 
 getset_reg_R_u16 (SI)
 
 getset_reg_R_u16 (DI)
 
 getset_reg_R_u16 (SP)
 
 getset_reg_R_u16 (BP)
 
 getset_reg_R_u16 (IP)
 
 getset_reg_u64 (MM0)
 
 getset_reg_u64 (MM1)
 
 getset_reg_u64 (MM2)
 
 getset_reg_u64 (MM3)
 
 getset_reg_u64 (MM4)
 
 getset_reg_u64 (MM5)
 
 getset_reg_u64 (MM6)
 
 getset_reg_u64 (MM7)
 
 getset_reg_bn (XMM0, 128)
 
 getset_reg_bn (XMM1, 128)
 
 getset_reg_bn (XMM2, 128)
 
 getset_reg_bn (XMM3, 128)
 
 getset_reg_bn (XMM4, 128)
 
 getset_reg_bn (XMM5, 128)
 
 getset_reg_bn (XMM6, 128)
 
 getset_reg_bn (XMM7, 128)
 
 getset_reg_bn (XMM8, 128)
 
 getset_reg_bn (XMM9, 128)
 
 getset_reg_bn (XMM10, 128)
 
 getset_reg_bn (XMM11, 128)
 
 getset_reg_bn (XMM12, 128)
 
 getset_reg_bn (XMM13, 128)
 
 getset_reg_bn (XMM14, 128)
 
 getset_reg_bn (XMM15, 128)
 
 getset_reg_u64 (tsc)
 
 getset_reg_u32 (exception_flags)
 
 getset_reg_u32 (interrupt_num)
 
PyObject * get_gpreg_offset_all (void)
 
 MOD_INIT (JitCore_x86)
 

Variables

struct vm_cpu ref_arch_regs
 
reg_dict gpreg_dict []
 

Macro Definition Documentation

◆ getset_reg_E_u32

#define getset_reg_E_u32 (   regname)
Value:
static PyObject *JitCpu_get_E ## regname (JitCpu *self, void *closure) \
{ \
return PyLong_FromUnsignedLongLong((uint32_t)(self->cpu->R ## regname & 0xFFFFFFFF )); \
} \
static int JitCpu_set_E ## regname (JitCpu *self, PyObject *value, void *closure) \
{ \
uint32_t val32; \
uint64_t val64; \
PyGetInt_uint32_t_retneg(value, val32); \
val64 = val32; \
val64 |= self->cpu->R ##regname & 0xFFFFFFFF00000000ULL; \
self->cpu->R ## regname = val64; \
return 0; \
}

◆ getset_reg_R_u16

#define getset_reg_R_u16 (   regname)
Value:
static PyObject *JitCpu_get_ ## regname (JitCpu *self, void *closure) \
{ \
return PyLong_FromUnsignedLongLong((uint16_t)(self->cpu->R ## regname & 0xFFFF )); \
} \
static int JitCpu_set_ ## regname (JitCpu *self, PyObject *value, void *closure) \
{ \
uint16_t val16; \
uint64_t val64; \
PyGetInt_uint16_t_retneg(value, val16); \
val64 = val16; \
val64 |= self->cpu->R ##regname & 0xFFFFFFFFFFFF0000ULL; \
self->cpu->R ## regname = val64; \
return 0; \
}

Function Documentation

◆ cpu_dump_gpregs()

PyObject* cpu_dump_gpregs ( JitCpu self,
PyObject *  args 
)
Here is the call graph for this function:

◆ cpu_dump_gpregs_with_attrib()

PyObject* cpu_dump_gpregs_with_attrib ( JitCpu self,
PyObject *  args 
)
Here is the call graph for this function:

◆ cpu_get_exception()

PyObject* cpu_get_exception ( JitCpu self,
PyObject *  args 
)

◆ cpu_get_gpreg()

PyObject* cpu_get_gpreg ( JitCpu self)

◆ cpu_get_interrupt_num()

PyObject* cpu_get_interrupt_num ( JitCpu self,
PyObject *  args 
)

◆ cpu_get_segm_base()

PyObject* cpu_get_segm_base ( JitCpu self,
PyObject *  args 
)

◆ cpu_init_regs()

PyObject* cpu_init_regs ( JitCpu self)

◆ cpu_set_exception()

PyObject* cpu_set_exception ( JitCpu self,
PyObject *  args 
)

◆ cpu_set_gpreg()

PyObject* cpu_set_gpreg ( JitCpu self,
PyObject *  args 
)
Here is the call graph for this function:

◆ cpu_set_interrupt_num()

PyObject* cpu_set_interrupt_num ( JitCpu self,
PyObject *  args 
)

◆ cpu_set_segm_base()

PyObject* cpu_set_segm_base ( JitCpu self,
PyObject *  args 
)

◆ dump_gpregs_16()

void dump_gpregs_16 ( struct vm_cpu vmcpu)

◆ dump_gpregs_32()

void dump_gpregs_32 ( struct vm_cpu vmcpu)
Here is the caller graph for this function:

◆ dump_gpregs_64()

void dump_gpregs_64 ( struct vm_cpu vmcpu)
Here is the caller graph for this function:

◆ get_gpreg_offset_all()

PyObject* get_gpreg_offset_all ( void  )

◆ getset_reg_bn() [1/16]

getset_reg_bn ( XMM0  ,
128   
)

◆ getset_reg_bn() [2/16]

getset_reg_bn ( XMM1  ,
128   
)

◆ getset_reg_bn() [3/16]

getset_reg_bn ( XMM10  ,
128   
)

◆ getset_reg_bn() [4/16]

getset_reg_bn ( XMM11  ,
128   
)

◆ getset_reg_bn() [5/16]

getset_reg_bn ( XMM12  ,
128   
)

◆ getset_reg_bn() [6/16]

getset_reg_bn ( XMM13  ,
128   
)

◆ getset_reg_bn() [7/16]

getset_reg_bn ( XMM14  ,
128   
)

◆ getset_reg_bn() [8/16]

getset_reg_bn ( XMM15  ,
128   
)

◆ getset_reg_bn() [9/16]

getset_reg_bn ( XMM2  ,
128   
)

◆ getset_reg_bn() [10/16]

getset_reg_bn ( XMM3  ,
128   
)

◆ getset_reg_bn() [11/16]

getset_reg_bn ( XMM4  ,
128   
)

◆ getset_reg_bn() [12/16]

getset_reg_bn ( XMM5  ,
128   
)

◆ getset_reg_bn() [13/16]

getset_reg_bn ( XMM6  ,
128   
)

◆ getset_reg_bn() [14/16]

getset_reg_bn ( XMM7  ,
128   
)

◆ getset_reg_bn() [15/16]

getset_reg_bn ( XMM8  ,
128   
)

◆ getset_reg_bn() [16/16]

getset_reg_bn ( XMM9  ,
128   
)

◆ getset_reg_E_u32() [1/9]

getset_reg_E_u32 ( AX  )

◆ getset_reg_E_u32() [2/9]

getset_reg_E_u32 ( BP  )

◆ getset_reg_E_u32() [3/9]

getset_reg_E_u32 ( BX  )

◆ getset_reg_E_u32() [4/9]

getset_reg_E_u32 ( CX  )

◆ getset_reg_E_u32() [5/9]

getset_reg_E_u32 ( DI  )

◆ getset_reg_E_u32() [6/9]

getset_reg_E_u32 ( DX  )

◆ getset_reg_E_u32() [7/9]

getset_reg_E_u32 ( IP  )

◆ getset_reg_E_u32() [8/9]

getset_reg_E_u32 ( SI  )

◆ getset_reg_E_u32() [9/9]

getset_reg_E_u32 ( SP  )

◆ getset_reg_R_u16() [1/9]

getset_reg_R_u16 ( AX  )

◆ getset_reg_R_u16() [2/9]

getset_reg_R_u16 ( BP  )

◆ getset_reg_R_u16() [3/9]

getset_reg_R_u16 ( BX  )

◆ getset_reg_R_u16() [4/9]

getset_reg_R_u16 ( CX  )

◆ getset_reg_R_u16() [5/9]

getset_reg_R_u16 ( DI  )

◆ getset_reg_R_u16() [6/9]

getset_reg_R_u16 ( DX  )

◆ getset_reg_R_u16() [7/9]

getset_reg_R_u16 ( IP  )

◆ getset_reg_R_u16() [8/9]

getset_reg_R_u16 ( SI  )

◆ getset_reg_R_u16() [9/9]

getset_reg_R_u16 ( SP  )

◆ getset_reg_u16() [1/6]

getset_reg_u16 ( CS  )

◆ getset_reg_u16() [2/6]

getset_reg_u16 ( DS  )

◆ getset_reg_u16() [3/6]

getset_reg_u16 ( ES  )

◆ getset_reg_u16() [4/6]

getset_reg_u16 ( FS  )

◆ getset_reg_u16() [5/6]

getset_reg_u16 ( GS  )

◆ getset_reg_u16() [6/6]

getset_reg_u16 ( SS  )

◆ getset_reg_u32() [1/2]

getset_reg_u32 ( exception_flags  )

◆ getset_reg_u32() [2/2]

getset_reg_u32 ( interrupt_num  )

◆ getset_reg_u64() [1/26]

getset_reg_u64 ( MM0  )

◆ getset_reg_u64() [2/26]

getset_reg_u64 ( MM1  )

◆ getset_reg_u64() [3/26]

getset_reg_u64 ( MM2  )

◆ getset_reg_u64() [4/26]

getset_reg_u64 ( MM3  )

◆ getset_reg_u64() [5/26]

getset_reg_u64 ( MM4  )

◆ getset_reg_u64() [6/26]

getset_reg_u64 ( MM5  )

◆ getset_reg_u64() [7/26]

getset_reg_u64 ( MM6  )

◆ getset_reg_u64() [8/26]

getset_reg_u64 ( MM7  )

◆ getset_reg_u64() [9/26]

getset_reg_u64 ( R10  )

◆ getset_reg_u64() [10/26]

getset_reg_u64 ( R11  )

◆ getset_reg_u64() [11/26]

getset_reg_u64 ( R12  )

◆ getset_reg_u64() [12/26]

getset_reg_u64 ( R13  )

◆ getset_reg_u64() [13/26]

getset_reg_u64 ( R14  )

◆ getset_reg_u64() [14/26]

getset_reg_u64 ( R15  )

◆ getset_reg_u64() [15/26]

getset_reg_u64 ( R8  )

◆ getset_reg_u64() [16/26]

getset_reg_u64 ( R9  )

◆ getset_reg_u64() [17/26]

getset_reg_u64 ( RAX  )

◆ getset_reg_u64() [18/26]

getset_reg_u64 ( RBP  )

◆ getset_reg_u64() [19/26]

getset_reg_u64 ( RBX  )

◆ getset_reg_u64() [20/26]

getset_reg_u64 ( RCX  )

◆ getset_reg_u64() [21/26]

getset_reg_u64 ( RDI  )

◆ getset_reg_u64() [22/26]

getset_reg_u64 ( RDX  )

◆ getset_reg_u64() [23/26]

getset_reg_u64 ( RIP  )

◆ getset_reg_u64() [24/26]

getset_reg_u64 ( RSI  )

◆ getset_reg_u64() [25/26]

getset_reg_u64 ( RSP  )

◆ getset_reg_u64() [26/26]

getset_reg_u64 ( tsc  )

◆ getset_reg_u8() [1/7]

getset_reg_u8 ( af  )

◆ getset_reg_u8() [2/7]

getset_reg_u8 ( cf  )

◆ getset_reg_u8() [3/7]

getset_reg_u8 ( df  )

◆ getset_reg_u8() [4/7]

getset_reg_u8 ( nf  )

◆ getset_reg_u8() [5/7]

getset_reg_u8 ( of  )

◆ getset_reg_u8() [6/7]

getset_reg_u8 ( pf  )

◆ getset_reg_u8() [7/7]

getset_reg_u8 ( zf  )

◆ MEM_WRITE_08()

void MEM_WRITE_08 ( JitCpu jitcpu,
uint64_t  addr,
uint8_t  src 
)
Here is the call graph for this function:

◆ MEM_WRITE_16()

void MEM_WRITE_16 ( JitCpu jitcpu,
uint64_t  addr,
uint16_t  src 
)
Here is the call graph for this function:

◆ MEM_WRITE_32()

void MEM_WRITE_32 ( JitCpu jitcpu,
uint64_t  addr,
uint32_t  src 
)
Here is the call graph for this function:

◆ MEM_WRITE_64()

void MEM_WRITE_64 ( JitCpu jitcpu,
uint64_t  addr,
uint64_t  src 
)
Here is the call graph for this function:

◆ MOD_INIT()

MOD_INIT ( JitCore_x86  )

◆ segm2addr()

uint64_t segm2addr ( JitCpu jitcpu,
uint64_t  segm,
uint64_t  addr 
)

Variable Documentation

◆ gpreg_dict

reg_dict gpreg_dict[]

◆ ref_arch_regs

struct vm_cpu ref_arch_regs
export_llvm.value
value
Definition: export_llvm.py:69
JitCpu
Definition: JitCore.h:186