-
Notifications
You must be signed in to change notification settings - Fork 1
/
insn.h
97 lines (81 loc) · 1.03 KB
/
insn.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
enum {
O_UNK,
O_MOV,
O_MVN,
O_AND,
O_TST,
O_BIC,
O_ORR,
O_EOR,
O_LSL,
O_LSR,
O_ASR,
O_ROR,
O_NOP,
O_ADD,
O_ADC,
O_SUB,
O_SBC,
O_NEG,
O_CMP,
O_CMN,
O_MUL,
O_B,
O_BL,
O_BX,
O_BEQ,
O_BNE,
O_BCS,
O_BCC,
O_BMI,
O_BPL,
O_BVS,
O_BVC,
O_BHI,
O_BLS,
O_BGE,
O_BLT,
O_BGT,
O_BLE,
O_SWI,
O_LDR,
O_LDRB,
O_LDRH,
O_LDSB,
O_LDSH,
O_STR,
O_STRB,
O_STRH,
O_PUSH,
O_POP,
O_STMIA,
O_LDMIA,
};
enum {
R_SP = 13,
};
enum {
O_VOID = 0, // no operand
O_IMM = 1, // immediate value
O_REG = 2, // register
O_CODE= 3, // code pointer
O_MEM = 4, // memory access
O_REGMASK = 5, // mask of registers, used for push/pop
};
struct ArmOp {
byte type;
byte reg;
byte reg2; // second register in memory access.. or 0xff
uint32 value;
};
struct ArmIns {
byte mnem; // mnemonic
ArmOp op[3]; // operands
#define op1 op[0]
#define op2 op[1]
#define op3 op[2]
};
int DecodeThumb(ArmIns &i, ea_t pc);
void PrintThumb(ArmIns &i, char *s);
extern const char * const _regs[];
extern const char * const _mnems[];