-
Notifications
You must be signed in to change notification settings - Fork 2
/
instruction.c
426 lines (420 loc) · 35.9 KB
/
instruction.c
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
//
// Created by hx1997 on 2018/11/9.
//
#include "instruction.h"
Inst standard_insts[] = {
{0x00, "add", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_MODRM_GREG, OPR_BYTE}},
{0x01, "add", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_MODRM_GREG, OPR_WORD_DWORD}},
{0x02, "add", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_BYTE, ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x03, "add", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}},
{0x04, "add", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AL, OPR_UNSPECIFIED, ADDR_IMM, OPR_BYTE}},
{0x05, "add", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0x06, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_ES, OPR_UNSPECIFIED}},
{0x07, "pop", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_ES, OPR_UNSPECIFIED}},
{0x08, "or", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_MODRM_GREG, OPR_BYTE}},
{0x09, "or", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_MODRM_GREG, OPR_WORD_DWORD}},
{0x0a, "or", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_BYTE, ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x0b, "or", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}},
{0x0c, "or", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AL, OPR_UNSPECIFIED, ADDR_IMM, OPR_BYTE}},
{0x0d, "or", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0x0e, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_CS, OPR_UNSPECIFIED}},
{0x10, "adc", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_MODRM_GREG, OPR_BYTE}},
{0x11, "adc", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_MODRM_GREG, OPR_WORD_DWORD}},
{0x12, "adc", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_BYTE, ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x13, "adc", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}},
{0x14, "adc", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AL, OPR_UNSPECIFIED, ADDR_IMM, OPR_BYTE}},
{0x15, "adc", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0x16, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_SS, OPR_UNSPECIFIED}},
{0x17, "pop", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_SS, OPR_UNSPECIFIED}},
{0x18, "sbb", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_MODRM_GREG, OPR_BYTE}},
{0x19, "sbb", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_MODRM_GREG, OPR_WORD_DWORD}},
{0x1a, "sbb", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_BYTE, ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x1b, "sbb", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}},
{0x1c, "sbb", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AL, OPR_UNSPECIFIED, ADDR_IMM, OPR_BYTE}},
{0x1d, "sbb", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0x1e, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_DS, OPR_UNSPECIFIED}},
{0x1f, "pop", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_DS, OPR_UNSPECIFIED}},
{0x20, "and", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_MODRM_GREG, OPR_BYTE}},
{0x21, "and", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_MODRM_GREG, OPR_WORD_DWORD}},
{0x22, "and", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_BYTE, ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x23, "and", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}},
{0x24, "and", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AL, OPR_UNSPECIFIED, ADDR_IMM, OPR_BYTE}},
{0x25, "and", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0x27, "daa", 0, BIT_WIDTH_UNSPECIFIED},
{0x28, "sub", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_MODRM_GREG, OPR_BYTE}},
{0x29, "sub", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_MODRM_GREG, OPR_WORD_DWORD}},
{0x2a, "sub", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_BYTE, ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x2b, "sub", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}},
{0x2c, "sub", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AL, OPR_UNSPECIFIED, ADDR_IMM, OPR_BYTE}},
{0x2d, "sub", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0x2f, "das", 0, BIT_WIDTH_UNSPECIFIED},
{0x30, "xor", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_MODRM_GREG, OPR_BYTE}},
{0x31, "xor", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_MODRM_GREG, OPR_WORD_DWORD}},
{0x32, "xor", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_BYTE, ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x33, "xor", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}},
{0x34, "xor", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AL, OPR_UNSPECIFIED, ADDR_IMM, OPR_BYTE}},
{0x35, "xor", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0x37, "aaa", 0, BIT_WIDTH_UNSPECIFIED},
{0x38, "cmp", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_MODRM_GREG, OPR_BYTE}},
{0x39, "cmp", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_MODRM_GREG, OPR_WORD_DWORD}},
{0x3a, "cmp", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_BYTE, ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x3b, "cmp", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}},
{0x3c, "cmp", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AL, OPR_UNSPECIFIED, ADDR_IMM, OPR_BYTE}},
{0x3d, "cmp", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0x3f, "aas", 0, BIT_WIDTH_UNSPECIFIED},
{0x40, "inc", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD}},
{0x41, "inc", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_CX, OPR_WORD_DWORD}},
{0x42, "inc", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_DX, OPR_WORD_DWORD}},
{0x43, "inc", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_BX, OPR_WORD_DWORD}},
{0x44, "inc", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_SP, OPR_WORD_DWORD}},
{0x45, "inc", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_BP, OPR_WORD_DWORD}},
{0x46, "inc", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_SI, OPR_WORD_DWORD}},
{0x47, "inc", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_DI, OPR_WORD_DWORD}},
{0x48, "dec", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD}},
{0x49, "dec", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_CX, OPR_WORD_DWORD}},
{0x4a, "dec", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_DX, OPR_WORD_DWORD}},
{0x4b, "dec", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_BX, OPR_WORD_DWORD}},
{0x4c, "dec", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_SP, OPR_WORD_DWORD}},
{0x4d, "dec", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_BP, OPR_WORD_DWORD}},
{0x4e, "dec", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_SI, OPR_WORD_DWORD}},
{0x4f, "dec", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_DI, OPR_WORD_DWORD}},
{0x50, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD}},
{0x51, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_CX, OPR_WORD_DWORD}},
{0x52, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_DX, OPR_WORD_DWORD}},
{0x53, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_BX, OPR_WORD_DWORD}},
{0x54, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_SP, OPR_WORD_DWORD}},
{0x55, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_BP, OPR_WORD_DWORD}},
{0x56, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_SI, OPR_WORD_DWORD}},
{0x57, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_DI, OPR_WORD_DWORD}},
{0x58, "pop", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD}},
{0x59, "pop", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_CX, OPR_WORD_DWORD}},
{0x5a, "pop", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_DX, OPR_WORD_DWORD}},
{0x5b, "pop", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_BX, OPR_WORD_DWORD}},
{0x5c, "pop", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_SP, OPR_WORD_DWORD}},
{0x5d, "pop", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_BP, OPR_WORD_DWORD}},
{0x5e, "pop", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_SI, OPR_WORD_DWORD}},
{0x5f, "pop", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_DI, OPR_WORD_DWORD}},
{0x60, "pushaw", 0, BIT_WIDTH_16},
{0x60, "pusha", 0, BIT_WIDTH_UNSPECIFIED},
{0x60, "pushad", 0, BIT_WIDTH_32},
{0x61, "popaw", 0, BIT_WIDTH_16},
{0x61, "popa", 0, BIT_WIDTH_UNSPECIFIED},
{0x61, "popad", 0, BIT_WIDTH_32},
{0x63, "arpl", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD, ADDR_MODRM_GREG, OPR_WORD}},
{0x68, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_IMM, OPR_WORD_DWORD}},
{0x69, "imul", 3, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0x6a, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_IMM, OPR_BYTE}},
{0x6b, "imul", 3, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}},
{0x6c, "insb", 0, BIT_WIDTH_UNSPECIFIED},
{0x6d, "insw", 0, BIT_WIDTH_16},
{0x6d, "insd", 0, BIT_WIDTH_32},
{0x6e, "outsb", 0, BIT_WIDTH_UNSPECIFIED},
{0x6f, "outsw", 0, BIT_WIDTH_16},
{0x6f, "outsd", 0, BIT_WIDTH_32},
{0x70, "jo", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0x71, "jno", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0x72, "jb", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0x73, "jnb", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0x74, "jz", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0x75, "jnz", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0x76, "jbe", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0x77, "ja", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0x78, "js", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0x79, "jns", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0x7a, "jp", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0x7b, "jnp", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0x7c, "jl", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0x7d, "jnl", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0x7e, "jle", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0x7f, "jnle", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0x84, "test", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_MODRM_GREG, OPR_BYTE}},
{0x85, "test", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_MODRM_GREG, OPR_WORD_DWORD}},
{0x86, "xchg", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_MODRM_GREG, OPR_BYTE}},
{0x87, "xchg", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_MODRM_GREG, OPR_WORD_DWORD}},
{0x88, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_MODRM_GREG, OPR_BYTE}},
{0x89, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_MODRM_GREG, OPR_WORD_DWORD}},
{0x8a, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_BYTE, ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x8b, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}},
{0x8c, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD, ADDR_MODRM_SREG, OPR_WORD}},
{0x8d, "lea", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_MEM, OPR_WORD_DWORD}},
{0x8e, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_SREG, OPR_WORD, ADDR_MODRM_GPREG_MEM, OPR_WORD}},
{0x8f, "pop", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}},
{0x90, "nop", 0, BIT_WIDTH_UNSPECIFIED},
{0x91, "xchg", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_UNSPECIFIED, ADDR_CX, OPR_UNSPECIFIED}},
{0x92, "xchg", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_UNSPECIFIED, ADDR_DX, OPR_UNSPECIFIED}},
{0x93, "xchg", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_UNSPECIFIED, ADDR_BX, OPR_UNSPECIFIED}},
{0x94, "xchg", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_UNSPECIFIED, ADDR_SP, OPR_UNSPECIFIED}},
{0x95, "xchg", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_UNSPECIFIED, ADDR_BP, OPR_UNSPECIFIED}},
{0x96, "xchg", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_UNSPECIFIED, ADDR_SI, OPR_UNSPECIFIED}},
{0x97, "xchg", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_UNSPECIFIED, ADDR_DI, OPR_UNSPECIFIED}},
{0x98, "cbw", 0, BIT_WIDTH_16},
{0x98, "cwde", 0, BIT_WIDTH_32 | BIT_WIDTH_64},
{0x99, "cwd", 0, BIT_WIDTH_16},
{0x99, "cdq", 0, BIT_WIDTH_32 | BIT_WIDTH_64},
{0x9b, "wait", 0, BIT_WIDTH_UNSPECIFIED},
{0x9c, "pushfw", 0, BIT_WIDTH_16},
{0x9c, "pushf", 0, BIT_WIDTH_UNSPECIFIED},
{0x9c, "pushfd", 0, BIT_WIDTH_32},
{0x9d, "popfw", 0, BIT_WIDTH_16},
{0x9d, "popf", 0, BIT_WIDTH_UNSPECIFIED},
{0x9d, "popfd", 0, BIT_WIDTH_32},
{0x9e, "sahf", 0, BIT_WIDTH_UNSPECIFIED},
{0x9f, "lahf", 0, BIT_WIDTH_UNSPECIFIED},
{0xa0, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AL, OPR_BYTE, ADDR_DIRECT_OFFSET, OPR_BYTE}},
{0xa1, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD, ADDR_DIRECT_OFFSET, OPR_WORD_DWORD}},
{0xa2, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_DIRECT_OFFSET, OPR_BYTE, ADDR_AL, OPR_BYTE}},
{0xa3, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_DIRECT_OFFSET, OPR_WORD_DWORD, ADDR_AX, OPR_WORD_DWORD}},
{0xa4, "movsb", 0, BIT_WIDTH_UNSPECIFIED},
{0xa5, "movsw", 0, BIT_WIDTH_16},
{0xa5, "movsd", 0, BIT_WIDTH_32},
{0xa6, "cmpsb", 0, BIT_WIDTH_UNSPECIFIED},
{0xa7, "cmpsw", 0, BIT_WIDTH_16},
{0xa7, "cmpsd", 0, BIT_WIDTH_32},
{0xa8, "test", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AL, OPR_UNSPECIFIED, ADDR_IMM, OPR_BYTE}},
{0xa9, "test", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0xaa, "stosb", 0, BIT_WIDTH_UNSPECIFIED},
{0xab, "stosw", 0, BIT_WIDTH_16},
{0xab, "stosd", 0, BIT_WIDTH_32},
{0xac, "lodsb", 0, BIT_WIDTH_UNSPECIFIED},
{0xad, "lodsw", 0, BIT_WIDTH_16},
{0xad, "lodsd", 0, BIT_WIDTH_32},
{0xae, "scasb", 0, BIT_WIDTH_UNSPECIFIED},
{0xaf, "scasw", 0, BIT_WIDTH_16},
{0xaf, "scasd", 0, BIT_WIDTH_32},
{0xb0, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AL, OPR_BYTE, ADDR_IMM, OPR_BYTE}},
{0xb1, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_CL, OPR_BYTE, ADDR_IMM, OPR_BYTE}},
{0xb2, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_DL, OPR_BYTE, ADDR_IMM, OPR_BYTE}},
{0xb3, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_BL, OPR_BYTE, ADDR_IMM, OPR_BYTE}},
{0xb4, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AH, OPR_BYTE, ADDR_IMM, OPR_BYTE}},
{0xb5, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_CH, OPR_BYTE, ADDR_IMM, OPR_BYTE}},
{0xb6, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_DH, OPR_BYTE, ADDR_IMM, OPR_BYTE}},
{0xb7, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_BH, OPR_BYTE, ADDR_IMM, OPR_BYTE}},
{0xb8, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0xb9, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_CX, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0xba, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_DX, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0xbb, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_BX, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0xbc, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_SP, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0xbd, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_BP, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0xbe, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_SI, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0xbf, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_DI, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0xc2, "ret", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_IMM, OPR_WORD}},
{0xc3, "ret", 0, BIT_WIDTH_UNSPECIFIED},
{0xc6, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}},
{0xc7, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}},
{0xc8, "enter", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_IMM, OPR_WORD, ADDR_IMM, OPR_BYTE}},
{0xc9, "leave", 0, BIT_WIDTH_UNSPECIFIED},
{0xca, "retf", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_IMM, OPR_WORD}},
{0xcb, "retf", 0, BIT_WIDTH_UNSPECIFIED},
{0xcc, "int 3", 0, BIT_WIDTH_UNSPECIFIED},
{0xcd, "int", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_IMM, OPR_BYTE}},
{0xce, "into", 0, BIT_WIDTH_UNSPECIFIED},
{0xcf, "iretw", 0, BIT_WIDTH_16},
{0xcf, "iret", 0, BIT_WIDTH_UNSPECIFIED},
{0xcf, "iretd", 0, BIT_WIDTH_32},
{0xd4, "aam", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_IMM, OPR_BYTE}},
{0xd5, "aad", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_IMM, OPR_BYTE}},
{0xd6, "salc", 0, BIT_WIDTH_UNSPECIFIED},
{0xd7, "xlat", 0, BIT_WIDTH_UNSPECIFIED},
{0xe0, "loopnz", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0xe1, "loopz", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0xe2, "loop", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0xe3, "jcxz", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0xe4, "in", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AL, OPR_UNSPECIFIED, ADDR_IMM, OPR_BYTE}},
{0xe5, "in", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}},
{0xe6, "out", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_IMM, OPR_BYTE, ADDR_AL, OPR_UNSPECIFIED}},
{0xe7, "out", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_IMM, OPR_BYTE, ADDR_AX, OPR_WORD_DWORD}},
{0xe8, "call", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0xe9, "jmp", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0xeb, "jmp", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_BYTE}},
{0xec, "in", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AL, OPR_UNSPECIFIED, ADDR_DX, OPR_UNSPECIFIED}},
{0xed, "in", 2, BIT_WIDTH_16, {ADDR_AX, OPR_UNSPECIFIED, ADDR_DX, OPR_UNSPECIFIED}},
{0xed, "in", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD, ADDR_DX, OPR_UNSPECIFIED}},
{0xee, "out", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_DX, OPR_UNSPECIFIED, ADDR_AL, OPR_UNSPECIFIED}},
{0xef, "out", 2, BIT_WIDTH_16, {ADDR_DX, OPR_UNSPECIFIED, ADDR_AX, OPR_UNSPECIFIED}},
{0xef, "out", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_DX, OPR_WORD, ADDR_AX, OPR_WORD_DWORD}},
{0xf1, "int1", 0, BIT_WIDTH_UNSPECIFIED},
{0xf4, "hlt", 0, BIT_WIDTH_UNSPECIFIED},
{0xf5, "cmc", 0, BIT_WIDTH_UNSPECIFIED},
{0xf8, "clc", 0, BIT_WIDTH_UNSPECIFIED},
{0xf9, "stc", 0, BIT_WIDTH_UNSPECIFIED},
{0xfa, "cli", 0, BIT_WIDTH_UNSPECIFIED},
{0xfb, "sti", 0, BIT_WIDTH_UNSPECIFIED},
{0xfc, "cld", 0, BIT_WIDTH_UNSPECIFIED},
{0xfd, "std", 0, BIT_WIDTH_UNSPECIFIED},
{0, 0, 0, 0, 0}
};
Inst extended_insts[] = {
{0x02, "lar", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD, ADDR_MODRM_GPREG_MEM, OPR_WORD}},
{0x03, "lsl", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_WORD}},
{0x06, "clts", 0, BIT_WIDTH_UNSPECIFIED},
{0x20, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_MOD_GREG_ONLY, OPR_DWORD, ADDR_CONTROL_REG, OPR_DWORD}},
{0x21, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_MOD_GREG_ONLY, OPR_DWORD, ADDR_DEBUG_REG, OPR_DWORD}},
{0x22, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_CONTROL_REG, OPR_DWORD, ADDR_MODRM_MOD_GREG_ONLY, OPR_DWORD}},
{0x23, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_DEBUG_REG, OPR_DWORD, ADDR_MODRM_MOD_GREG_ONLY, OPR_DWORD}},
{0x24, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_MOD_GREG_ONLY, OPR_DWORD, ADDR_MODRM_TREG, OPR_DWORD}},
{0x26, "mov", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_TREG, OPR_DWORD, ADDR_MODRM_MOD_GREG_ONLY, OPR_DWORD}},
{0x80, "jo", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0x81, "jno", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0x82, "jb", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0x83, "jnb", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0x84, "jz", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0x85, "jnz", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0x86, "jbe", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0x87, "jnbe", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0x88, "js", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0x89, "jns", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0x8a, "jp", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0x8b, "jnp", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0x8c, "jl", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0x8d, "jnl", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0x8e, "jle", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0x8f, "jnle", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_RELATIVE, OPR_WORD_DWORD}},
{0x90, "seto", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x91, "setno", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x92, "setb", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x93, "setnb", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x94, "setz", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x95, "setnz", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x96, "setbe", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x97, "setnbe", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x98, "sets", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x99, "setns", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x9a, "setp", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x9b, "setnp", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x9c, "setl", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x9d, "setnl", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x9e, "setle", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0x9f, "setnle", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0xa0, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_FS, OPR_WORD_DWORD}},
{0xa1, "pop", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_FS, OPR_WORD_DWORD}},
{0xa8, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_GS, OPR_WORD_DWORD}},
{0xa9, "pop", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_GS, OPR_WORD_DWORD}},
{0xaf, "imul", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}},
{0xb6, "movzx", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0xb7, "movzx", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_WORD}},
{0xbe, "movsx", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_BYTE}},
{0xbf, "movsx", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GREG, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_WORD}},
{0, 0, 0, 0, 0}
};
ExtendedGroupInst extended_group_insts[] = {
{0x80, "add", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 0},
{0x80, "or", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 1},
{0x80, "adc", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 2},
{0x80, "sbb", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 3},
{0x80, "and", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 4},
{0x80, "sub", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 5},
{0x80, "xor", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 6},
{0x80, "cmp", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 7},
{0x81, "add", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}, 0},
{0x81, "or", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}, 1},
{0x81, "adc", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}, 2},
{0x81, "sbb", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}, 3},
{0x81, "and", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}, 4},
{0x81, "sub", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}, 5},
{0x81, "xor", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}, 6},
{0x81, "cmp", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}, 7},
{0x82, "add", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 0},
{0x82, "or", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 1},
{0x82, "adc", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 2},
{0x82, "sbb", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 3},
{0x82, "and", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 4},
{0x82, "sub", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 5},
{0x82, "xor", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 6},
{0x82, "cmp", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 7},
{0x83, "add", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}, 0},
{0x83, "or", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}, 1},
{0x83, "adc", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}, 2},
{0x83, "sbb", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}, 3},
{0x83, "and", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}, 4},
{0x83, "sub", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}, 5},
{0x83, "xor", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}, 6},
{0x83, "cmp", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}, 7},
{0xc0, "rol", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 0},
{0xc0, "ror", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 1},
{0xc0, "rcl", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 2},
{0xc0, "rcr", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 3},
{0xc0, "shl", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 4},
{0xc0, "shr", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 5},
{0xc0, "sal", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 6},
{0xc0, "sar", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 7},
{0xc1, "rol", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}, 0},
{0xc1, "ror", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}, 1},
{0xc1, "rcl", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}, 2},
{0xc1, "rcr", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}, 3},
{0xc1, "shl", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}, 4},
{0xc1, "shr", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}, 5},
{0xc1, "sal", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}, 6},
{0xc1, "sar", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_BYTE}, 7},
{0xd0, "rol", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_1, OPR_BYTE}, 0},
{0xd0, "ror", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_1, OPR_BYTE}, 1},
{0xd0, "rcl", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_1, OPR_BYTE}, 2},
{0xd0, "rcr", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_1, OPR_BYTE}, 3},
{0xd0, "shl", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_1, OPR_BYTE}, 4},
{0xd0, "shr", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_1, OPR_BYTE}, 5},
{0xd0, "sal", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_1, OPR_BYTE}, 6},
{0xd0, "sar", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_1, OPR_BYTE}, 7},
{0xd1, "rol", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_1, OPR_BYTE}, 0},
{0xd1, "ror", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_1, OPR_BYTE}, 1},
{0xd1, "rcl", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_1, OPR_BYTE}, 2},
{0xd1, "rcr", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_1, OPR_BYTE}, 3},
{0xd1, "shl", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_1, OPR_BYTE}, 4},
{0xd1, "shr", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_1, OPR_BYTE}, 5},
{0xd1, "sal", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_1, OPR_BYTE}, 6},
{0xd1, "sar", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_1, OPR_BYTE}, 7},
{0xd2, "rol", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_CL, OPR_BYTE}, 0},
{0xd2, "ror", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_CL, OPR_BYTE}, 1},
{0xd2, "rcl", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_CL, OPR_BYTE}, 2},
{0xd2, "rcr", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_CL, OPR_BYTE}, 3},
{0xd2, "shl", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_CL, OPR_BYTE}, 4},
{0xd2, "shr", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_CL, OPR_BYTE}, 5},
{0xd2, "sal", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_CL, OPR_BYTE}, 6},
{0xd2, "sar", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_CL, OPR_BYTE}, 7},
{0xd3, "rol", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_CL, OPR_BYTE}, 0},
{0xd3, "ror", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_CL, OPR_BYTE}, 1},
{0xd3, "rcl", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_CL, OPR_BYTE}, 2},
{0xd3, "rcr", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_CL, OPR_BYTE}, 3},
{0xd3, "shl", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_CL, OPR_BYTE}, 4},
{0xd3, "shr", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_CL, OPR_BYTE}, 5},
{0xd3, "sal", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_CL, OPR_BYTE}, 6},
{0xd3, "sar", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_CL, OPR_BYTE}, 7},
{0xf6, "test", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 0},
{0xf6, "test", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE, ADDR_IMM, OPR_BYTE}, 1},
{0xf6, "not", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}, 2},
{0xf6, "neg", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}, 3},
{0xf6, "mul", 3, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD, ADDR_AL, OPR_BYTE, ADDR_MODRM_GPREG_MEM, OPR_BYTE}, 4},
{0xf6, "imul", 3, BIT_WIDTH_UNSPECIFIED, {ADDR_AX, OPR_WORD_DWORD, ADDR_AL, OPR_BYTE, ADDR_MODRM_GPREG_MEM, OPR_BYTE}, 5},
{0xf6, "div", 4, BIT_WIDTH_UNSPECIFIED, {ADDR_AL, OPR_BYTE, ADDR_AH, OPR_BYTE, ADDR_AX, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_BYTE}, 6},
{0xf6, "idiv", 4, BIT_WIDTH_UNSPECIFIED, {ADDR_AL, OPR_BYTE, ADDR_AH, OPR_BYTE, ADDR_AX, OPR_WORD_DWORD, ADDR_MODRM_GPREG_MEM, OPR_BYTE}, 7},
{0xf7, "test", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}, 0},
{0xf7, "test", 2, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD, ADDR_IMM, OPR_WORD_DWORD}, 1},
{0xf7, "not", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}, 2},
{0xf7, "neg", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}, 3},
{0xf7, "mul", 3, BIT_WIDTH_UNSPECIFIED, {ADDR_DX, OPR_UNSPECIFIED, ADDR_AX, OPR_UNSPECIFIED, ADDR_MODRM_GPREG_MEM, OPR_BYTE}, 4},
{0xf7, "imul", 3, BIT_WIDTH_UNSPECIFIED, {ADDR_DX, OPR_UNSPECIFIED, ADDR_AX, OPR_UNSPECIFIED, ADDR_MODRM_GPREG_MEM, OPR_BYTE}, 5},
{0xf7, "div", 3, BIT_WIDTH_UNSPECIFIED, {ADDR_DX, OPR_UNSPECIFIED, ADDR_AX, OPR_UNSPECIFIED, ADDR_MODRM_GPREG_MEM, OPR_BYTE}, 6},
{0xf7, "idiv", 3, BIT_WIDTH_UNSPECIFIED, {ADDR_DX, OPR_UNSPECIFIED, ADDR_AX, OPR_UNSPECIFIED, ADDR_MODRM_GPREG_MEM, OPR_BYTE}, 7},
{0xfe, "inc", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}, 0},
{0xfe, "dec", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_BYTE}, 1},
{0xff, "inc", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}, 0},
{0xff, "dec", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}, 1},
{0xff, "call", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}, 2},
//{0xff, "callf", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}, 3},
{0xff, "jmp", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}, 4},
//{0xff, "jmpf", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}, 5},
{0xff, "push", 1, BIT_WIDTH_UNSPECIFIED, {ADDR_MODRM_GPREG_MEM, OPR_WORD_DWORD}, 6},
{0, 0, 0, 0, 0}
};
int standard_insts_len = sizeof(standard_insts) / sizeof(standard_insts[0]);
int extended_insts_len = sizeof(extended_insts) / sizeof(extended_insts[0]);
int extended_group_insts_len = sizeof(extended_group_insts) / sizeof(extended_group_insts[0]);
const char *regname[] = {
"al", "cl", "dl", "bl", "ah", "ch", "dh", "bh", // 8-bit general registers
"ax", "cx", "dx", "bx", // 16-bit general registers
"sp", "bp", "si", "di", // 16-bit pointer/index registers
"eax", "ecx", "edx", "ebx", // 32-bit general registers
"esp", "ebp", "esi", "edi", // 32-bit pointer/index registers
"es", "cs", "ss", "ds", "fs", "gs", // segment registers
"cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", // control registers
"dr0", "dr1", "dr2", "dr3", "dr4", "dr5", "dr6", "dr7", // debug registers
"tr0", "tr1", "tr2", "tr3", "tr4", "tr5", "tr6", "tr7", // test registers
};