-
Notifications
You must be signed in to change notification settings - Fork 7
/
x86_opcode_names.c
268 lines (266 loc) · 4.99 KB
/
x86_opcode_names.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
/*
* Copyright (C) 2024 Stefano Moioli <smxdev4@gmail.com>
**/
#include "xzre.h"
/**
Source: https://github.com/torvalds/linux/blob/690ca3a3067f760bef92ca5db1c42490498ab5de/arch/x86/lib/x86-opcode-map.txt
*/
const char *X86_OPCODE_NAMES[] = {
"ADD Eb,Gb",
"ADD Ev,Gv",
"ADD Gb,Eb",
"ADD Gv,Ev",
"ADD AL,Ib",
"ADD rAX,Iz",
"PUSH ES (i64)",
"POP ES (i64)",
"OR Eb,Gb",
"OR Ev,Gv",
"OR Gb,Eb",
"OR Gv,Ev",
"OR AL,Ib",
"OR rAX,Iz",
"PUSH CS (i64)",
"escape", // 2-byte escape
"ADC Eb,Gb",
"ADC Ev,Gv",
"ADC Gb,Eb",
"ADC Gv,Ev",
"ADC AL,Ib",
"ADC rAX,Iz",
"PUSH SS (i64)",
"POP SS (i64)",
"SBB Eb,Gb",
"SBB Ev,Gv",
"SBB Gb,Eb",
"SBB Gv,Ev",
"SBB AL,Ib",
"SBB rAX,Iz",
"PUSH DS (i64)",
"POP DS (i64)",
"AND Eb,Gb",
"AND Ev,Gv",
"AND Gb,Eb",
"AND Gv,Ev",
"AND AL,Ib",
"AND rAx,Iz",
"SEG=ES (Prefix)",
"DAA (i64)",
"SUB Eb,Gb",
"SUB Ev,Gv",
"SUB Gb,Eb",
"SUB Gv,Ev",
"SUB AL,Ib",
"SUB rAX,Iz",
"SEG=CS (Prefix)",
"DAS (i64)",
"XOR Eb,Gb",
"XOR Ev,Gv",
"XOR Gb,Eb",
"XOR Gv,Ev",
"XOR AL,Ib",
"XOR rAX,Iz",
"SEG=SS (Prefix)",
"AAA (i64)",
"CMP Eb,Gb",
"CMP Ev,Gv",
"CMP Gb,Eb",
"CMP Gv,Ev",
"CMP AL,Ib",
"CMP rAX,Iz",
"SEG=DS (Prefix)",
"AAS (i64)",
"INC eAX (i64) | REX (o64)",
"INC eCX (i64) | REX.B (o64)",
"INC eDX (i64) | REX.X (o64)",
"INC eBX (i64) | REX.XB (o64)",
"INC eSP (i64) | REX.R (o64)",
"INC eBP (i64) | REX.RB (o64)",
"INC eSI (i64) | REX.RX (o64)",
"INC eDI (i64) | REX.RXB (o64)",
"DEC eAX (i64) | REX.W (o64)",
"DEC eCX (i64) | REX.WB (o64)",
"DEC eDX (i64) | REX.WX (o64)",
"DEC eBX (i64) | REX.WXB (o64)",
"DEC eSP (i64) | REX.WR (o64)",
"DEC eBP (i64) | REX.WRB (o64)",
"DEC eSI (i64) | REX.WRX (o64)",
"DEC eDI (i64) | REX.WRXB (o64)",
"PUSH rAX/r8 (d64)",
"PUSH rCX/r9 (d64)",
"PUSH rDX/r10 (d64)",
"PUSH rBX/r11 (d64)",
"PUSH rSP/r12 (d64)",
"PUSH rBP/r13 (d64)",
"PUSH rSI/r14 (d64)",
"PUSH rDI/r15 (d64)",
"POP rAX/r8 (d64)",
"POP rCX/r9 (d64)",
"POP rDX/r10 (d64)",
"POP rBX/r11 (d64)",
"POP rSP/r12 (d64)",
"POP rBP/r13 (d64)",
"POP rSI/r14 (d64)",
"POP rDI/r15 (d64)",
"PUSHA/PUSHAD (i64)",
"POPA/POPAD (i64)",
"BOUND Gv,Ma (i64) | EVEX (Prefix)",
"ARPL Ew,Gw (i64) | MOVSXD Gv,Ev (o64)",
"SEG=FS (Prefix)",
"SEG=GS (Prefix)",
"Operand-Size (Prefix)",
"Address-Size (Prefix)",
"PUSH Iz",
"IMUL Gv,Ev,Iz",
"PUSH Ib (d64)",
"IMUL Gv,Ev,Ib",
"INS/INSB Yb,DX",
"INS/INSW/INSD Yz,DX",
"OUTS/OUTSB DX,Xb",
"OUTS/OUTSW/OUTSD DX,Xz",
"JO Jb (!REX2)",
"JNO Jb (!REX2)",
"JB/JNAE/JC Jb (!REX2)",
"JNB/JAE/JNC Jb (!REX2)",
"JZ/JE Jb (!REX2)",
"JNZ/JNE Jb (!REX2)",
"JBE/JNA Jb (!REX2)",
"JNBE/JA Jb (!REX2)",
"JS Jb (!REX2)",
"JNS Jb (!REX2)",
"JP/JPE Jb (!REX2)",
"JNP/JPO Jb (!REX2)",
"JL/JNGE Jb (!REX2)",
"JNL/JGE Jb (!REX2)",
"JLE/JNG Jb (!REX2)",
"JNLE/JG Jb (!REX2)",
"Grp1 Eb,Ib (1A)",
"Grp1 Ev,Iz (1A)",
"Grp1 Eb,Ib (1A),(i64)",
"Grp1 Ev,Ib (1A)",
"TEST Eb,Gb",
"TEST Ev,Gv",
"XCHG Eb,Gb",
"XCHG Ev,Gv",
"MOV Eb,Gb",
"MOV Ev,Gv",
"MOV Gb,Eb",
"MOV Gv,Ev",
"MOV Ev,Sw",
"LEA Gv,M",
"MOV Sw,Ew",
"Grp1A (1A) | POP Ev (d64)",
"NOP | PAUSE (F3) | XCHG r8,rAX",
"XCHG rCX/r9,rAX",
"XCHG rDX/r10,rAX",
"XCHG rBX/r11,rAX",
"XCHG rSP/r12,rAX",
"XCHG rBP/r13,rAX",
"XCHG rSI/r14,rAX",
"XCHG rDI/r15,rAX",
"CBW/CWDE/CDQE",
"CWD/CDQ/CQO",
"CALLF Ap (i64)",
"FWAIT/WAIT",
"PUSHF/D/Q Fv (d64)",
"POPF/D/Q Fv (d64)",
"SAHF",
"LAHF",
"MOV AL,Ob (!REX2)",
"MOV rAX,Ov (!REX2) | JMPABS O (REX2),(o64)",
"MOV Ob,AL (!REX2)",
"MOV Ov,rAX (!REX2)",
"MOVS/B Yb,Xb (!REX2)",
"MOVS/W/D/Q Yv,Xv (!REX2)",
"CMPS/B Xb,Yb (!REX2)",
"CMPS/W/D Xv,Yv (!REX2)",
"TEST AL,Ib (!REX2)",
"TEST rAX,Iz (!REX2)",
"STOS/B Yb,AL (!REX2)",
"STOS/W/D/Q Yv,rAX (!REX2)",
"LODS/B AL,Xb (!REX2)",
"LODS/W/D/Q rAX,Xv (!REX2)",
"SCAS/B AL,Yb (!REX2)",
"SCAS/W/D/Q rAX,Yv (!REX2)",
"MOV AL/R8L,Ib",
"MOV CL/R9L,Ib",
"MOV DL/R10L,Ib",
"MOV BL/R11L,Ib",
"MOV AH/R12L,Ib",
"MOV CH/R13L,Ib",
"MOV DH/R14L,Ib",
"MOV BH/R15L,Ib",
"MOV rAX/r8,Iv",
"MOV rCX/r9,Iv",
"MOV rDX/r10,Iv",
"MOV rBX/r11,Iv",
"MOV rSP/r12,Iv",
"MOV rBP/r13,Iv",
"MOV rSI/r14,Iv",
"MOV rDI/r15,Iv",
"Grp2 Eb,Ib (1A)",
"Grp2 Ev,Ib (1A)",
"RETN Iw (f64)",
"RETN",
"LES Gz,Mp (i64) | VEX+2byte (Prefix)",
"LDS Gz,Mp (i64) | VEX+1byte (Prefix)",
"Grp11A Eb,Ib (1A)",
"Grp11B Ev,Iz (1A)",
"ENTER Iw,Ib",
"LEAVE (d64)",
"RETF Iw",
"RETF",
"INT3",
"INT Ib",
"INTO (i64)",
"IRET/D/Q",
"Grp2 Eb,1 (1A)",
"Grp2 Ev,1 (1A)",
"Grp2 Eb,CL (1A)",
"Grp2 Ev,CL (1A)",
"AAM Ib (i64)",
"AAD Ib (i64) | REX2 (Prefix),(o64)",
"",
"XLAT/XLATB",
"ESC",
"ESC",
"ESC",
"ESC",
"ESC",
"ESC",
"ESC",
"ESC",
"LOOPNE/LOOPNZ Jb (f64) (!REX2)",
"LOOPE/LOOPZ Jb (f64) (!REX2)",
"LOOP Jb (f64) (!REX2)",
"JrCXZ Jb (f64) (!REX2)",
"IN AL,Ib (!REX2)",
"IN eAX,Ib (!REX2)",
"OUT Ib,AL (!REX2)",
"OUT Ib,eAX (!REX2)",
"CALL Jz (f64) (!REX2)",
"JMP-near Jz (f64) (!REX2)",
"JMP-far Ap (i64) (!REX2)",
"JMP-short Jb (f64) (!REX2)",
"IN AL,DX (!REX2)",
"IN eAX,DX (!REX2)",
"OUT DX,AL (!REX2)",
"OUT DX,eAX (!REX2)",
"LOCK (Prefix)",
"",
"REPNE (Prefix) | XACQUIRE (Prefix)",
"REP/REPE (Prefix) | XRELEASE (Prefix)",
"HLT",
"CMC",
"Grp3_1 Eb (1A)",
"Grp3_2 Ev (1A)",
"CLC",
"STC",
"CLI",
"STI",
"CLD",
"STD",
"Grp4 (1A)",
"Grp5 (1A)"
};
const int X86_OPCODE_NAMES_COUNT = ARRAY_SIZE(X86_OPCODE_NAMES);