miasm
Reverse engineering framework
JitCore_mep.h
Go to the documentation of this file.
1 // Inspired from JitCore_msp430.h
2 
3 struct vm_cpu {
4  /* miasm flags */
5  uint32_t exception_flags;
6 
7  /* gpregs */
8  uint32_t R0;
9  uint32_t R1;
10  uint32_t R2;
11  uint32_t R3;
12  uint32_t R4;
13  uint32_t R5;
14  uint32_t R6;
15  uint32_t R7;
16  uint32_t R8;
17  uint32_t R9;
18  uint32_t R10;
19  uint32_t R11;
20  uint32_t R12;
21  uint32_t TP;
22  uint32_t GP;
23  uint32_t SP;
24 
25  /* csregs */
26  uint32_t PC;
27  uint32_t LP;
28  uint32_t SAR;
29  uint32_t S3;
30  uint32_t RPB;
31  uint32_t RPE;
32  uint32_t RPC;
33  uint32_t HI;
34  uint32_t LO;
35  uint32_t S9;
36  uint32_t S10;
37  uint32_t S11;
38  uint32_t MB0;
39  uint32_t ME0;
40  uint32_t MB1;
41  uint32_t ME1;
42  uint32_t PSW;
43  uint32_t ID;
44  uint32_t TMP;
45  uint32_t EPC;
46  uint32_t EXC;
47  uint32_t CFG;
48  uint32_t S22;
49  uint32_t NPC;
50  uint32_t DBG;
51  uint32_t DEPC;
52  uint32_t OPT;
53  uint32_t RCFG;
54  uint32_t CCFG;
55  uint32_t S29;
56  uint32_t S30;
57  uint32_t S31;
58  uint32_t S32;
59 
60  /* miasm specific regs */
61  uint32_t PC_end;
62  uint32_t RPE_instr_count;
63  uint32_t RPC_current;
64 
65 
66  uint32_t take_jmp;
67  uint32_t last_addr;
68  uint32_t is_repeat_end;
69  uint32_t in_erepeat;
70 
71  /* flags */
72 
73 };
74 
75 _MIASM_EXPORT void dump_gpregs(struct vm_cpu* vmcpu);
76 
77 _MIASM_EXPORT void MEM_WRITE_08(JitCpu* jitcpu, uint64_t addr, uint8_t src);
78 _MIASM_EXPORT void MEM_WRITE_16(JitCpu* jitcpu, uint64_t addr, uint16_t src);
79 _MIASM_EXPORT void MEM_WRITE_32(JitCpu* jitcpu, uint64_t addr, uint32_t src);
80 _MIASM_EXPORT void MEM_WRITE_64(JitCpu* jitcpu, uint64_t addr, uint64_t src);
81 
82 #define RETURN_PC return BlockDst;
dse_crackme.found
bool found
Definition: dse_crackme.py:270
MOD_INIT
MOD_INIT(JitCore_mep)
Definition: JitCore_mep.c:552
miasm.arch.mep.regs.GP
GP
Definition: regs.py:35
vm_cpu::R3
uint32_t R3
Definition: JitCore_arm.h:10
vm_cpu::S10
uint32_t S10
Definition: JitCore_mep.h:36
MEM_WRITE_08
_MIASM_EXPORT void MEM_WRITE_08(JitCpu *jitcpu, uint64_t addr, uint8_t src)
Definition: JitCore_aarch64.c:234
vm_cpu::CFG
uint32_t CFG
Definition: JitCore_mep.h:47
_reg_dict
Definition: JitCore.h:194
MOD_DEF
#define MOD_DEF(ob, name, doc, methods)
Definition: compat_py23.h:218
MEM_WRITE_32
void MEM_WRITE_32(JitCpu *jitcpu, uint64_t addr, uint32_t src)
Definition: JitCore_mep.c:261
vm_cpu::RPB
uint32_t RPB
Definition: JitCore_mep.h:30
PyGetInt_uint32_t
#define PyGetInt_uint32_t(item, value)
Definition: compat_py23.h:194
cpu_init_regs
PyObject * cpu_init_regs(JitCpu *self)
Definition: JitCore_mep.c:185
cpu_dump_gpregs_with_attrib
PyObject * cpu_dump_gpregs_with_attrib(JitCpu *self, PyObject *args)
Definition: JitCore_mep.c:226
miasm.arch.mep.regs.take_jmp
take_jmp
Definition: regs.py:16
JitCpu_new
PyObject * JitCpu_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
Definition: JitCore.c:20
vm_cpu::LP
uint32_t LP
Definition: JitCore_mep.h:27
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_cpu::R6
uint32_t R6
Definition: JitCore_arm.h:13
vm_cpu::S9
uint32_t S9
Definition: JitCore_mep.h:35
RET_MODULE
#define RET_MODULE
Definition: compat_py23.h:221
vm_cpu::R7
uint32_t R7
Definition: JitCore_arm.h:14
JitCpu_get_vmmngr
PyObject * JitCpu_get_vmmngr(JitCpu *self, void *closure)
Definition: JitCore.c:28
modint.i
i
Definition: modint.py:70
vm_cpu::TP
uint32_t TP
Definition: JitCore_mep.h:21
MEM_WRITE_64
_MIASM_EXPORT void MEM_WRITE_64(JitCpu *jitcpu, uint64_t addr, uint64_t src)
Definition: JitCore_aarch64.c:249
vm_cpu::S32
uint32_t S32
Definition: JitCore_mep.h:58
vm_cpu::R11
uint32_t R11
Definition: JitCore_arm.h:18
get_reg
#define get_reg(reg)
Definition: JitCore.h:152
vm_cpu::R8
uint32_t R8
Definition: JitCore_arm.h:15
vm_cpu::R9
uint32_t R9
Definition: JitCore_arm.h:16
PyGetStr
#define PyGetStr(dest, name)
Definition: compat_py23.h:181
vm_cpu::is_repeat_end
uint32_t is_repeat_end
Definition: JitCore_mep.h:68
vm_cpu::R0
uint32_t R0
Definition: JitCore_arm.h:7
cpu_set_exception
PyObject * cpu_set_exception(JitCpu *self, PyObject *args)
Definition: JitCore_mep.c:231
vm_cpu::last_addr
uint32_t last_addr
Definition: JitCore_mep.h:67
vm_cpu::MB0
uint32_t MB0
Definition: JitCore_mep.h:38
vm_cpu::ID
uint32_t ID
Definition: JitCore_mep.h:43
miasm.arch.mep.regs.TP
TP
Definition: regs.py:34
vm_cpu::R4
uint32_t R4
Definition: JitCore_arm.h:11
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
JitCpu_set_vmmngr
PyObject * JitCpu_set_vmmngr(JitCpu *self, PyObject *value, void *closure)
Definition: JitCore.c:38
cpu_dump_gpregs
PyObject * cpu_dump_gpregs(JitCpu *self, PyObject *args)
Definition: JitCore_mep.c:216
vm_cpu::LO
uint32_t LO
Definition: JitCore_mep.h:34
miasm.arch.arm.regs.R8
list R8
Definition: regs.py:25
vm_cpu::take_jmp
uint32_t take_jmp
Definition: JitCore_mep.h:66
miasm.arch.mep.regs.SAR
SAR
Definition: regs.py:49
vm_cpu::in_erepeat
uint32_t in_erepeat
Definition: JitCore_mep.h:69
miasm.arch.mep.regs.RPC
RPC
Definition: regs.py:52
_reg_dict::name
char * name
Definition: JitCore.h:195
JitCpu_set_jitter
PyObject * JitCpu_set_jitter(JitCpu *self, PyObject *value, void *closure)
Definition: JitCore.c:73
miasm.arch.arm.regs.R10
list R10
Definition: regs.py:27
miasm.arch.mep.regs.LP
LP
Definition: regs.py:48
vm_cpu::S22
uint32_t S22
Definition: JitCore_mep.h:48
vm_cpu::PC_end
uint32_t PC_end
Definition: JitCore_mep.h:61
vm_cpu::PC
uint64_t PC
Definition: JitCore_aarch64.h:41
RAISE
#define RAISE(errtype, msg)
Definition: JitCore.h:19
vm_cpu::S30
uint32_t S30
Definition: JitCore_mep.h:56
export_llvm.name
name
Definition: export_llvm.py:70
vm_cpu::RPC_current
uint32_t RPC_current
Definition: JitCore_mep.h:63
VmMngr
Definition: vm_mngr_py.h:8
cpu_get_gpreg
PyObject * cpu_get_gpreg(JitCpu *self)
Definition: JitCore_mep.c:82
vm_cpu::GP
uint32_t GP
Definition: JitCore_mep.h:22
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
MEM_WRITE_16
void MEM_WRITE_16(JitCpu *jitcpu, uint64_t addr, uint16_t src)
Definition: JitCore_mep.c:256
dump_gpregs
_MIASM_EXPORT void dump_gpregs(struct vm_cpu *vmcpu)
Definition: JitCore_aarch64.c:170
vm_cpu::SAR
uint32_t SAR
Definition: JitCore_mep.h:28
vm_cpu::R10
uint32_t R10
Definition: JitCore_arm.h:17
vm_cpu::ME0
uint32_t ME0
Definition: JitCore_mep.h:39
JitCpu_get_jitter
PyObject * JitCpu_get_jitter(JitCpu *self, void *closure)
Definition: JitCore.c:63
getset_reg_u32
getset_reg_u32(R0)
vm_cpu::EXC
uint32_t EXC
Definition: JitCore_mep.h:46
JitCore_mep.h
cpu_get_exception
PyObject * cpu_get_exception(JitCpu *self, PyObject *args)
Definition: JitCore_mep.c:246
MEM_WRITE_32
_MIASM_EXPORT void MEM_WRITE_32(JitCpu *jitcpu, uint64_t addr, uint32_t src)
Definition: JitCore_aarch64.c:244
miasm.arch.mep.regs.RPB
RPB
Definition: regs.py:50
miasm.arch.arm.regs.R2
list R2
Definition: regs.py:19
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
dse_crackme.stderr
stderr
Definition: dse_crackme.py:320
miasm.arch.arm.regs.SP
list SP
Definition: regs.py:30
vm_cpu::S31
uint32_t S31
Definition: JitCore_mep.h:57
miasm.arch.mep.regs.last_addr
last_addr
Definition: regs.py:14
vm_cpu::RCFG
uint32_t RCFG
Definition: JitCore_mep.h:53
vm_cpu::HI
uint32_t HI
Definition: JitCore_mep.h:33
vm_cpu::RPE
uint32_t RPE
Definition: JitCore_mep.h:31
vm_cpu::S11
uint32_t S11
Definition: JitCore_mep.h:37
vm_cpu::CCFG
uint32_t CCFG
Definition: JitCore_mep.h:54
get_gpreg_offset_all
PyObject * get_gpreg_offset_all(void)
Definition: JitCore_mep.c:355
vm_cpu::exception_flags
uint32_t exception_flags
Definition: JitCore_aarch64.h:3
gpreg_dict
reg_dict gpreg_dict[]
Definition: JitCore_mep.c:17
_MIASM_EXPORT
#define _MIASM_EXPORT
Definition: JitCore_x86.h:6
shellcode.args
args
Definition: shellcode.py:26
miasm.arch.arm.regs.R0
list R0
Definition: regs.py:17
_reg_dict::offset
size_t offset
Definition: JitCore.h:196
cpu_set_gpreg
PyObject * cpu_set_gpreg(JitCpu *self, PyObject *args)
Definition: JitCore_mep.c:147
miasm.arch.arm.regs.R11
list R11
Definition: regs.py:28
vm_cpu::DBG
uint32_t DBG
Definition: JitCore_mep.h:50
MEM_WRITE_64
void MEM_WRITE_64(JitCpu *jitcpu, uint64_t addr, uint64_t src)
Definition: JitCore_mep.c:266
vm_cpu::S3
uint32_t S3
Definition: JitCore_mep.h:29
JitCpu::pyvm
PyObject_HEAD VmMngr * pyvm
Definition: JitCore.h:188
miasm.arch.arm.regs.R5
list R5
Definition: regs.py:22
MEM_WRITE_08
void MEM_WRITE_08(JitCpu *jitcpu, uint64_t addr, uint8_t src)
Definition: JitCore_mep.c:251
dump_gpregs
void dump_gpregs(struct vm_cpu *vmcpu)
Definition: JitCore_mep.c:194
vm_cpu::EPC
uint32_t EPC
Definition: JitCore_mep.h:45
miasm.arch.mep.regs.is_repeat_end
is_repeat_end
Definition: regs.py:12
vm_cpu::OPT
uint32_t OPT
Definition: JitCore_mep.h:52
miasm.arch.arm.regs.R9
list R9
Definition: regs.py:26
JitCpu_dealloc
void JitCpu_dealloc(JitCpu *self)
Definition: JitCore.c:14
vm_cpu::ME1
uint32_t ME1
Definition: JitCore_mep.h:41
miasm.arch.arm.regs.R3
list R3
Definition: regs.py:20
vm_cpu::RPE_instr_count
uint32_t RPE_instr_count
Definition: JitCore_mep.h:62
miasm.arch.aarch64.regs.PC
PC
Definition: regs.py:137
vm_cpu::RPC
uint32_t RPC
Definition: JitCore_mep.h:32
dis_binary.addr
addr
Definition: dis_binary.py:24
miasm.arch.arm.regs.R1
list R1
Definition: regs.py:18
vm_cpu::DEPC
uint32_t DEPC
Definition: JitCore_mep.h:51
miasm.arch.arm.regs.R4
list R4
Definition: regs.py:21
get_reg_off
#define get_reg_off(reg)
Definition: JitCore.h:170
simplification_tools.o
o
Definition: simplification_tools.py:24
miasm.arch.mep.regs.RPE
RPE
Definition: regs.py:51
vm_cpu::S29
uint32_t S29
Definition: JitCore_mep.h:55
vm_cpu::NPC
uint32_t NPC
Definition: JitCore_mep.h:49
vm_cpu::SP
uint64_t SP
Definition: JitCore_aarch64.h:39
example_types.val
val
Definition: example_types.py:218
vm_cpu::PSW
uint32_t PSW
Definition: JitCore_mep.h:42
miasm.arch.arm.regs.R6
list R6
Definition: regs.py:23
vm_cpu::TMP
uint32_t TMP
Definition: JitCore_mep.h:44
vm_cpu::R5
uint32_t R5
Definition: JitCore_arm.h:12
miasm.arch.arm.regs.R12
list R12
Definition: regs.py:29
vm_cpu::R2
uint32_t R2
Definition: JitCore_arm.h:9
miasm.arch.aarch64.regs.exception_flags
exception_flags
Definition: regs.py:7
JitCpu
Definition: JitCore.h:186
vm_cpu
Definition: JitCore_aarch64.h:2
vm_cpu::R1
uint32_t R1
Definition: JitCore_arm.h:8
vm_cpu::R12
uint32_t R12
Definition: JitCore_arm.h:19
vm_cpu::MB1
uint32_t MB1
Definition: JitCore_mep.h:40
MEM_WRITE_16
_MIASM_EXPORT void MEM_WRITE_16(JitCpu *jitcpu, uint64_t addr, uint16_t src)
Definition: JitCore_aarch64.c:239
miasm.arch.arm.regs.R7
list R7
Definition: regs.py:24