1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
24
25
26
27
33
35
36
42
44
45
46
47
48
52
53
54
58
59
60
64
65
66
72
74
76
77
81
82
83
87
88
89
93
94
95
99
100
101
105
106
107
111
112
113
117
118
119
122
123
124
125
126
127
128
129
130
131
132
133
134
137
138
141
142
143
146
147
148
149
150
151
152
153
154
155
156
157
158
159
162
163
164
165
166
167
168
169
170
171
172
173
174
177
178
179
180
181
182
183
184
185
186
189
190
197
200
201
202
203
204
205
206
207
208
209
212
213
220
223
224
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
245
248
249
253
256
257
261
264
265
268
271
272
276
281
282
286
287
288
292
295
296
299
302
303
306
309
310
313
316
317
322
324
325
330
332
333
338
339
340
341
344
347
348
/* ... */
#ifndef OPENOCD_TARGET_ARM_OPCODES_H
#define OPENOCD_TARGET_ARM_OPCODES_H
/* ... */
/* ... */
#define ARMV4_5_STMIA(rn, list, s, w) \
(0xe8800000 | ((s) << 22) | ((w) << 21) | ((rn) << 16) | (list))...
/* ... */
#define ARMV4_5_LDMIA(rn, list, s, w) \
(0xe8900000 | ((s) << 22) | ((w) << 21) | ((rn) << 16) | (list))...
#define ARMV4_5_NOP (0xe1a08008)
/* ... */
#define ARMV4_5_MRS(rn, r) (0xe10f0000 | ((r) << 22) | ((rn) << 12))
/* ... */
#define ARMV4_5_STR(rd, rn) (0xe5800000 | ((rd) << 12) | ((rn) << 16))
/* ... */
#define ARMV4_5_LDR(rd, rn) (0xe5900000 | ((rd) << 12) | ((rn) << 16))
/* ... */
#define ARMV4_5_MSR_GP(rm, field, r) \
(0xe120f000 | (rm) | ((field) << 16) | ((r) << 22))...
#define ARMV4_5_MSR_IM(im, rotate, field, r) \
(0xe320f000 | (im) | ((rotate) << 8) | ((field) << 16) | ((r) << 22))...
/* ... */
#define ARMV4_5_LDRW_IP(rd, rn) (0xe4900004 | ((rd) << 12) | ((rn) << 16))
/* ... */
#define ARMV4_5_LDRH_IP(rd, rn) (0xe0d000b2 | ((rd) << 12) | ((rn) << 16))
/* ... */
#define ARMV4_5_LDRB_IP(rd, rn) (0xe4d00001 | ((rd) << 12) | ((rn) << 16))
/* ... */
#define ARMV4_5_STRW_IP(rd, rn) (0xe4800004 | ((rd) << 12) | ((rn) << 16))
/* ... */
#define ARMV4_5_STRH_IP(rd, rn) (0xe0c000b2 | ((rd) << 12) | ((rn) << 16))
/* ... */
#define ARMV4_5_STRB_IP(rd, rn) (0xe4c00001 | ((rd) << 12) | ((rn) << 16))
/* ... */
#define ARMV4_5_B(im, l) (0xea000000 | (im) | ((l) << 24))
/* ... */
#define ARMV4_5_BX(rm) (0xe12fff10 | (rm))
/* ... */
#define ARMV4_5_VMOV(op, rt2, rt, m, vm) \
(0xec400b10 | ((op) << 20) | ((rt2) << 16) | \
((rt) << 12) | ((m) << 5) | (vm))...
/* ... */
#define ARMV4_5_VMRS(rt) (0xeef10a10 | ((rt) << 12))
/* ... */
#define ARMV4_5_VMSR(rt) (0xeee10a10 | ((rt) << 12))
/* ... */
#define ARMV4_5_STC(p, u, d, w, cp, crd, rn, imm) \
(0xec000000 | ((p) << 24) | ((u) << 23) | ((d) << 22) | \
((w) << 21) | ((rn) << 16) | ((crd) << 12) | ((cp) << 8) | ((imm)>>2))...
/* ... */
#define ARMV4_5_LDC(p, u, d, w, cp, crd, rn, imm) \
(0xec100000 | ((p) << 24) | ((u) << 23) | ((d) << 22) | \
((w) << 21) | ((rn) << 16) | ((crd) << 12) | ((cp) << 8) | ((imm) >> 2))...
/* ... */
#define ARMV4_5_MRC(cp, op1, rd, crn, crm, op2) \
(0xee100010 | (crm) | ((op2) << 5) | ((cp) << 8) \
| ((rd) << 12) | ((crn) << 16) | ((op1) << 21))...
/* ... */
#define ARMV5_T_MRRC(cp, op, rt, rt2, crm) \
(0xec500000 | (crm) | ((op) << 4) | ((cp) << 8) \
| ((rt) << 12) | ((rt2) << 16))...
/* ... */
#define ARMV4_5_MCR(cp, op1, rd, crn, crm, op2) \
(0xee000010 | (crm) | ((op2) << 5) | ((cp) << 8) \
| ((rd) << 12) | ((crn) << 16) | ((op1) << 21))...
/* ... */
#define ARMV5_T_MCRR(cp, op, rt, rt2, crm) \
(0xec400000 | (crm) | ((op) << 4) | ((cp) << 8) \
| ((rt) << 12) | ((rt2) << 16))...
/* ... */
#define ARMV5_BKPT(im) (0xe1200070 | ((im & 0xfff0) << 4) | (im & 0xf))
/* ... */
/* ... */
#define ARMV4_5_T_STR(rd, rn) \
((0x6000 | (rd) | ((rn) << 3)) | \
((0x6000 | (rd) | ((rn) << 3)) << 16))...
/* ... */
#define ARMV4_5_T_LDR(rd, rn) \
((0x6800 | ((rn) << 3) | (rd)) \
| ((0x6800 | ((rn) << 3) | (rd)) << 16))...
/* ... */
#define ARMV4_5_T_LDMIA(rn, list) \
((0xc800 | ((rn) << 8) | (list)) \
| ((0xc800 | ((rn) << 8) | (list)) << 16))...
/* ... */
#define ARMV4_5_T_LDR_PCREL(rd) \
((0x4800 | ((rd) << 8)) \
| ((0x4800 | ((rd) << 8)) << 16))...
/* ... */
#define ARMV4_5_T_MOV(rd, rm) \
((0x4600 | ((rd) & 0x7) | (((rd) & 0x8) << 4) | \
(((rm) & 0x7) << 3) | (((rm) & 0x8) << 3)) \
| ((0x4600 | ((rd) & 0x7) | (((rd) & 0x8) << 4) | \
(((rm) & 0x7) << 3) | (((rm) & 0x8) << 3)) << 16))...
/* ... */
#define ARMV4_5_T_NOP (0x46c0 | (0x46c0 << 16))
/* ... */
#define ARMV4_5_T_MOV_IM(rd, im) \
((0x2000 | ((rd) << 8) | (im)) \
| ((0x2000 | ((rd) << 8) | (im)) << 16))...
/* ... */
#define ARMV4_5_T_BX(rm) \
((0x4700 | ((rm) << 3)) \
| ((0x4700 | ((rm) << 3)) << 16))...
/* ... */
#define ARMV4_5_T_B(imm) \
((0xe000 | (imm)) \
| ((0xe000 | (imm)) << 16))...
/* ... */
#define ARMV5_T_BKPT(im) \
((0xbe00 | (im)) \
| ((0xbe00 | (im)) << 16))...
/* ... */
#define ARM_T2_MRS(rd, sysm) \
((0xF3EF) | ((0x8000 | (rd << 8) | sysm) << 16))...
/* ... */
#define ARM_T2_MSR(sysm, rn) \
((0xF380 | (rn << 8)) | ((0x8800 | sysm) << 16))...
/* ... */
#define A_FLAG 4
#define I_FLAG 2
#define F_FLAG 1
#define ARM_T2_CPSID(_if) \
((0xB660 | (1 << 8) | ((_if)&0x3)) \
| ((0xB660 | (1 << 8) | ((_if)&0x3)) << 16))...
#define ARM_T2_CPSIE(_if) \
((0xB660 | (0 << 8) | ((_if)&0x3)) \
| ((0xB660 | (0 << 8) | ((_if)&0x3)) << 16))...
44 defines
/* ... */#endif