5 * The contents of this file are subject to the terms of the
6 * Common Development and Distribution License (the "License").
7 * You may not use this file except in compliance with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
24 * Copyright (c) 2015, Joyent, Inc.
25 * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
29 * Copyright (c) 2010, Intel Corporation.
30 * All rights reserved.
33 /* Copyright (c) 1988 AT&T */
34 /* All Rights Reserved */
37 * APPLE NOTE: There is a copy of this file in userspace in
38 * dtrace:/disassembler/dis_tables.c
40 * It needs to be in sync with this file.
43 #include <sys/dtrace.h>
44 #include <sys/dtrace_glue.h>
45 #include <sys/dis_tables.h>
50 * Disassembly begins in dis_distable, which is equivalent to the One-byte
51 * Opcode Map in the Intel IA32 ISA Reference (page A-6 in my copy). The
52 * decoding loops then traverse out through the other tables as necessary to
53 * decode a given instruction.
55 * The behavior of this file can be controlled by one of the following flags:
57 * DIS_TEXT Include text for disassembly
58 * DIS_MEM Include memory-size calculations
60 * Either or both of these can be defined.
62 * This file is not, and will never be, cstyled. If anything, the tables should
63 * be taken out another tab stop or two so nothing overlaps.
67 * These functions must be provided for the consumer to do disassembly.
70 extern char *strncpy(char *, const char *, size_t);
71 extern size_t strlen(const char *);
72 extern int strcmp(const char *, const char *);
73 extern int strncmp(const char *, const char *, size_t);
74 extern size_t strlcat(char *, const char *, size_t);
78 #define TERM 0 /* used to indicate that the 'indirect' */
79 /* field terminates - no pointer. */
81 /* Used to decode instructions. */
82 typedef struct instable
{
83 struct instable
*it_indirect
; /* for decode op codes */
87 uint_t it_suffix
:1; /* mnem + "w", "l", or "d" */
92 uint_t it_invalid64
:1; /* opcode invalid in amd64 */
93 uint_t it_always64
:1; /* 64 bit when in 64 bit mode */
94 uint_t it_invalid32
:1; /* invalid in IA32 */
95 uint_t it_stackop
:1; /* push/pop stack operation */
96 uint_t it_vexwoxmm
:1; /* VEX instructions that don't use XMM/YMM */
97 uint_t it_avxsuf
:1; /* AVX suffix required */
101 * Instruction formats.
115 M
, /* register or memory */
116 MG9
, /* register or memory in group 9 (prefix optional) */
117 Mb
, /* register or memory, always byte sized */
118 MO
, /* memory only (no registers) */
127 RM_66r
, /* RM, but with a required 0x66 prefix */
140 DSHIFT
, /* for double shift that has an 8-bit immediate */
143 NORM
, /* instructions w/o ModR/M byte, no memory access */
144 IMPLMEM
, /* instructions w/o ModR/M byte, implicit mem access */
146 JTAB
, /* jump table */
147 IMUL
, /* for 186 iimul instr */
148 CBW
, /* so data16 can be evaluated for cbw and variants */
149 MvI
, /* for 186 logicals */
150 ENTER
, /* for 186 enter instr */
151 RMw
, /* for 286 arpl instr */
152 Ib
, /* for push immediate byte */
153 F
, /* for 287 instructions */
154 FF
, /* for 287 instructions */
155 FFC
, /* for 287 instructions */
156 DM
, /* 16-bit data */
157 AM
, /* 16-bit addr */
158 LSEG
, /* for 3-bit seg reg encoding */
159 MIb
, /* for 386 logicals */
160 SREG
, /* for 386 special registers */
161 PREFIX
, /* a REP instruction prefix */
162 LOCK
, /* a LOCK instruction prefix */
163 INT3
, /* The int 3 instruction, which has a fake operand */
164 INTx
, /* The normal int instruction, with explicit int num */
165 DSHIFTcl
, /* for double shift that implicitly uses %cl */
166 CWD
, /* so data16 can be evaluated for cwd and variants */
167 RET
, /* single immediate 16-bit operand */
168 MOVZ
, /* for movs and movz, with different size operands */
169 CRC32
, /* for crc32, with different size operands */
170 XADDB
, /* for xaddb */
171 MOVSXZ
, /* AMD64 mov sign extend 32 to 64 bit instruction */
172 MOVBE
, /* movbe instruction */
175 * MMX/SIMD addressing modes.
178 MMO
, /* Prefixable MMX/SIMD-Int mm/mem -> mm */
179 MMOIMPL
, /* Prefixable MMX/SIMD-Int mm -> mm (mem) */
180 MMO3P
, /* Prefixable MMX/SIMD-Int mm -> r32,imm8 */
181 MMOM3
, /* Prefixable MMX/SIMD-Int mm -> r32 */
182 MMOS
, /* Prefixable MMX/SIMD-Int mm -> mm/mem */
183 MMOMS
, /* Prefixable MMX/SIMD-Int mm -> mem */
184 MMOPM
, /* MMX/SIMD-Int mm/mem -> mm,imm8 */
185 MMOPM_66o
, /* MMX/SIMD-Int 0x66 optional mm/mem -> mm,imm8 */
186 MMOPRM
, /* Prefixable MMX/SIMD-Int r32/mem -> mm,imm8 */
187 MMOSH
, /* Prefixable MMX mm,imm8 */
188 MM
, /* MMX/SIMD-Int mm/mem -> mm */
189 MMS
, /* MMX/SIMD-Int mm -> mm/mem */
190 MMSH
, /* MMX mm,imm8 */
191 XMMO
, /* Prefixable SIMD xmm/mem -> xmm */
192 XMMOS
, /* Prefixable SIMD xmm -> xmm/mem */
193 XMMOPM
, /* Prefixable SIMD xmm/mem w/to xmm,imm8 */
194 XMMOMX
, /* Prefixable SIMD mm/mem -> xmm */
195 XMMOX3
, /* Prefixable SIMD xmm -> r32 */
196 XMMOXMM
, /* Prefixable SIMD xmm/mem -> mm */
197 XMMOM
, /* Prefixable SIMD xmm -> mem */
198 XMMOMS
, /* Prefixable SIMD mem -> xmm */
199 XMM
, /* SIMD xmm/mem -> xmm */
200 XMM_66r
, /* SIMD 0x66 prefix required xmm/mem -> xmm */
201 XMM_66o
, /* SIMD 0x66 prefix optional xmm/mem -> xmm */
202 XMMXIMPL
, /* SIMD xmm -> xmm (mem) */
203 XMM3P
, /* SIMD xmm -> r32,imm8 */
204 XMM3PM_66r
, /* SIMD 0x66 prefix required xmm -> r32/mem,imm8 */
205 XMMP
, /* SIMD xmm/mem w/to xmm,imm8 */
206 XMMP_66o
, /* SIMD 0x66 prefix optional xmm/mem w/to xmm,imm8 */
207 XMMP_66r
, /* SIMD 0x66 prefix required xmm/mem w/to xmm,imm8 */
208 XMMPRM
, /* SIMD r32/mem -> xmm,imm8 */
209 XMMPRM_66r
, /* SIMD 0x66 prefix required r32/mem -> xmm,imm8 */
210 XMMS
, /* SIMD xmm -> xmm/mem */
211 XMMM
, /* SIMD mem -> xmm */
212 XMMM_66r
, /* SIMD 0x66 prefix required mem -> xmm */
213 XMMMS
, /* SIMD xmm -> mem */
214 XMM3MX
, /* SIMD r32/mem -> xmm */
215 XMM3MXS
, /* SIMD xmm -> r32/mem */
216 XMMSH
, /* SIMD xmm,imm8 */
217 XMMXM3
, /* SIMD xmm/mem -> r32 */
218 XMMX3
, /* SIMD xmm -> r32 */
219 XMMXMM
, /* SIMD xmm/mem -> mm */
220 XMMMX
, /* SIMD mm -> xmm */
221 XMMXM
, /* SIMD xmm -> mm */
222 XMMX2I
, /* SIMD xmm -> xmm, imm, imm */
223 XMM2I
, /* SIMD xmm, imm, imm */
224 XMMFENCE
, /* SIMD lfence or mfence */
225 XMMSFNC
, /* SIMD sfence (none or mem) */
227 VEX_NONE
, /* VEX no operand */
228 VEX_MO
, /* VEX mod_rm -> implicit reg */
229 VEX_RMrX
, /* VEX VEX.vvvv, mod_rm -> mod_reg */
230 VEX_VRMrX
, /* VEX mod_rm, VEX.vvvv -> mod_rm */
231 VEX_RRX
, /* VEX VEX.vvvv, mod_reg -> mod_rm */
232 VEX_RMRX
, /* VEX VEX.vvvv, mod_rm, imm8[7:4] -> mod_reg */
233 VEX_MX
, /* VEX mod_rm -> mod_reg */
234 VEX_MXI
, /* VEX mod_rm, imm8 -> mod_reg */
235 VEX_XXI
, /* VEX mod_rm, imm8 -> VEX.vvvv */
236 VEX_MR
, /* VEX mod_rm -> mod_reg */
237 VEX_RRI
, /* VEX mod_reg, mod_rm -> implicit(eflags/r32) */
238 VEX_RX
, /* VEX mod_reg -> mod_rm */
239 VEX_RR
, /* VEX mod_rm -> mod_reg */
240 VEX_RRi
, /* VEX mod_rm, imm8 -> mod_reg */
241 VEX_RM
, /* VEX mod_reg -> mod_rm */
242 VEX_RIM
, /* VEX mod_reg, imm8 -> mod_rm */
243 VEX_RRM
, /* VEX VEX.vvvv, mod_reg -> mod_rm */
244 VEX_RMX
, /* VEX VEX.vvvv, mod_rm -> mod_reg */
245 VEX_SbVM
, /* VEX SIB, VEX.vvvv -> mod_rm */
246 VMx
, /* vmcall/vmlaunch/vmresume/vmxoff */
247 VMxo
, /* VMx instruction with optional prefix */
248 SVM
, /* AMD SVM instructions */
249 BLS
, /* BLSR, BLSMSK, BLSI */
250 FMA
, /* FMA instructions, all VEX_RMrX */
251 ADX
/* ADX instructions, support REX.w, mod_rm->mod_reg */
257 #define VEX_2bytes 0xC5 /* the first byte of two-byte form */
258 #define VEX_3bytes 0xC4 /* the first byte of three-byte form */
260 #define FILL 0x90 /* Fill byte used for alignment (nop) */
263 ** Register numbers for the i386
275 * modes for immediate values
278 #define MODE_IPREL 1 /* signed IP relative value */
279 #define MODE_SIGNED 2 /* sign extended immediate */
280 #define MODE_IMPLIED 3 /* constant value implied from opcode */
281 #define MODE_OFFSET 4 /* offset part of an address */
282 #define MODE_RIPREL 5 /* like IPREL, but from %rip (amd64) */
285 * The letters used in these macros are:
286 * IND - indirect to another to another table
287 * "T" - means to Terminate indirections (this is the final opcode)
288 * "S" - means "operand length suffix required"
289 * "Sa" - means AVX2 suffix (d/q) required
290 * "NS" - means "no suffix" which is the operand length suffix of the opcode
291 * "Z" - means instruction size arg required
292 * "u" - means the opcode is invalid in IA32 but valid in amd64
293 * "x" - means the opcode is invalid in amd64, but not IA32
294 * "y" - means the operand size is always 64 bits in 64 bit mode
295 * "p" - means push/pop stack operation
296 * "vr" - means VEX instruction that operates on normal registers, not fpu
299 #if defined(DIS_TEXT) && defined(DIS_MEM)
300 #define IND(table) {(instable_t *)table, 0, "", 0, 0, 0, 0, 0, 0, 0, 0}
301 #define INDx(table) {(instable_t *)table, 0, "", 0, 0, 1, 0, 0, 0, 0, 0}
302 #define TNS(name, amode) {TERM, amode, name, 0, 0, 0, 0, 0, 0, 0, 0}
303 #define TNSu(name, amode) {TERM, amode, name, 0, 0, 0, 0, 1, 0, 0, 0}
304 #define TNSx(name, amode) {TERM, amode, name, 0, 0, 1, 0, 0, 0, 0, 0}
305 #define TNSy(name, amode) {TERM, amode, name, 0, 0, 0, 1, 0, 0, 0, 0}
306 #define TNSyp(name, amode) {TERM, amode, name, 0, 0, 0, 1, 0, 1, 0, 0}
307 #define TNSZ(name, amode, sz) {TERM, amode, name, 0, sz, 0, 0, 0, 0, 0, 0}
308 #define TNSZy(name, amode, sz) {TERM, amode, name, 0, sz, 0, 1, 0, 0, 0, 0}
309 #define TNSZvr(name, amode, sz) {TERM, amode, name, 0, sz, 0, 0, 0, 0, 1, 0}
310 #define TS(name, amode) {TERM, amode, name, 1, 0, 0, 0, 0, 0, 0, 0}
311 #define TSx(name, amode) {TERM, amode, name, 1, 0, 1, 0, 0, 0, 0, 0}
312 #define TSy(name, amode) {TERM, amode, name, 1, 0, 0, 1, 0, 0, 0, 0}
313 #define TSp(name, amode) {TERM, amode, name, 1, 0, 0, 0, 0, 1, 0, 0}
314 #define TSZ(name, amode, sz) {TERM, amode, name, 1, sz, 0, 0, 0, 0, 0, 0}
315 #define TSaZ(name, amode, sz) {TERM, amode, name, 1, sz, 0, 0, 0, 0, 0, 1}
316 #define TSZx(name, amode, sz) {TERM, amode, name, 1, sz, 1, 0, 0, 0, 0, 0}
317 #define TSZy(name, amode, sz) {TERM, amode, name, 1, sz, 0, 1, 0, 0, 0, 0}
318 #define INVALID {TERM, UNKNOWN, "", 0, 0, 0, 0, 0, 0, 0, 0}
319 #elif defined(DIS_TEXT)
320 #define IND(table) {(instable_t *)table, 0, "", 0, 0, 0, 0, 0}
321 #define INDx(table) {(instable_t *)table, 0, "", 0, 1, 0, 0, 0}
322 #define TNS(name, amode) {TERM, amode, name, 0, 0, 0, 0, 0}
323 #define TNSu(name, amode) {TERM, amode, name, 0, 0, 0, 1, 0}
324 #define TNSx(name, amode) {TERM, amode, name, 0, 1, 0, 0, 0}
325 #define TNSy(name, amode) {TERM, amode, name, 0, 0, 1, 0, 0}
326 #define TNSyp(name, amode) {TERM, amode, name, 0, 0, 1, 0, 1}
327 #define TNSZ(name, amode, sz) {TERM, amode, name, 0, 0, 0, 0, 0}
328 #define TNSZy(name, amode, sz) {TERM, amode, name, 0, 0, 1, 0, 0}
329 #define TNSZvr(name, amode, sz) {TERM, amode, name, 0, 0, 0, 0, 0, 1}
330 #define TS(name, amode) {TERM, amode, name, 1, 0, 0, 0, 0}
331 #define TSx(name, amode) {TERM, amode, name, 1, 1, 0, 0, 0}
332 #define TSy(name, amode) {TERM, amode, name, 1, 0, 1, 0, 0}
333 #define TSp(name, amode) {TERM, amode, name, 1, 0, 0, 0, 1}
334 #define TSZ(name, amode, sz) {TERM, amode, name, 1, 0, 0, 0, 0}
335 #define TSaZ(name, amode, sz) {TERM, amode, name, 1, 0, 0, 0, 0, 0, 1}
336 #define TSZx(name, amode, sz) {TERM, amode, name, 1, 1, 0, 0, 0}
337 #define TSZy(name, amode, sz) {TERM, amode, name, 1, 0, 1, 0, 0}
338 #define INVALID {TERM, UNKNOWN, "", 0, 0, 0, 0, 0}
339 #elif defined(DIS_MEM)
340 #define IND(table) {(instable_t *)table, 0, 0, 0, 0, 0, 0}
341 #define INDx(table) {(instable_t *)table, 0, 0, 1, 0, 0, 0}
342 #define TNS(name, amode) {TERM, amode, 0, 0, 0, 0, 0, 0, 0}
343 #define TNSu(name, amode) {TERM, amode, 0, 0, 0, 1, 0, 0, 0}
344 #define TNSy(name, amode) {TERM, amode, 0, 0, 1, 0, 0, 0, 0}
345 #define TNSyp(name, amode) {TERM, amode, 0, 0, 1, 0, 1, 0, 0}
346 #define TNSx(name, amode) {TERM, amode, 0, 1, 0, 0, 0, 0, 0}
347 #define TNSZ(name, amode, sz) {TERM, amode, sz, 0, 0, 0, 0, 0, 0}
348 #define TNSZy(name, amode, sz) {TERM, amode, sz, 0, 1, 0, 0, 0, 0}
349 #define TNSZvr(name, amode, sz) {TERM, amode, sz, 0, 0, 0, 0, 1, 0}
350 #define TS(name, amode) {TERM, amode, 0, 0, 0, 0, 0, 0, 0}
351 #define TSx(name, amode) {TERM, amode, 0, 1, 0, 0, 0, 0, 0}
352 #define TSy(name, amode) {TERM, amode, 0, 0, 1, 0, 0, 0, 0}
353 #define TSp(name, amode) {TERM, amode, 0, 0, 0, 0, 1, 0, 0}
354 #define TSZ(name, amode, sz) {TERM, amode, sz, 0, 0, 0, 0, 0, 0}
355 #define TSaZ(name, amode, sz) {TERM, amode, sz, 0, 0, 0, 0, 0, 1}
356 #define TSZx(name, amode, sz) {TERM, amode, sz, 1, 0, 0, 0, 0 ,0}
357 #define TSZy(name, amode, sz) {TERM, amode, sz, 0, 1, 0, 0, 0, 0}
358 #define INVALID {TERM, UNKNOWN, 0, 0, 0, 0, 0, 0, 0}
360 #define IND(table) {(instable_t *)table, 0, 0, 0, 0, 0, 0, 0}
361 #define INDx(table) {(instable_t *)table, 0, 1, 0, 0, 0, 0, 0}
362 #define TNS(name, amode) {TERM, amode, 0, 0, 0, 0, 0, 0}
363 #define TNSu(name, amode) {TERM, amode, 0, 0, 1, 0, 0, 0}
364 #define TNSy(name, amode) {TERM, amode, 0, 1, 0, 0, 0, 0}
365 #define TNSyp(name, amode) {TERM, amode, 0, 1, 0, 1, 0, 0}
366 #define TNSx(name, amode) {TERM, amode, 1, 0, 0, 0, 0, 0}
367 #define TNSZ(name, amode, sz) {TERM, amode, 0, 0, 0, 0, 0, 0}
368 #define TNSZy(name, amode, sz) {TERM, amode, 0, 1, 0, 0, 0, 0}
369 #define TNSZvr(name, amode, sz) {TERM, amode, 0, 0, 0, 0, 1, 0}
370 #define TS(name, amode) {TERM, amode, 0, 0, 0, 0, 0, 0}
371 #define TSx(name, amode) {TERM, amode, 1, 0, 0, 0, 0, 0}
372 #define TSy(name, amode) {TERM, amode, 0, 1, 0, 0, 0, 0}
373 #define TSp(name, amode) {TERM, amode, 0, 0, 0, 1, 0, 0}
374 #define TSZ(name, amode, sz) {TERM, amode, 0, 0, 0, 0, 0, 0}
375 #define TSaZ(name, amode, sz) {TERM, amode, 0, 0, 0, 0, 0, 1}
376 #define TSZx(name, amode, sz) {TERM, amode, 1, 0, 0, 0, 0, 0}
377 #define TSZy(name, amode, sz) {TERM, amode, 0, 1, 0, 0, 0, 0}
378 #define INVALID {TERM, UNKNOWN, 0, 0, 0, 0, 0, 0}
383 * this decodes the r_m field for mode's 0, 1, 2 in 16 bit mode
385 const char *const dis_addr16
[3][8] = {
386 "(%bx,%si)", "(%bx,%di)", "(%bp,%si)", "(%bp,%di)", "(%si)", "(%di)", "",
388 "(%bx,%si)", "(%bx,%di)", "(%bp,%si)", "(%bp,%di)", "(%si)", "(%di", "(%bp)",
390 "(%bx,%si)", "(%bx,%di)", "(%bp,%si)", "(%bp,%di)", "(%si)", "(%di)", "(%bp)",
396 * This decodes 32 bit addressing mode r_m field for modes 0, 1, 2
398 const char *const dis_addr32_mode0
[16] = {
399 "(%eax)", "(%ecx)", "(%edx)", "(%ebx)", "", "", "(%esi)", "(%edi)",
400 "(%r8d)", "(%r9d)", "(%r10d)", "(%r11d)", "", "", "(%r14d)", "(%r15d)"
403 const char *const dis_addr32_mode12
[16] = {
404 "(%eax)", "(%ecx)", "(%edx)", "(%ebx)", "", "(%ebp)", "(%esi)", "(%edi)",
405 "(%r8d)", "(%r9d)", "(%r10d)", "(%r11d)", "", "(%r13d)", "(%r14d)", "(%r15d)"
409 * This decodes 64 bit addressing mode r_m field for modes 0, 1, 2
411 const char *const dis_addr64_mode0
[16] = {
412 "(%rax)", "(%rcx)", "(%rdx)", "(%rbx)", "", "(%rip)", "(%rsi)", "(%rdi)",
413 "(%r8)", "(%r9)", "(%r10)", "(%r11)", "(%r12)", "(%rip)", "(%r14)", "(%r15)"
415 const char *const dis_addr64_mode12
[16] = {
416 "(%rax)", "(%rcx)", "(%rdx)", "(%rbx)", "", "(%rbp)", "(%rsi)", "(%rdi)",
417 "(%r8)", "(%r9)", "(%r10)", "(%r11)", "(%r12)", "(%r13)", "(%r14)", "(%r15)"
421 * decode for scale from SIB byte
423 const char *const dis_scale_factor
[4] = { ")", ",2)", ",4)", ",8)" };
426 * decode for scale from VSIB byte, note that we always include the scale factor
429 const char *const dis_vscale_factor
[4] = { ",1)", ",2)", ",4)", ",8)" };
432 * register decoding for normal references to registers (ie. not addressing)
434 const char *const dis_REG8
[16] = {
435 "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh",
436 "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b"
439 const char *const dis_REG8_REX
[16] = {
440 "%al", "%cl", "%dl", "%bl", "%spl", "%bpl", "%sil", "%dil",
441 "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b"
444 const char *const dis_REG16
[16] = {
445 "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
446 "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w"
449 const char *const dis_REG32
[16] = {
450 "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
451 "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d"
454 const char *const dis_REG64
[16] = {
455 "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
456 "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
459 const char *const dis_DEBUGREG
[16] = {
460 "%db0", "%db1", "%db2", "%db3", "%db4", "%db5", "%db6", "%db7",
461 "%db8", "%db9", "%db10", "%db11", "%db12", "%db13", "%db14", "%db15"
464 const char *const dis_CONTROLREG
[16] = {
465 "%cr0", "%cr1", "%cr2", "%cr3", "%cr4", "%cr5?", "%cr6?", "%cr7?",
466 "%cr8", "%cr9?", "%cr10?", "%cr11?", "%cr12?", "%cr13?", "%cr14?", "%cr15?"
469 const char *const dis_TESTREG
[16] = {
470 "%tr0?", "%tr1?", "%tr2?", "%tr3", "%tr4", "%tr5", "%tr6", "%tr7",
471 "%tr0?", "%tr1?", "%tr2?", "%tr3", "%tr4", "%tr5", "%tr6", "%tr7"
474 const char *const dis_MMREG
[16] = {
475 "%mm0", "%mm1", "%mm2", "%mm3", "%mm4", "%mm5", "%mm6", "%mm7",
476 "%mm0", "%mm1", "%mm2", "%mm3", "%mm4", "%mm5", "%mm6", "%mm7"
479 const char *const dis_XMMREG
[16] = {
480 "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7",
481 "%xmm8", "%xmm9", "%xmm10", "%xmm11", "%xmm12", "%xmm13", "%xmm14", "%xmm15"
484 const char *const dis_YMMREG
[16] = {
485 "%ymm0", "%ymm1", "%ymm2", "%ymm3", "%ymm4", "%ymm5", "%ymm6", "%ymm7",
486 "%ymm8", "%ymm9", "%ymm10", "%ymm11", "%ymm12", "%ymm13", "%ymm14", "%ymm15"
489 const char *const dis_SEGREG
[16] = {
490 "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "<reserved>", "<reserved>",
491 "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "<reserved>", "<reserved>"
495 * SIMD predicate suffixes
497 const char *const dis_PREDSUFFIX
[8] = {
498 "eq", "lt", "le", "unord", "neq", "nlt", "nle", "ord"
501 const char *const dis_AVXvgrp7
[3][8] = {
503 /*71*/ {"", "", "vpsrlw", "", "vpsraw", "", "vpsllw", ""},
504 /*72*/ {"", "", "vpsrld", "", "vpsrad", "", "vpslld", ""},
505 /*73*/ {"", "", "vpsrlq", "vpsrldq", "", "", "vpsllq", "vpslldq"}
508 #endif /* DIS_TEXT */
511 * "decode table" for 64 bit mode MOVSXD instruction (opcode 0x63)
513 const instable_t dis_opMOVSLD
= TNS("movslq",MOVSXZ
);
516 * "decode table" for pause and clflush instructions
518 const instable_t dis_opPause
= TNS("pause", NORM
);
521 * Decode table for 0x0F00 opcodes
523 const instable_t dis_op0F00
[8] = {
525 /* [0] */ TNS("sldt",M
), TNS("str",M
), TNSy("lldt",M
), TNSy("ltr",M
),
526 /* [4] */ TNSZ("verr",M
,2), TNSZ("verw",M
,2), INVALID
, INVALID
,
531 * Decode table for 0x0F01 opcodes
533 const instable_t dis_op0F01
[8] = {
535 /* [0] */ TNSZ("sgdt",VMx
,6), TNSZ("sidt",MONITOR_MWAIT
,6), TNSZ("lgdt",XGETBV_XSETBV
,6), TNSZ("lidt",SVM
,6),
536 /* [4] */ TNSZ("smsw",M
,2), INVALID
, TNSZ("lmsw",M
,2), TNS("invlpg",SWAPGS_RDTSCP
),
540 * Decode table for 0x0F18 opcodes -- SIMD prefetch
542 const instable_t dis_op0F18
[8] = {
544 /* [0] */ TNS("prefetchnta",PREF
),TNS("prefetcht0",PREF
), TNS("prefetcht1",PREF
), TNS("prefetcht2",PREF
),
545 /* [4] */ INVALID
, INVALID
, INVALID
, INVALID
,
549 * Decode table for 0x0FAE opcodes -- SIMD state save/restore
551 const instable_t dis_op0FAE
[8] = {
552 /* [0] */ TNSZ("fxsave",M
,512), TNSZ("fxrstor",M
,512), TNS("ldmxcsr",M
), TNS("stmxcsr",M
),
553 /* [4] */ TNSZ("xsave",M
,512), TNS("lfence",XMMFENCE
), TNS("mfence",XMMFENCE
), TNS("sfence",XMMSFNC
),
557 * Decode table for 0x0FBA opcodes
560 const instable_t dis_op0FBA
[8] = {
562 /* [0] */ INVALID
, INVALID
, INVALID
, INVALID
,
563 /* [4] */ TS("bt",MIb
), TS("bts",MIb
), TS("btr",MIb
), TS("btc",MIb
),
567 * Decode table for 0x0FC7 opcode (group 9)
570 const instable_t dis_op0FC7
[8] = {
572 /* [0] */ INVALID
, TNS("cmpxchg8b",M
), INVALID
, INVALID
,
573 /* [4] */ INVALID
, INVALID
, TNS("vmptrld",MG9
), TNS("vmptrst",MG9
),
577 * Decode table for 0x0FC7 opcode (group 9) mode 3
580 const instable_t dis_op0FC7m3
[8] = {
582 /* [0] */ INVALID
, INVALID
, INVALID
, INVALID
,
583 /* [4] */ INVALID
, INVALID
, TNS("rdrand",MG9
), TNS("rdseed", MG9
),
587 * Decode table for 0x0FC7 opcode with 0x66 prefix
590 const instable_t dis_op660FC7
[8] = {
592 /* [0] */ INVALID
, INVALID
, INVALID
, INVALID
,
593 /* [4] */ INVALID
, INVALID
, TNS("vmclear",M
), INVALID
,
597 * Decode table for 0x0FC7 opcode with 0xF3 prefix
600 const instable_t dis_opF30FC7
[8] = {
602 /* [0] */ INVALID
, INVALID
, INVALID
, INVALID
,
603 /* [4] */ INVALID
, INVALID
, TNS("vmxon",M
), INVALID
,
607 * Decode table for 0x0FC8 opcode -- 486 bswap instruction
609 *bit pattern: 0000 1111 1100 1reg
611 const instable_t dis_op0FC8
[4] = {
612 /* [0] */ TNS("bswap",R
), INVALID
, INVALID
, INVALID
,
616 * Decode table for 0x0F71, 0x0F72, and 0x0F73 opcodes -- MMX instructions
618 const instable_t dis_op0F7123
[4][8] = {
620 /* [70].0 */ INVALID
, INVALID
, INVALID
, INVALID
,
621 /* .4 */ INVALID
, INVALID
, INVALID
, INVALID
,
623 /* [71].0 */ INVALID
, INVALID
, TNS("psrlw",MMOSH
), INVALID
,
624 /* .4 */ TNS("psraw",MMOSH
), INVALID
, TNS("psllw",MMOSH
), INVALID
,
626 /* [72].0 */ INVALID
, INVALID
, TNS("psrld",MMOSH
), INVALID
,
627 /* .4 */ TNS("psrad",MMOSH
), INVALID
, TNS("pslld",MMOSH
), INVALID
,
629 /* [73].0 */ INVALID
, INVALID
, TNS("psrlq",MMOSH
), TNS("INVALID",MMOSH
),
630 /* .4 */ INVALID
, INVALID
, TNS("psllq",MMOSH
), TNS("INVALID",MMOSH
),
634 * Decode table for SIMD extensions to above 0x0F71-0x0F73 opcodes.
636 const instable_t dis_opSIMD7123
[32] = {
637 /* [70].0 */ INVALID
, INVALID
, INVALID
, INVALID
,
638 /* .4 */ INVALID
, INVALID
, INVALID
, INVALID
,
640 /* [71].0 */ INVALID
, INVALID
, TNS("psrlw",XMMSH
), INVALID
,
641 /* .4 */ TNS("psraw",XMMSH
), INVALID
, TNS("psllw",XMMSH
), INVALID
,
643 /* [72].0 */ INVALID
, INVALID
, TNS("psrld",XMMSH
), INVALID
,
644 /* .4 */ TNS("psrad",XMMSH
), INVALID
, TNS("pslld",XMMSH
), INVALID
,
646 /* [73].0 */ INVALID
, INVALID
, TNS("psrlq",XMMSH
), TNS("psrldq",XMMSH
),
647 /* .4 */ INVALID
, INVALID
, TNS("psllq",XMMSH
), TNS("pslldq",XMMSH
),
651 * SIMD instructions have been wedged into the existing IA32 instruction
652 * set through the use of prefixes. That is, while 0xf0 0x58 may be
653 * addps, 0xf3 0xf0 0x58 (literally, repz addps) is a completely different
654 * instruction - addss. At present, three prefixes have been coopted in
655 * this manner - address size (0x66), repnz (0xf2) and repz (0xf3). The
656 * following tables are used to provide the prefixed instruction names.
657 * The arrays are sparse, but they're fast.
661 * Decode table for SIMD instructions with the address size (0x66) prefix.
663 const instable_t dis_opSIMDdata16
[256] = {
664 /* [00] */ INVALID
, INVALID
, INVALID
, INVALID
,
665 /* [04] */ INVALID
, INVALID
, INVALID
, INVALID
,
666 /* [08] */ INVALID
, INVALID
, INVALID
, INVALID
,
667 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
669 /* [10] */ TNSZ("movupd",XMM
,16), TNSZ("movupd",XMMS
,16), TNSZ("movlpd",XMMM
,8), TNSZ("movlpd",XMMMS
,8),
670 /* [14] */ TNSZ("unpcklpd",XMM
,16),TNSZ("unpckhpd",XMM
,16),TNSZ("movhpd",XMMM
,8), TNSZ("movhpd",XMMMS
,8),
671 /* [18] */ INVALID
, INVALID
, INVALID
, INVALID
,
672 /* [1C] */ INVALID
, INVALID
, INVALID
, INVALID
,
674 /* [20] */ INVALID
, INVALID
, INVALID
, INVALID
,
675 /* [24] */ INVALID
, INVALID
, INVALID
, INVALID
,
676 /* [28] */ TNSZ("movapd",XMM
,16), TNSZ("movapd",XMMS
,16), TNSZ("cvtpi2pd",XMMOMX
,8),TNSZ("movntpd",XMMOMS
,16),
677 /* [2C] */ TNSZ("cvttpd2pi",XMMXMM
,16),TNSZ("cvtpd2pi",XMMXMM
,16),TNSZ("ucomisd",XMM
,8),TNSZ("comisd",XMM
,8),
679 /* [30] */ INVALID
, INVALID
, INVALID
, INVALID
,
680 /* [34] */ INVALID
, INVALID
, INVALID
, INVALID
,
681 /* [38] */ INVALID
, INVALID
, INVALID
, INVALID
,
682 /* [3C] */ INVALID
, INVALID
, INVALID
, INVALID
,
684 /* [40] */ INVALID
, INVALID
, INVALID
, INVALID
,
685 /* [44] */ INVALID
, INVALID
, INVALID
, INVALID
,
686 /* [48] */ INVALID
, INVALID
, INVALID
, INVALID
,
687 /* [4C] */ INVALID
, INVALID
, INVALID
, INVALID
,
689 /* [50] */ TNS("movmskpd",XMMOX3
), TNSZ("sqrtpd",XMM
,16), INVALID
, INVALID
,
690 /* [54] */ TNSZ("andpd",XMM
,16), TNSZ("andnpd",XMM
,16), TNSZ("orpd",XMM
,16), TNSZ("xorpd",XMM
,16),
691 /* [58] */ TNSZ("addpd",XMM
,16), TNSZ("mulpd",XMM
,16), TNSZ("cvtpd2ps",XMM
,16),TNSZ("cvtps2dq",XMM
,16),
692 /* [5C] */ TNSZ("subpd",XMM
,16), TNSZ("minpd",XMM
,16), TNSZ("divpd",XMM
,16), TNSZ("maxpd",XMM
,16),
694 /* [60] */ TNSZ("punpcklbw",XMM
,16),TNSZ("punpcklwd",XMM
,16),TNSZ("punpckldq",XMM
,16),TNSZ("packsswb",XMM
,16),
695 /* [64] */ TNSZ("pcmpgtb",XMM
,16), TNSZ("pcmpgtw",XMM
,16), TNSZ("pcmpgtd",XMM
,16), TNSZ("packuswb",XMM
,16),
696 /* [68] */ TNSZ("punpckhbw",XMM
,16),TNSZ("punpckhwd",XMM
,16),TNSZ("punpckhdq",XMM
,16),TNSZ("packssdw",XMM
,16),
697 /* [6C] */ TNSZ("punpcklqdq",XMM
,16),TNSZ("punpckhqdq",XMM
,16),TNSZ("movd",XMM3MX
,4),TNSZ("movdqa",XMM
,16),
699 /* [70] */ TNSZ("pshufd",XMMP
,16), INVALID
, INVALID
, INVALID
,
700 /* [74] */ TNSZ("pcmpeqb",XMM
,16), TNSZ("pcmpeqw",XMM
,16), TNSZ("pcmpeqd",XMM
,16), INVALID
,
701 /* [78] */ TNSZ("extrq",XMM2I
,16), TNSZ("extrq",XMM
,16), INVALID
, INVALID
,
702 /* [7C] */ TNSZ("haddpd",XMM
,16), TNSZ("hsubpd",XMM
,16), TNSZ("movd",XMM3MXS
,4), TNSZ("movdqa",XMMS
,16),
704 /* [80] */ INVALID
, INVALID
, INVALID
, INVALID
,
705 /* [84] */ INVALID
, INVALID
, INVALID
, INVALID
,
706 /* [88] */ INVALID
, INVALID
, INVALID
, INVALID
,
707 /* [8C] */ INVALID
, INVALID
, INVALID
, INVALID
,
709 /* [90] */ INVALID
, INVALID
, INVALID
, INVALID
,
710 /* [94] */ INVALID
, INVALID
, INVALID
, INVALID
,
711 /* [98] */ INVALID
, INVALID
, INVALID
, INVALID
,
712 /* [9C] */ INVALID
, INVALID
, INVALID
, INVALID
,
714 /* [A0] */ INVALID
, INVALID
, INVALID
, INVALID
,
715 /* [A4] */ INVALID
, INVALID
, INVALID
, INVALID
,
716 /* [A8] */ INVALID
, INVALID
, INVALID
, INVALID
,
717 /* [AC] */ INVALID
, INVALID
, INVALID
, INVALID
,
719 /* [B0] */ INVALID
, INVALID
, INVALID
, INVALID
,
720 /* [B4] */ INVALID
, INVALID
, INVALID
, INVALID
,
721 /* [B8] */ INVALID
, INVALID
, INVALID
, INVALID
,
722 /* [BC] */ INVALID
, INVALID
, INVALID
, INVALID
,
724 /* [C0] */ INVALID
, INVALID
, TNSZ("cmppd",XMMP
,16), INVALID
,
725 /* [C4] */ TNSZ("pinsrw",XMMPRM
,2),TNS("pextrw",XMM3P
), TNSZ("shufpd",XMMP
,16), INVALID
,
726 /* [C8] */ INVALID
, INVALID
, INVALID
, INVALID
,
727 /* [CC] */ INVALID
, INVALID
, INVALID
, INVALID
,
729 /* [D0] */ TNSZ("addsubpd",XMM
,16),TNSZ("psrlw",XMM
,16), TNSZ("psrld",XMM
,16), TNSZ("psrlq",XMM
,16),
730 /* [D4] */ TNSZ("paddq",XMM
,16), TNSZ("pmullw",XMM
,16), TNSZ("movq",XMMS
,8), TNS("pmovmskb",XMMX3
),
731 /* [D8] */ TNSZ("psubusb",XMM
,16), TNSZ("psubusw",XMM
,16), TNSZ("pminub",XMM
,16), TNSZ("pand",XMM
,16),
732 /* [DC] */ TNSZ("paddusb",XMM
,16), TNSZ("paddusw",XMM
,16), TNSZ("pmaxub",XMM
,16), TNSZ("pandn",XMM
,16),
734 /* [E0] */ TNSZ("pavgb",XMM
,16), TNSZ("psraw",XMM
,16), TNSZ("psrad",XMM
,16), TNSZ("pavgw",XMM
,16),
735 /* [E4] */ TNSZ("pmulhuw",XMM
,16), TNSZ("pmulhw",XMM
,16), TNSZ("cvttpd2dq",XMM
,16),TNSZ("movntdq",XMMS
,16),
736 /* [E8] */ TNSZ("psubsb",XMM
,16), TNSZ("psubsw",XMM
,16), TNSZ("pminsw",XMM
,16), TNSZ("por",XMM
,16),
737 /* [EC] */ TNSZ("paddsb",XMM
,16), TNSZ("paddsw",XMM
,16), TNSZ("pmaxsw",XMM
,16), TNSZ("pxor",XMM
,16),
739 /* [F0] */ INVALID
, TNSZ("psllw",XMM
,16), TNSZ("pslld",XMM
,16), TNSZ("psllq",XMM
,16),
740 /* [F4] */ TNSZ("pmuludq",XMM
,16), TNSZ("pmaddwd",XMM
,16), TNSZ("psadbw",XMM
,16), TNSZ("maskmovdqu", XMMXIMPL
,16),
741 /* [F8] */ TNSZ("psubb",XMM
,16), TNSZ("psubw",XMM
,16), TNSZ("psubd",XMM
,16), TNSZ("psubq",XMM
,16),
742 /* [FC] */ TNSZ("paddb",XMM
,16), TNSZ("paddw",XMM
,16), TNSZ("paddd",XMM
,16), INVALID
,
745 const instable_t dis_opAVX660F
[256] = {
746 /* [00] */ INVALID
, INVALID
, INVALID
, INVALID
,
747 /* [04] */ INVALID
, INVALID
, INVALID
, INVALID
,
748 /* [08] */ INVALID
, INVALID
, INVALID
, INVALID
,
749 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
751 /* [10] */ TNSZ("vmovupd",VEX_MX
,16), TNSZ("vmovupd",VEX_RX
,16), TNSZ("vmovlpd",VEX_RMrX
,8), TNSZ("vmovlpd",VEX_RM
,8),
752 /* [14] */ TNSZ("vunpcklpd",VEX_RMrX
,16),TNSZ("vunpckhpd",VEX_RMrX
,16),TNSZ("vmovhpd",VEX_RMrX
,8), TNSZ("vmovhpd",VEX_RM
,8),
753 /* [18] */ INVALID
, INVALID
, INVALID
, INVALID
,
754 /* [1C] */ INVALID
, INVALID
, INVALID
, INVALID
,
756 /* [20] */ INVALID
, INVALID
, INVALID
, INVALID
,
757 /* [24] */ INVALID
, INVALID
, INVALID
, INVALID
,
758 /* [28] */ TNSZ("vmovapd",VEX_MX
,16), TNSZ("vmovapd",VEX_RX
,16), INVALID
, TNSZ("vmovntpd",VEX_RM
,16),
759 /* [2C] */ INVALID
, INVALID
, TNSZ("vucomisd",VEX_MX
,8),TNSZ("vcomisd",VEX_MX
,8),
761 /* [30] */ INVALID
, INVALID
, INVALID
, INVALID
,
762 /* [34] */ INVALID
, INVALID
, INVALID
, INVALID
,
763 /* [38] */ INVALID
, INVALID
, INVALID
, INVALID
,
764 /* [3C] */ INVALID
, INVALID
, INVALID
, INVALID
,
766 /* [40] */ INVALID
, INVALID
, INVALID
, INVALID
,
767 /* [44] */ INVALID
, INVALID
, INVALID
, INVALID
,
768 /* [48] */ INVALID
, INVALID
, INVALID
, INVALID
,
769 /* [4C] */ INVALID
, INVALID
, INVALID
, INVALID
,
771 /* [50] */ TNS("vmovmskpd",VEX_MR
), TNSZ("vsqrtpd",VEX_MX
,16), INVALID
, INVALID
,
772 /* [54] */ TNSZ("vandpd",VEX_RMrX
,16), TNSZ("vandnpd",VEX_RMrX
,16), TNSZ("vorpd",VEX_RMrX
,16), TNSZ("vxorpd",VEX_RMrX
,16),
773 /* [58] */ TNSZ("vaddpd",VEX_RMrX
,16), TNSZ("vmulpd",VEX_RMrX
,16), TNSZ("vcvtpd2ps",VEX_MX
,16),TNSZ("vcvtps2dq",VEX_MX
,16),
774 /* [5C] */ TNSZ("vsubpd",VEX_RMrX
,16), TNSZ("vminpd",VEX_RMrX
,16), TNSZ("vdivpd",VEX_RMrX
,16), TNSZ("vmaxpd",VEX_RMrX
,16),
776 /* [60] */ TNSZ("vpunpcklbw",VEX_RMrX
,16),TNSZ("vpunpcklwd",VEX_RMrX
,16),TNSZ("vpunpckldq",VEX_RMrX
,16),TNSZ("vpacksswb",VEX_RMrX
,16),
777 /* [64] */ TNSZ("vpcmpgtb",VEX_RMrX
,16), TNSZ("vpcmpgtw",VEX_RMrX
,16), TNSZ("vpcmpgtd",VEX_RMrX
,16), TNSZ("vpackuswb",VEX_RMrX
,16),
778 /* [68] */ TNSZ("vpunpckhbw",VEX_RMrX
,16),TNSZ("vpunpckhwd",VEX_RMrX
,16),TNSZ("vpunpckhdq",VEX_RMrX
,16),TNSZ("vpackssdw",VEX_RMrX
,16),
779 /* [6C] */ TNSZ("vpunpcklqdq",VEX_RMrX
,16),TNSZ("vpunpckhqdq",VEX_RMrX
,16),TNSZ("vmovd",VEX_MX
,4),TNSZ("vmovdqa",VEX_MX
,16),
781 /* [70] */ TNSZ("vpshufd",VEX_MXI
,16), TNSZ("vgrp71",VEX_XXI
,16), TNSZ("vgrp72",VEX_XXI
,16), TNSZ("vgrp73",VEX_XXI
,16),
782 /* [74] */ TNSZ("vpcmpeqb",VEX_RMrX
,16), TNSZ("vpcmpeqw",VEX_RMrX
,16), TNSZ("vpcmpeqd",VEX_RMrX
,16), INVALID
,
783 /* [78] */ INVALID
, INVALID
, INVALID
, INVALID
,
784 /* [7C] */ TNSZ("vhaddpd",VEX_RMrX
,16), TNSZ("vhsubpd",VEX_RMrX
,16), TNSZ("vmovd",VEX_RR
,4), TNSZ("vmovdqa",VEX_RX
,16),
786 /* [80] */ INVALID
, INVALID
, INVALID
, INVALID
,
787 /* [84] */ INVALID
, INVALID
, INVALID
, INVALID
,
788 /* [88] */ INVALID
, INVALID
, INVALID
, INVALID
,
789 /* [8C] */ INVALID
, INVALID
, INVALID
, INVALID
,
791 /* [90] */ INVALID
, INVALID
, INVALID
, INVALID
,
792 /* [94] */ INVALID
, INVALID
, INVALID
, INVALID
,
793 /* [98] */ INVALID
, INVALID
, INVALID
, INVALID
,
794 /* [9C] */ INVALID
, INVALID
, INVALID
, INVALID
,
796 /* [A0] */ INVALID
, INVALID
, INVALID
, INVALID
,
797 /* [A4] */ INVALID
, INVALID
, INVALID
, INVALID
,
798 /* [A8] */ INVALID
, INVALID
, INVALID
, INVALID
,
799 /* [AC] */ INVALID
, INVALID
, INVALID
, INVALID
,
801 /* [B0] */ INVALID
, INVALID
, INVALID
, INVALID
,
802 /* [B4] */ INVALID
, INVALID
, INVALID
, INVALID
,
803 /* [B8] */ INVALID
, INVALID
, INVALID
, INVALID
,
804 /* [BC] */ INVALID
, INVALID
, INVALID
, INVALID
,
806 /* [C0] */ INVALID
, INVALID
, TNSZ("vcmppd",VEX_RMRX
,16), INVALID
,
807 /* [C4] */ TNSZ("vpinsrw",VEX_RMRX
,2),TNS("vpextrw",VEX_MR
), TNSZ("vshufpd",VEX_RMRX
,16), INVALID
,
808 /* [C8] */ INVALID
, INVALID
, INVALID
, INVALID
,
809 /* [CC] */ INVALID
, INVALID
, INVALID
, INVALID
,
811 /* [D0] */ TNSZ("vaddsubpd",VEX_RMrX
,16),TNSZ("vpsrlw",VEX_RMrX
,16), TNSZ("vpsrld",VEX_RMrX
,16), TNSZ("vpsrlq",VEX_RMrX
,16),
812 /* [D4] */ TNSZ("vpaddq",VEX_RMrX
,16), TNSZ("vpmullw",VEX_RMrX
,16), TNSZ("vmovq",VEX_RX
,8), TNS("vpmovmskb",VEX_MR
),
813 /* [D8] */ TNSZ("vpsubusb",VEX_RMrX
,16), TNSZ("vpsubusw",VEX_RMrX
,16), TNSZ("vpminub",VEX_RMrX
,16), TNSZ("vpand",VEX_RMrX
,16),
814 /* [DC] */ TNSZ("vpaddusb",VEX_RMrX
,16), TNSZ("vpaddusw",VEX_RMrX
,16), TNSZ("vpmaxub",VEX_RMrX
,16), TNSZ("vpandn",VEX_RMrX
,16),
816 /* [E0] */ TNSZ("vpavgb",VEX_RMrX
,16), TNSZ("vpsraw",VEX_RMrX
,16), TNSZ("vpsrad",VEX_RMrX
,16), TNSZ("vpavgw",VEX_RMrX
,16),
817 /* [E4] */ TNSZ("vpmulhuw",VEX_RMrX
,16), TNSZ("vpmulhw",VEX_RMrX
,16), TNSZ("vcvttpd2dq",VEX_MX
,16),TNSZ("vmovntdq",VEX_RM
,16),
818 /* [E8] */ TNSZ("vpsubsb",VEX_RMrX
,16), TNSZ("vpsubsw",VEX_RMrX
,16), TNSZ("vpminsw",VEX_RMrX
,16), TNSZ("vpor",VEX_RMrX
,16),
819 /* [EC] */ TNSZ("vpaddsb",VEX_RMrX
,16), TNSZ("vpaddsw",VEX_RMrX
,16), TNSZ("vpmaxsw",VEX_RMrX
,16), TNSZ("vpxor",VEX_RMrX
,16),
821 /* [F0] */ INVALID
, TNSZ("vpsllw",VEX_RMrX
,16), TNSZ("vpslld",VEX_RMrX
,16), TNSZ("vpsllq",VEX_RMrX
,16),
822 /* [F4] */ TNSZ("vpmuludq",VEX_RMrX
,16), TNSZ("vpmaddwd",VEX_RMrX
,16), TNSZ("vpsadbw",VEX_RMrX
,16), TNS("vmaskmovdqu",VEX_MX
),
823 /* [F8] */ TNSZ("vpsubb",VEX_RMrX
,16), TNSZ("vpsubw",VEX_RMrX
,16), TNSZ("vpsubd",VEX_RMrX
,16), TNSZ("vpsubq",VEX_RMrX
,16),
824 /* [FC] */ TNSZ("vpaddb",VEX_RMrX
,16), TNSZ("vpaddw",VEX_RMrX
,16), TNSZ("vpaddd",VEX_RMrX
,16), INVALID
,
828 * Decode table for SIMD instructions with the repnz (0xf2) prefix.
830 const instable_t dis_opSIMDrepnz
[256] = {
831 /* [00] */ INVALID
, INVALID
, INVALID
, INVALID
,
832 /* [04] */ INVALID
, INVALID
, INVALID
, INVALID
,
833 /* [08] */ INVALID
, INVALID
, INVALID
, INVALID
,
834 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
836 /* [10] */ TNSZ("movsd",XMM
,8), TNSZ("movsd",XMMS
,8), TNSZ("movddup",XMM
,8), INVALID
,
837 /* [14] */ INVALID
, INVALID
, INVALID
, INVALID
,
838 /* [18] */ INVALID
, INVALID
, INVALID
, INVALID
,
839 /* [1C] */ INVALID
, INVALID
, INVALID
, INVALID
,
841 /* [20] */ INVALID
, INVALID
, INVALID
, INVALID
,
842 /* [24] */ INVALID
, INVALID
, INVALID
, INVALID
,
843 /* [28] */ INVALID
, INVALID
, TNSZ("cvtsi2sd",XMM3MX
,4),TNSZ("movntsd",XMMMS
,8),
844 /* [2C] */ TNSZ("cvttsd2si",XMMXM3
,8),TNSZ("cvtsd2si",XMMXM3
,8),INVALID
, INVALID
,
846 /* [30] */ INVALID
, INVALID
, INVALID
, INVALID
,
847 /* [34] */ INVALID
, INVALID
, INVALID
, INVALID
,
848 /* [38] */ INVALID
, INVALID
, INVALID
, INVALID
,
849 /* [3C] */ INVALID
, INVALID
, INVALID
, INVALID
,
851 /* [40] */ INVALID
, INVALID
, INVALID
, INVALID
,
852 /* [44] */ INVALID
, INVALID
, INVALID
, INVALID
,
853 /* [48] */ INVALID
, INVALID
, INVALID
, INVALID
,
854 /* [4C] */ INVALID
, INVALID
, INVALID
, INVALID
,
856 /* [50] */ INVALID
, TNSZ("sqrtsd",XMM
,8), INVALID
, INVALID
,
857 /* [54] */ INVALID
, INVALID
, INVALID
, INVALID
,
858 /* [58] */ TNSZ("addsd",XMM
,8), TNSZ("mulsd",XMM
,8), TNSZ("cvtsd2ss",XMM
,8), INVALID
,
859 /* [5C] */ TNSZ("subsd",XMM
,8), TNSZ("minsd",XMM
,8), TNSZ("divsd",XMM
,8), TNSZ("maxsd",XMM
,8),
861 /* [60] */ INVALID
, INVALID
, INVALID
, INVALID
,
862 /* [64] */ INVALID
, INVALID
, INVALID
, INVALID
,
863 /* [68] */ INVALID
, INVALID
, INVALID
, INVALID
,
864 /* [6C] */ INVALID
, INVALID
, INVALID
, INVALID
,
866 /* [70] */ TNSZ("pshuflw",XMMP
,16),INVALID
, INVALID
, INVALID
,
867 /* [74] */ INVALID
, INVALID
, INVALID
, INVALID
,
868 /* [78] */ TNSZ("insertq",XMMX2I
,16),TNSZ("insertq",XMM
,8),INVALID
, INVALID
,
869 /* [7C] */ TNSZ("haddps",XMM
,16), TNSZ("hsubps",XMM
,16), INVALID
, INVALID
,
871 /* [80] */ INVALID
, INVALID
, INVALID
, INVALID
,
872 /* [84] */ INVALID
, INVALID
, INVALID
, INVALID
,
873 /* [88] */ INVALID
, INVALID
, INVALID
, INVALID
,
874 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
876 /* [90] */ INVALID
, INVALID
, INVALID
, INVALID
,
877 /* [94] */ INVALID
, INVALID
, INVALID
, INVALID
,
878 /* [98] */ INVALID
, INVALID
, INVALID
, INVALID
,
879 /* [9C] */ INVALID
, INVALID
, INVALID
, INVALID
,
881 /* [A0] */ INVALID
, INVALID
, INVALID
, INVALID
,
882 /* [A4] */ INVALID
, INVALID
, INVALID
, INVALID
,
883 /* [A8] */ INVALID
, INVALID
, INVALID
, INVALID
,
884 /* [AC] */ INVALID
, INVALID
, INVALID
, INVALID
,
886 /* [B0] */ INVALID
, INVALID
, INVALID
, INVALID
,
887 /* [B4] */ INVALID
, INVALID
, INVALID
, INVALID
,
888 /* [B8] */ INVALID
, INVALID
, INVALID
, INVALID
,
889 /* [BC] */ INVALID
, INVALID
, INVALID
, INVALID
,
891 /* [C0] */ INVALID
, INVALID
, TNSZ("cmpsd",XMMP
,8), INVALID
,
892 /* [C4] */ INVALID
, INVALID
, INVALID
, INVALID
,
893 /* [C8] */ INVALID
, INVALID
, INVALID
, INVALID
,
894 /* [CC] */ INVALID
, INVALID
, INVALID
, INVALID
,
896 /* [D0] */ TNSZ("addsubps",XMM
,16),INVALID
, INVALID
, INVALID
,
897 /* [D4] */ INVALID
, INVALID
, TNS("movdq2q",XMMXM
), INVALID
,
898 /* [D8] */ INVALID
, INVALID
, INVALID
, INVALID
,
899 /* [DC] */ INVALID
, INVALID
, INVALID
, INVALID
,
901 /* [E0] */ INVALID
, INVALID
, INVALID
, INVALID
,
902 /* [E4] */ INVALID
, INVALID
, TNSZ("cvtpd2dq",XMM
,16),INVALID
,
903 /* [E8] */ INVALID
, INVALID
, INVALID
, INVALID
,
904 /* [EC] */ INVALID
, INVALID
, INVALID
, INVALID
,
906 /* [F0] */ TNS("lddqu",XMMM
), INVALID
, INVALID
, INVALID
,
907 /* [F4] */ INVALID
, INVALID
, INVALID
, INVALID
,
908 /* [F8] */ INVALID
, INVALID
, INVALID
, INVALID
,
909 /* [FC] */ INVALID
, INVALID
, INVALID
, INVALID
,
912 const instable_t dis_opAVXF20F
[256] = {
913 /* [00] */ INVALID
, INVALID
, INVALID
, INVALID
,
914 /* [04] */ INVALID
, INVALID
, INVALID
, INVALID
,
915 /* [08] */ INVALID
, INVALID
, INVALID
, INVALID
,
916 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
918 /* [10] */ TNSZ("vmovsd",VEX_RMrX
,8), TNSZ("vmovsd",VEX_RRX
,8), TNSZ("vmovddup",VEX_MX
,8), INVALID
,
919 /* [14] */ INVALID
, INVALID
, INVALID
, INVALID
,
920 /* [18] */ INVALID
, INVALID
, INVALID
, INVALID
,
921 /* [1C] */ INVALID
, INVALID
, INVALID
, INVALID
,
923 /* [20] */ INVALID
, INVALID
, INVALID
, INVALID
,
924 /* [24] */ INVALID
, INVALID
, INVALID
, INVALID
,
925 /* [28] */ INVALID
, INVALID
, TNSZ("vcvtsi2sd",VEX_RMrX
,4),INVALID
,
926 /* [2C] */ TNSZ("vcvttsd2si",VEX_MR
,8),TNSZ("vcvtsd2si",VEX_MR
,8),INVALID
, INVALID
,
928 /* [30] */ INVALID
, INVALID
, INVALID
, INVALID
,
929 /* [34] */ INVALID
, INVALID
, INVALID
, INVALID
,
930 /* [38] */ INVALID
, INVALID
, INVALID
, INVALID
,
931 /* [3C] */ INVALID
, INVALID
, INVALID
, INVALID
,
933 /* [40] */ INVALID
, INVALID
, INVALID
, INVALID
,
934 /* [44] */ INVALID
, INVALID
, INVALID
, INVALID
,
935 /* [48] */ INVALID
, INVALID
, INVALID
, INVALID
,
936 /* [4C] */ INVALID
, INVALID
, INVALID
, INVALID
,
938 /* [50] */ INVALID
, TNSZ("vsqrtsd",VEX_RMrX
,8), INVALID
, INVALID
,
939 /* [54] */ INVALID
, INVALID
, INVALID
, INVALID
,
940 /* [58] */ TNSZ("vaddsd",VEX_RMrX
,8), TNSZ("vmulsd",VEX_RMrX
,8), TNSZ("vcvtsd2ss",VEX_RMrX
,8), INVALID
,
941 /* [5C] */ TNSZ("vsubsd",VEX_RMrX
,8), TNSZ("vminsd",VEX_RMrX
,8), TNSZ("vdivsd",VEX_RMrX
,8), TNSZ("vmaxsd",VEX_RMrX
,8),
943 /* [60] */ INVALID
, INVALID
, INVALID
, INVALID
,
944 /* [64] */ INVALID
, INVALID
, INVALID
, INVALID
,
945 /* [68] */ INVALID
, INVALID
, INVALID
, INVALID
,
946 /* [6C] */ INVALID
, INVALID
, INVALID
, INVALID
,
948 /* [70] */ TNSZ("vpshuflw",VEX_MXI
,16),INVALID
, INVALID
, INVALID
,
949 /* [74] */ INVALID
, INVALID
, INVALID
, INVALID
,
950 /* [78] */ INVALID
, INVALID
, INVALID
, INVALID
,
951 /* [7C] */ TNSZ("vhaddps",VEX_RMrX
,8), TNSZ("vhsubps",VEX_RMrX
,8), INVALID
, INVALID
,
953 /* [80] */ INVALID
, INVALID
, INVALID
, INVALID
,
954 /* [84] */ INVALID
, INVALID
, INVALID
, INVALID
,
955 /* [88] */ INVALID
, INVALID
, INVALID
, INVALID
,
956 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
958 /* [90] */ INVALID
, INVALID
, INVALID
, INVALID
,
959 /* [94] */ INVALID
, INVALID
, INVALID
, INVALID
,
960 /* [98] */ INVALID
, INVALID
, INVALID
, INVALID
,
961 /* [9C] */ INVALID
, INVALID
, INVALID
, INVALID
,
963 /* [A0] */ INVALID
, INVALID
, INVALID
, INVALID
,
964 /* [A4] */ INVALID
, INVALID
, INVALID
, INVALID
,
965 /* [A8] */ INVALID
, INVALID
, INVALID
, INVALID
,
966 /* [AC] */ INVALID
, INVALID
, INVALID
, INVALID
,
968 /* [B0] */ INVALID
, INVALID
, INVALID
, INVALID
,
969 /* [B4] */ INVALID
, INVALID
, INVALID
, INVALID
,
970 /* [B8] */ INVALID
, INVALID
, INVALID
, INVALID
,
971 /* [BC] */ INVALID
, INVALID
, INVALID
, INVALID
,
973 /* [C0] */ INVALID
, INVALID
, TNSZ("vcmpsd",VEX_RMRX
,8), INVALID
,
974 /* [C4] */ INVALID
, INVALID
, INVALID
, INVALID
,
975 /* [C8] */ INVALID
, INVALID
, INVALID
, INVALID
,
976 /* [CC] */ INVALID
, INVALID
, INVALID
, INVALID
,
978 /* [D0] */ TNSZ("vaddsubps",VEX_RMrX
,8), INVALID
, INVALID
, INVALID
,
979 /* [D4] */ INVALID
, INVALID
, INVALID
, INVALID
,
980 /* [D8] */ INVALID
, INVALID
, INVALID
, INVALID
,
981 /* [DC] */ INVALID
, INVALID
, INVALID
, INVALID
,
983 /* [E0] */ INVALID
, INVALID
, INVALID
, INVALID
,
984 /* [E4] */ INVALID
, INVALID
, TNSZ("vcvtpd2dq",VEX_MX
,16),INVALID
,
985 /* [E8] */ INVALID
, INVALID
, INVALID
, INVALID
,
986 /* [EC] */ INVALID
, INVALID
, INVALID
, INVALID
,
988 /* [F0] */ TNSZ("vlddqu",VEX_MX
,16), INVALID
, INVALID
, INVALID
,
989 /* [F4] */ INVALID
, INVALID
, INVALID
, INVALID
,
990 /* [F8] */ INVALID
, INVALID
, INVALID
, INVALID
,
991 /* [FC] */ INVALID
, INVALID
, INVALID
, INVALID
,
994 const instable_t dis_opAVXF20F3A
[256] = {
995 /* [00] */ INVALID
, INVALID
, INVALID
, INVALID
,
996 /* [04] */ INVALID
, INVALID
, INVALID
, INVALID
,
997 /* [08] */ INVALID
, INVALID
, INVALID
, INVALID
,
998 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1000 /* [10] */ INVALID
, INVALID
, INVALID
, INVALID
,
1001 /* [14] */ INVALID
, INVALID
, INVALID
, INVALID
,
1002 /* [18] */ INVALID
, INVALID
, INVALID
, INVALID
,
1003 /* [1C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1005 /* [20] */ INVALID
, INVALID
, INVALID
, INVALID
,
1006 /* [24] */ INVALID
, INVALID
, INVALID
, INVALID
,
1007 /* [28] */ INVALID
, INVALID
, INVALID
, INVALID
,
1008 /* [2C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1010 /* [30] */ INVALID
, INVALID
, INVALID
, INVALID
,
1011 /* [34] */ INVALID
, INVALID
, INVALID
, INVALID
,
1012 /* [38] */ INVALID
, INVALID
, INVALID
, INVALID
,
1013 /* [3C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1015 /* [40] */ INVALID
, INVALID
, INVALID
, INVALID
,
1016 /* [44] */ INVALID
, INVALID
, INVALID
, INVALID
,
1017 /* [48] */ INVALID
, INVALID
, INVALID
, INVALID
,
1018 /* [4C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1020 /* [50] */ INVALID
, INVALID
, INVALID
, INVALID
,
1021 /* [54] */ INVALID
, INVALID
, INVALID
, INVALID
,
1022 /* [58] */ INVALID
, INVALID
, INVALID
, INVALID
,
1023 /* [5C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1025 /* [60] */ INVALID
, INVALID
, INVALID
, INVALID
,
1026 /* [64] */ INVALID
, INVALID
, INVALID
, INVALID
,
1027 /* [68] */ INVALID
, INVALID
, INVALID
, INVALID
,
1028 /* [6C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1030 /* [70] */ INVALID
, INVALID
, INVALID
, INVALID
,
1031 /* [74] */ INVALID
, INVALID
, INVALID
, INVALID
,
1032 /* [78] */ INVALID
, INVALID
, INVALID
, INVALID
,
1033 /* [7C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1035 /* [80] */ INVALID
, INVALID
, INVALID
, INVALID
,
1036 /* [84] */ INVALID
, INVALID
, INVALID
, INVALID
,
1037 /* [88] */ INVALID
, INVALID
, INVALID
, INVALID
,
1038 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1040 /* [90] */ INVALID
, INVALID
, INVALID
, INVALID
,
1041 /* [94] */ INVALID
, INVALID
, INVALID
, INVALID
,
1042 /* [98] */ INVALID
, INVALID
, INVALID
, INVALID
,
1043 /* [9C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1045 /* [A0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1046 /* [A4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1047 /* [A8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1048 /* [AC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1050 /* [B0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1051 /* [B4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1052 /* [B8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1053 /* [BC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1055 /* [C0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1056 /* [C4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1057 /* [C8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1058 /* [CC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1060 /* [D0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1061 /* [D4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1062 /* [D8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1063 /* [DC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1065 /* [E0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1066 /* [E4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1067 /* [E8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1068 /* [EC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1070 /* [F0] */ TNSZvr("rorx",VEX_MXI
,6),INVALID
, INVALID
, INVALID
,
1071 /* [F4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1072 /* [F8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1073 /* [FC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1076 const instable_t dis_opAVXF20F38
[256] = {
1077 /* [00] */ INVALID
, INVALID
, INVALID
, INVALID
,
1078 /* [04] */ INVALID
, INVALID
, INVALID
, INVALID
,
1079 /* [08] */ INVALID
, INVALID
, INVALID
, INVALID
,
1080 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1082 /* [10] */ INVALID
, INVALID
, INVALID
, INVALID
,
1083 /* [14] */ INVALID
, INVALID
, INVALID
, INVALID
,
1084 /* [18] */ INVALID
, INVALID
, INVALID
, INVALID
,
1085 /* [1C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1087 /* [20] */ INVALID
, INVALID
, INVALID
, INVALID
,
1088 /* [24] */ INVALID
, INVALID
, INVALID
, INVALID
,
1089 /* [28] */ INVALID
, INVALID
, INVALID
, INVALID
,
1090 /* [2C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1092 /* [30] */ INVALID
, INVALID
, INVALID
, INVALID
,
1093 /* [34] */ INVALID
, INVALID
, INVALID
, INVALID
,
1094 /* [38] */ INVALID
, INVALID
, INVALID
, INVALID
,
1095 /* [3C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1097 /* [40] */ INVALID
, INVALID
, INVALID
, INVALID
,
1098 /* [44] */ INVALID
, INVALID
, INVALID
, INVALID
,
1099 /* [48] */ INVALID
, INVALID
, INVALID
, INVALID
,
1100 /* [4C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1102 /* [50] */ INVALID
, INVALID
, INVALID
, INVALID
,
1103 /* [54] */ INVALID
, INVALID
, INVALID
, INVALID
,
1104 /* [58] */ INVALID
, INVALID
, INVALID
, INVALID
,
1105 /* [5C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1107 /* [60] */ INVALID
, INVALID
, INVALID
, INVALID
,
1108 /* [64] */ INVALID
, INVALID
, INVALID
, INVALID
,
1109 /* [68] */ INVALID
, INVALID
, INVALID
, INVALID
,
1110 /* [6C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1112 /* [70] */ INVALID
, INVALID
, INVALID
, INVALID
,
1113 /* [74] */ INVALID
, INVALID
, INVALID
, INVALID
,
1114 /* [78] */ INVALID
, INVALID
, INVALID
, INVALID
,
1115 /* [7C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1117 /* [80] */ INVALID
, INVALID
, INVALID
, INVALID
,
1118 /* [84] */ INVALID
, INVALID
, INVALID
, INVALID
,
1119 /* [88] */ INVALID
, INVALID
, INVALID
, INVALID
,
1120 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1122 /* [90] */ INVALID
, INVALID
, INVALID
, INVALID
,
1123 /* [94] */ INVALID
, INVALID
, INVALID
, INVALID
,
1124 /* [98] */ INVALID
, INVALID
, INVALID
, INVALID
,
1125 /* [9C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1127 /* [A0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1128 /* [A4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1129 /* [A8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1130 /* [AC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1132 /* [B0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1133 /* [B4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1134 /* [B8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1135 /* [BC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1137 /* [C0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1138 /* [C4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1139 /* [C8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1140 /* [CC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1142 /* [D0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1143 /* [D4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1144 /* [D8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1145 /* [DC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1147 /* [E0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1148 /* [E4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1149 /* [E8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1150 /* [EC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1152 /* [F0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1153 /* [F4] */ INVALID
, TNSZvr("pdep",VEX_RMrX
,5),TNSZvr("mulx",VEX_RMrX
,5),TNSZvr("shrx",VEX_VRMrX
,5),
1154 /* [F8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1155 /* [FC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1158 const instable_t dis_opAVXF30F38
[256] = {
1159 /* [00] */ INVALID
, INVALID
, INVALID
, INVALID
,
1160 /* [04] */ INVALID
, INVALID
, INVALID
, INVALID
,
1161 /* [08] */ INVALID
, INVALID
, INVALID
, INVALID
,
1162 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1164 /* [10] */ INVALID
, INVALID
, INVALID
, INVALID
,
1165 /* [14] */ INVALID
, INVALID
, INVALID
, INVALID
,
1166 /* [18] */ INVALID
, INVALID
, INVALID
, INVALID
,
1167 /* [1C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1169 /* [20] */ INVALID
, INVALID
, INVALID
, INVALID
,
1170 /* [24] */ INVALID
, INVALID
, INVALID
, INVALID
,
1171 /* [28] */ INVALID
, INVALID
, INVALID
, INVALID
,
1172 /* [2C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1174 /* [30] */ INVALID
, INVALID
, INVALID
, INVALID
,
1175 /* [34] */ INVALID
, INVALID
, INVALID
, INVALID
,
1176 /* [38] */ INVALID
, INVALID
, INVALID
, INVALID
,
1177 /* [3C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1179 /* [40] */ INVALID
, INVALID
, INVALID
, INVALID
,
1180 /* [44] */ INVALID
, INVALID
, INVALID
, INVALID
,
1181 /* [48] */ INVALID
, INVALID
, INVALID
, INVALID
,
1182 /* [4C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1184 /* [50] */ INVALID
, INVALID
, INVALID
, INVALID
,
1185 /* [54] */ INVALID
, INVALID
, INVALID
, INVALID
,
1186 /* [58] */ INVALID
, INVALID
, INVALID
, INVALID
,
1187 /* [5C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1189 /* [60] */ INVALID
, INVALID
, INVALID
, INVALID
,
1190 /* [64] */ INVALID
, INVALID
, INVALID
, INVALID
,
1191 /* [68] */ INVALID
, INVALID
, INVALID
, INVALID
,
1192 /* [6C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1194 /* [70] */ INVALID
, INVALID
, INVALID
, INVALID
,
1195 /* [74] */ INVALID
, INVALID
, INVALID
, INVALID
,
1196 /* [78] */ INVALID
, INVALID
, INVALID
, INVALID
,
1197 /* [7C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1199 /* [80] */ INVALID
, INVALID
, INVALID
, INVALID
,
1200 /* [84] */ INVALID
, INVALID
, INVALID
, INVALID
,
1201 /* [88] */ INVALID
, INVALID
, INVALID
, INVALID
,
1202 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1204 /* [90] */ INVALID
, INVALID
, INVALID
, INVALID
,
1205 /* [94] */ INVALID
, INVALID
, INVALID
, INVALID
,
1206 /* [98] */ INVALID
, INVALID
, INVALID
, INVALID
,
1207 /* [9C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1209 /* [A0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1210 /* [A4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1211 /* [A8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1212 /* [AC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1214 /* [B0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1215 /* [B4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1216 /* [B8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1217 /* [BC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1219 /* [C0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1220 /* [C4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1221 /* [C8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1222 /* [CC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1224 /* [D0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1225 /* [D4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1226 /* [D8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1227 /* [DC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1229 /* [E0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1230 /* [E4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1231 /* [E8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1232 /* [EC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1234 /* [F0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1235 /* [F4] */ INVALID
, TNSZvr("pext",VEX_RMrX
,5),INVALID
, TNSZvr("sarx",VEX_VRMrX
,5),
1236 /* [F8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1237 /* [FC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1240 * Decode table for SIMD instructions with the repz (0xf3) prefix.
1242 const instable_t dis_opSIMDrepz
[256] = {
1243 /* [00] */ INVALID
, INVALID
, INVALID
, INVALID
,
1244 /* [04] */ INVALID
, INVALID
, INVALID
, INVALID
,
1245 /* [08] */ INVALID
, INVALID
, INVALID
, INVALID
,
1246 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1248 /* [10] */ TNSZ("movss",XMM
,4), TNSZ("movss",XMMS
,4), TNSZ("movsldup",XMM
,16),INVALID
,
1249 /* [14] */ INVALID
, INVALID
, TNSZ("movshdup",XMM
,16),INVALID
,
1250 /* [18] */ INVALID
, INVALID
, INVALID
, INVALID
,
1251 /* [1C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1253 /* [20] */ INVALID
, INVALID
, INVALID
, INVALID
,
1254 /* [24] */ INVALID
, INVALID
, INVALID
, INVALID
,
1255 /* [28] */ INVALID
, INVALID
, TNSZ("cvtsi2ss",XMM3MX
,4),TNSZ("movntss",XMMMS
,4),
1256 /* [2C] */ TNSZ("cvttss2si",XMMXM3
,4),TNSZ("cvtss2si",XMMXM3
,4),INVALID
, INVALID
,
1258 /* [30] */ INVALID
, INVALID
, INVALID
, INVALID
,
1259 /* [34] */ INVALID
, INVALID
, INVALID
, INVALID
,
1260 /* [38] */ INVALID
, INVALID
, INVALID
, INVALID
,
1261 /* [3C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1263 /* [40] */ INVALID
, INVALID
, INVALID
, INVALID
,
1264 /* [44] */ INVALID
, INVALID
, INVALID
, INVALID
,
1265 /* [48] */ INVALID
, INVALID
, INVALID
, INVALID
,
1266 /* [4C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1268 /* [50] */ INVALID
, TNSZ("sqrtss",XMM
,4), TNSZ("rsqrtss",XMM
,4), TNSZ("rcpss",XMM
,4),
1269 /* [54] */ INVALID
, INVALID
, INVALID
, INVALID
,
1270 /* [58] */ TNSZ("addss",XMM
,4), TNSZ("mulss",XMM
,4), TNSZ("cvtss2sd",XMM
,4), TNSZ("cvttps2dq",XMM
,16),
1271 /* [5C] */ TNSZ("subss",XMM
,4), TNSZ("minss",XMM
,4), TNSZ("divss",XMM
,4), TNSZ("maxss",XMM
,4),
1273 /* [60] */ INVALID
, INVALID
, INVALID
, INVALID
,
1274 /* [64] */ INVALID
, INVALID
, INVALID
, INVALID
,
1275 /* [68] */ INVALID
, INVALID
, INVALID
, INVALID
,
1276 /* [6C] */ INVALID
, INVALID
, INVALID
, TNSZ("movdqu",XMM
,16),
1278 /* [70] */ TNSZ("pshufhw",XMMP
,16),INVALID
, INVALID
, INVALID
,
1279 /* [74] */ INVALID
, INVALID
, INVALID
, INVALID
,
1280 /* [78] */ INVALID
, INVALID
, INVALID
, INVALID
,
1281 /* [7C] */ INVALID
, INVALID
, TNSZ("movq",XMM
,8), TNSZ("movdqu",XMMS
,16),
1283 /* [80] */ INVALID
, INVALID
, INVALID
, INVALID
,
1284 /* [84] */ INVALID
, INVALID
, INVALID
, INVALID
,
1285 /* [88] */ INVALID
, INVALID
, INVALID
, INVALID
,
1286 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1288 /* [90] */ INVALID
, INVALID
, INVALID
, INVALID
,
1289 /* [94] */ INVALID
, INVALID
, INVALID
, INVALID
,
1290 /* [98] */ INVALID
, INVALID
, INVALID
, INVALID
,
1291 /* [9C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1293 /* [A0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1294 /* [A4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1295 /* [A8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1296 /* [AC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1298 /* [B0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1299 /* [B4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1300 /* [B8] */ TS("popcnt",MRw
), INVALID
, INVALID
, INVALID
,
1301 /* [BC] */ TNSZ("tzcnt",MRw
,5), TS("lzcnt",MRw
), INVALID
, INVALID
,
1303 /* [C0] */ INVALID
, INVALID
, TNSZ("cmpss",XMMP
,4), INVALID
,
1304 /* [C4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1305 /* [C8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1306 /* [CC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1308 /* [D0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1309 /* [D4] */ INVALID
, INVALID
, TNS("movq2dq",XMMMX
), INVALID
,
1310 /* [D8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1311 /* [DC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1313 /* [E0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1314 /* [E4] */ INVALID
, INVALID
, TNSZ("cvtdq2pd",XMM
,8), INVALID
,
1315 /* [E8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1316 /* [EC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1318 /* [F0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1319 /* [F4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1320 /* [F8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1321 /* [FC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1324 const instable_t dis_opAVXF30F
[256] = {
1325 /* [00] */ INVALID
, INVALID
, INVALID
, INVALID
,
1326 /* [04] */ INVALID
, INVALID
, INVALID
, INVALID
,
1327 /* [08] */ INVALID
, INVALID
, INVALID
, INVALID
,
1328 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1330 /* [10] */ TNSZ("vmovss",VEX_RMrX
,4), TNSZ("vmovss",VEX_RRX
,4), TNSZ("vmovsldup",VEX_MX
,4), INVALID
,
1331 /* [14] */ INVALID
, INVALID
, TNSZ("vmovshdup",VEX_MX
,4), INVALID
,
1332 /* [18] */ INVALID
, INVALID
, INVALID
, INVALID
,
1333 /* [1C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1335 /* [20] */ INVALID
, INVALID
, INVALID
, INVALID
,
1336 /* [24] */ INVALID
, INVALID
, INVALID
, INVALID
,
1337 /* [28] */ INVALID
, INVALID
, TNSZ("vcvtsi2ss",VEX_RMrX
,4),INVALID
,
1338 /* [2C] */ TNSZ("vcvttss2si",VEX_MR
,4),TNSZ("vcvtss2si",VEX_MR
,4),INVALID
, INVALID
,
1340 /* [30] */ INVALID
, INVALID
, INVALID
, INVALID
,
1341 /* [34] */ INVALID
, INVALID
, INVALID
, INVALID
,
1342 /* [38] */ INVALID
, INVALID
, INVALID
, INVALID
,
1343 /* [3C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1345 /* [40] */ INVALID
, INVALID
, INVALID
, INVALID
,
1346 /* [44] */ INVALID
, INVALID
, INVALID
, INVALID
,
1347 /* [48] */ INVALID
, INVALID
, INVALID
, INVALID
,
1348 /* [4C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1350 /* [50] */ INVALID
, TNSZ("vsqrtss",VEX_RMrX
,4), TNSZ("vrsqrtss",VEX_RMrX
,4), TNSZ("vrcpss",VEX_RMrX
,4),
1351 /* [54] */ INVALID
, INVALID
, INVALID
, INVALID
,
1352 /* [58] */ TNSZ("vaddss",VEX_RMrX
,4), TNSZ("vmulss",VEX_RMrX
,4), TNSZ("vcvtss2sd",VEX_RMrX
,4), TNSZ("vcvttps2dq",VEX_MX
,16),
1353 /* [5C] */ TNSZ("vsubss",VEX_RMrX
,4), TNSZ("vminss",VEX_RMrX
,4), TNSZ("vdivss",VEX_RMrX
,4), TNSZ("vmaxss",VEX_RMrX
,4),
1355 /* [60] */ INVALID
, INVALID
, INVALID
, INVALID
,
1356 /* [64] */ INVALID
, INVALID
, INVALID
, INVALID
,
1357 /* [68] */ INVALID
, INVALID
, INVALID
, INVALID
,
1358 /* [6C] */ INVALID
, INVALID
, INVALID
, TNSZ("vmovdqu",VEX_MX
,16),
1360 /* [70] */ TNSZ("vpshufhw",VEX_MXI
,16),INVALID
, INVALID
, INVALID
,
1361 /* [74] */ INVALID
, INVALID
, INVALID
, INVALID
,
1362 /* [78] */ INVALID
, INVALID
, INVALID
, INVALID
,
1363 /* [7C] */ INVALID
, INVALID
, TNSZ("vmovq",VEX_MX
,8), TNSZ("vmovdqu",VEX_RX
,16),
1365 /* [80] */ INVALID
, INVALID
, INVALID
, INVALID
,
1366 /* [84] */ INVALID
, INVALID
, INVALID
, INVALID
,
1367 /* [88] */ INVALID
, INVALID
, INVALID
, INVALID
,
1368 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1370 /* [90] */ INVALID
, INVALID
, INVALID
, INVALID
,
1371 /* [94] */ INVALID
, INVALID
, INVALID
, INVALID
,
1372 /* [98] */ INVALID
, INVALID
, INVALID
, INVALID
,
1373 /* [9C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1375 /* [A0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1376 /* [A4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1377 /* [A8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1378 /* [AC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1380 /* [B0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1381 /* [B4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1382 /* [B8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1383 /* [BC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1385 /* [C0] */ INVALID
, INVALID
, TNSZ("vcmpss",VEX_RMRX
,4), INVALID
,
1386 /* [C4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1387 /* [C8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1388 /* [CC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1390 /* [D0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1391 /* [D4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1392 /* [D8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1393 /* [DC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1395 /* [E0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1396 /* [E4] */ INVALID
, INVALID
, TNSZ("vcvtdq2pd",VEX_MX
,8), INVALID
,
1397 /* [E8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1398 /* [EC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1400 /* [F0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1401 /* [F4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1402 /* [F8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1403 /* [FC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1406 * The following two tables are used to encode crc32 and movbe
1407 * since they share the same opcodes.
1409 const instable_t dis_op0F38F0
[2] = {
1410 /* [00] */ TNS("crc32b",CRC32
),
1414 const instable_t dis_op0F38F1
[2] = {
1415 /* [00] */ TS("crc32",CRC32
),
1420 * The following table is used to distinguish between adox and adcx which share
1423 const instable_t dis_op0F38F6
[2] = {
1424 /* [00] */ TNS("adcx",ADX
),
1428 const instable_t dis_op0F38
[256] = {
1429 /* [00] */ TNSZ("pshufb",XMM_66o
,16),TNSZ("phaddw",XMM_66o
,16),TNSZ("phaddd",XMM_66o
,16),TNSZ("phaddsw",XMM_66o
,16),
1430 /* [04] */ TNSZ("pmaddubsw",XMM_66o
,16),TNSZ("phsubw",XMM_66o
,16), TNSZ("phsubd",XMM_66o
,16),TNSZ("phsubsw",XMM_66o
,16),
1431 /* [08] */ TNSZ("psignb",XMM_66o
,16),TNSZ("psignw",XMM_66o
,16),TNSZ("psignd",XMM_66o
,16),TNSZ("pmulhrsw",XMM_66o
,16),
1432 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1434 /* [10] */ TNSZ("pblendvb",XMM_66r
,16),INVALID
, INVALID
, INVALID
,
1435 /* [14] */ TNSZ("blendvps",XMM_66r
,16),TNSZ("blendvpd",XMM_66r
,16),INVALID
, TNSZ("ptest",XMM_66r
,16),
1436 /* [18] */ INVALID
, INVALID
, INVALID
, INVALID
,
1437 /* [1C] */ TNSZ("pabsb",XMM_66o
,16),TNSZ("pabsw",XMM_66o
,16),TNSZ("pabsd",XMM_66o
,16),INVALID
,
1439 /* [20] */ TNSZ("pmovsxbw",XMM_66r
,16),TNSZ("pmovsxbd",XMM_66r
,16),TNSZ("pmovsxbq",XMM_66r
,16),TNSZ("pmovsxwd",XMM_66r
,16),
1440 /* [24] */ TNSZ("pmovsxwq",XMM_66r
,16),TNSZ("pmovsxdq",XMM_66r
,16),INVALID
, INVALID
,
1441 /* [28] */ TNSZ("pmuldq",XMM_66r
,16),TNSZ("pcmpeqq",XMM_66r
,16),TNSZ("movntdqa",XMMM_66r
,16),TNSZ("packusdw",XMM_66r
,16),
1442 /* [2C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1444 /* [30] */ TNSZ("pmovzxbw",XMM_66r
,16),TNSZ("pmovzxbd",XMM_66r
,16),TNSZ("pmovzxbq",XMM_66r
,16),TNSZ("pmovzxwd",XMM_66r
,16),
1445 /* [34] */ TNSZ("pmovzxwq",XMM_66r
,16),TNSZ("pmovzxdq",XMM_66r
,16),INVALID
, TNSZ("pcmpgtq",XMM_66r
,16),
1446 /* [38] */ TNSZ("pminsb",XMM_66r
,16),TNSZ("pminsd",XMM_66r
,16),TNSZ("pminuw",XMM_66r
,16),TNSZ("pminud",XMM_66r
,16),
1447 /* [3C] */ TNSZ("pmaxsb",XMM_66r
,16),TNSZ("pmaxsd",XMM_66r
,16),TNSZ("pmaxuw",XMM_66r
,16),TNSZ("pmaxud",XMM_66r
,16),
1449 /* [40] */ TNSZ("pmulld",XMM_66r
,16),TNSZ("phminposuw",XMM_66r
,16),INVALID
, INVALID
,
1450 /* [44] */ INVALID
, INVALID
, INVALID
, INVALID
,
1451 /* [48] */ INVALID
, INVALID
, INVALID
, INVALID
,
1452 /* [4C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1454 /* [50] */ INVALID
, INVALID
, INVALID
, INVALID
,
1455 /* [54] */ INVALID
, INVALID
, INVALID
, INVALID
,
1456 /* [58] */ INVALID
, INVALID
, INVALID
, INVALID
,
1457 /* [5C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1459 /* [60] */ INVALID
, INVALID
, INVALID
, INVALID
,
1460 /* [64] */ INVALID
, INVALID
, INVALID
, INVALID
,
1461 /* [68] */ INVALID
, INVALID
, INVALID
, INVALID
,
1462 /* [6C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1464 /* [70] */ INVALID
, INVALID
, INVALID
, INVALID
,
1465 /* [74] */ INVALID
, INVALID
, INVALID
, INVALID
,
1466 /* [78] */ INVALID
, INVALID
, INVALID
, INVALID
,
1467 /* [7C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1469 /* [80] */ TNSy("invept", RM_66r
), TNSy("invvpid", RM_66r
),TNSy("invpcid", RM_66r
),INVALID
,
1470 /* [84] */ INVALID
, INVALID
, INVALID
, INVALID
,
1471 /* [88] */ INVALID
, INVALID
, INVALID
, INVALID
,
1472 /* [8C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1474 /* [90] */ INVALID
, INVALID
, INVALID
, INVALID
,
1475 /* [94] */ INVALID
, INVALID
, INVALID
, INVALID
,
1476 /* [98] */ INVALID
, INVALID
, INVALID
, INVALID
,
1477 /* [9C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1479 /* [A0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1480 /* [A4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1481 /* [A8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1482 /* [AC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1484 /* [B0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1485 /* [B4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1486 /* [B8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1487 /* [BC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1489 /* [C0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1490 /* [C4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1491 /* [C8] */ TNSZ("sha1nexte",XMM
,16),TNSZ("sha1msg1",XMM
,16),TNSZ("sha1msg2",XMM
,16),TNSZ("sha256rnds2",XMM
,16),
1492 /* [CC] */ TNSZ("sha256msg1",XMM
,16),TNSZ("sha256msg2",XMM
,16),INVALID
, INVALID
,
1494 /* [D0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1495 /* [D4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1496 /* [D8] */ INVALID
, INVALID
, INVALID
, TNSZ("aesimc",XMM_66r
,16),
1497 /* [DC] */ TNSZ("aesenc",XMM_66r
,16),TNSZ("aesenclast",XMM_66r
,16),TNSZ("aesdec",XMM_66r
,16),TNSZ("aesdeclast",XMM_66r
,16),
1499 /* [E0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1500 /* [E4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1501 /* [E8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1502 /* [EC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1503 /* [F0] */ IND(dis_op0F38F0
), IND(dis_op0F38F1
), INVALID
, INVALID
,
1504 /* [F4] */ INVALID
, INVALID
, IND(dis_op0F38F6
), INVALID
,
1505 /* [F8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1506 /* [FC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1509 const instable_t dis_opAVX660F38
[256] = {
1510 /* [00] */ TNSZ("vpshufb",VEX_RMrX
,16),TNSZ("vphaddw",VEX_RMrX
,16),TNSZ("vphaddd",VEX_RMrX
,16),TNSZ("vphaddsw",VEX_RMrX
,16),
1511 /* [04] */ TNSZ("vpmaddubsw",VEX_RMrX
,16),TNSZ("vphsubw",VEX_RMrX
,16), TNSZ("vphsubd",VEX_RMrX
,16),TNSZ("vphsubsw",VEX_RMrX
,16),
1512 /* [08] */ TNSZ("vpsignb",VEX_RMrX
,16),TNSZ("vpsignw",VEX_RMrX
,16),TNSZ("vpsignd",VEX_RMrX
,16),TNSZ("vpmulhrsw",VEX_RMrX
,16),
1513 /* [0C] */ TNSZ("vpermilps",VEX_RMrX
,8),TNSZ("vpermilpd",VEX_RMrX
,16),TNSZ("vtestps",VEX_RRI
,8), TNSZ("vtestpd",VEX_RRI
,16),
1515 /* [10] */ INVALID
, INVALID
, INVALID
, TNSZ("vcvtph2ps",VEX_MX
,16),
1516 /* [14] */ INVALID
, INVALID
, TNSZ("vpermps",VEX_RMrX
,16),TNSZ("vptest",VEX_RRI
,16),
1517 /* [18] */ TNSZ("vbroadcastss",VEX_MX
,4),TNSZ("vbroadcastsd",VEX_MX
,8),TNSZ("vbroadcastf128",VEX_MX
,16),INVALID
,
1518 /* [1C] */ TNSZ("vpabsb",VEX_MX
,16),TNSZ("vpabsw",VEX_MX
,16),TNSZ("vpabsd",VEX_MX
,16),INVALID
,
1520 /* [20] */ TNSZ("vpmovsxbw",VEX_MX
,16),TNSZ("vpmovsxbd",VEX_MX
,16),TNSZ("vpmovsxbq",VEX_MX
,16),TNSZ("vpmovsxwd",VEX_MX
,16),
1521 /* [24] */ TNSZ("vpmovsxwq",VEX_MX
,16),TNSZ("vpmovsxdq",VEX_MX
,16),INVALID
, INVALID
,
1522 /* [28] */ TNSZ("vpmuldq",VEX_RMrX
,16),TNSZ("vpcmpeqq",VEX_RMrX
,16),TNSZ("vmovntdqa",VEX_MX
,16),TNSZ("vpackusdw",VEX_RMrX
,16),
1523 /* [2C] */ TNSZ("vmaskmovps",VEX_RMrX
,8),TNSZ("vmaskmovpd",VEX_RMrX
,16),TNSZ("vmaskmovps",VEX_RRM
,8),TNSZ("vmaskmovpd",VEX_RRM
,16),
1525 /* [30] */ TNSZ("vpmovzxbw",VEX_MX
,16),TNSZ("vpmovzxbd",VEX_MX
,16),TNSZ("vpmovzxbq",VEX_MX
,16),TNSZ("vpmovzxwd",VEX_MX
,16),
1526 /* [34] */ TNSZ("vpmovzxwq",VEX_MX
,16),TNSZ("vpmovzxdq",VEX_MX
,16),TNSZ("vpermd",VEX_RMrX
,16),TNSZ("vpcmpgtq",VEX_RMrX
,16),
1527 /* [38] */ TNSZ("vpminsb",VEX_RMrX
,16),TNSZ("vpminsd",VEX_RMrX
,16),TNSZ("vpminuw",VEX_RMrX
,16),TNSZ("vpminud",VEX_RMrX
,16),
1528 /* [3C] */ TNSZ("vpmaxsb",VEX_RMrX
,16),TNSZ("vpmaxsd",VEX_RMrX
,16),TNSZ("vpmaxuw",VEX_RMrX
,16),TNSZ("vpmaxud",VEX_RMrX
,16),
1530 /* [40] */ TNSZ("vpmulld",VEX_RMrX
,16),TNSZ("vphminposuw",VEX_MX
,16),INVALID
, INVALID
,
1531 /* [44] */ INVALID
, TSaZ("vpsrlv",VEX_RMrX
,16),TNSZ("vpsravd",VEX_RMrX
,16),TSaZ("vpsllv",VEX_RMrX
,16),
1532 /* [48] */ INVALID
, INVALID
, INVALID
, INVALID
,
1533 /* [4C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1535 /* [50] */ INVALID
, INVALID
, INVALID
, INVALID
,
1536 /* [54] */ INVALID
, INVALID
, INVALID
, INVALID
,
1537 /* [58] */ TNSZ("vpbroadcastd",VEX_MX
,16),TNSZ("vpbroadcastq",VEX_MX
,16),TNSZ("vbroadcasti128",VEX_MX
,16),INVALID
,
1538 /* [5C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1540 /* [60] */ INVALID
, INVALID
, INVALID
, INVALID
,
1541 /* [64] */ INVALID
, INVALID
, INVALID
, INVALID
,
1542 /* [68] */ INVALID
, INVALID
, INVALID
, INVALID
,
1543 /* [6C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1545 /* [70] */ INVALID
, INVALID
, INVALID
, INVALID
,
1546 /* [74] */ INVALID
, INVALID
, INVALID
, INVALID
,
1547 /* [78] */ TNSZ("vpbroadcastb",VEX_MX
,16),TNSZ("vpbroadcastw",VEX_MX
,16),INVALID
, INVALID
,
1548 /* [7C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1550 /* [80] */ INVALID
, INVALID
, INVALID
, INVALID
,
1551 /* [84] */ INVALID
, INVALID
, INVALID
, INVALID
,
1552 /* [88] */ INVALID
, INVALID
, INVALID
, INVALID
,
1553 /* [8C] */ TSaZ("vpmaskmov",VEX_RMrX
,16),INVALID
, TSaZ("vpmaskmov",VEX_RRM
,16),INVALID
,
1555 /* [90] */ TNSZ("vpgatherd",VEX_SbVM
,16),TNSZ("vpgatherq",VEX_SbVM
,16),TNSZ("vgatherdp",VEX_SbVM
,16),TNSZ("vgatherqp",VEX_SbVM
,16),
1556 /* [94] */ INVALID
, INVALID
, TNSZ("vfmaddsub132p",FMA
,16),TNSZ("vfmsubadd132p",FMA
,16),
1557 /* [98] */ TNSZ("vfmadd132p",FMA
,16),TNSZ("vfmadd132s",FMA
,16),TNSZ("vfmsub132p",FMA
,16),TNSZ("vfmsub132s",FMA
,16),
1558 /* [9C] */ TNSZ("vfnmadd132p",FMA
,16),TNSZ("vfnmadd132s",FMA
,16),TNSZ("vfnmsub132p",FMA
,16),TNSZ("vfnmsub132s",FMA
,16),
1560 /* [A0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1561 /* [A4] */ INVALID
, INVALID
, TNSZ("vfmaddsub213p",FMA
,16),TNSZ("vfmsubadd213p",FMA
,16),
1562 /* [A8] */ TNSZ("vfmadd213p",FMA
,16),TNSZ("vfmadd213s",FMA
,16),TNSZ("vfmsub213p",FMA
,16),TNSZ("vfmsub213s",FMA
,16),
1563 /* [AC] */ TNSZ("vfnmadd213p",FMA
,16),TNSZ("vfnmadd213s",FMA
,16),TNSZ("vfnmsub213p",FMA
,16),TNSZ("vfnmsub213s",FMA
,16),
1565 /* [B0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1566 /* [B4] */ INVALID
, INVALID
, TNSZ("vfmaddsub231p",FMA
,16),TNSZ("vfmsubadd231p",FMA
,16),
1567 /* [B8] */ TNSZ("vfmadd231p",FMA
,16),TNSZ("vfmadd231s",FMA
,16),TNSZ("vfmsub231p",FMA
,16),TNSZ("vfmsub231s",FMA
,16),
1568 /* [BC] */ TNSZ("vfnmadd231p",FMA
,16),TNSZ("vfnmadd231s",FMA
,16),TNSZ("vfnmsub231p",FMA
,16),TNSZ("vfnmsub231s",FMA
,16),
1570 /* [C0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1571 /* [C4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1572 /* [C8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1573 /* [CC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1575 /* [D0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1576 /* [D4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1577 /* [D8] */ INVALID
, INVALID
, INVALID
, TNSZ("vaesimc",VEX_MX
,16),
1578 /* [DC] */ TNSZ("vaesenc",VEX_RMrX
,16),TNSZ("vaesenclast",VEX_RMrX
,16),TNSZ("vaesdec",VEX_RMrX
,16),TNSZ("vaesdeclast",VEX_RMrX
,16),
1580 /* [E0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1581 /* [E4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1582 /* [E8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1583 /* [EC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1584 /* [F0] */ IND(dis_op0F38F0
), IND(dis_op0F38F1
), INVALID
, INVALID
,
1585 /* [F4] */ INVALID
, INVALID
, INVALID
, TNSZvr("shlx",VEX_VRMrX
,5),
1586 /* [F8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1587 /* [FC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1590 const instable_t dis_op0F3A
[256] = {
1591 /* [00] */ INVALID
, INVALID
, INVALID
, INVALID
,
1592 /* [04] */ INVALID
, INVALID
, INVALID
, INVALID
,
1593 /* [08] */ TNSZ("roundps",XMMP_66r
,16),TNSZ("roundpd",XMMP_66r
,16),TNSZ("roundss",XMMP_66r
,16),TNSZ("roundsd",XMMP_66r
,16),
1594 /* [0C] */ TNSZ("blendps",XMMP_66r
,16),TNSZ("blendpd",XMMP_66r
,16),TNSZ("pblendw",XMMP_66r
,16),TNSZ("palignr",XMMP_66o
,16),
1596 /* [10] */ INVALID
, INVALID
, INVALID
, INVALID
,
1597 /* [14] */ TNSZ("pextrb",XMM3PM_66r
,8),TNSZ("pextrw",XMM3PM_66r
,16),TSZ("pextr",XMM3PM_66r
,16),TNSZ("extractps",XMM3PM_66r
,16),
1598 /* [18] */ INVALID
, INVALID
, INVALID
, INVALID
,
1599 /* [1C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1601 /* [20] */ TNSZ("pinsrb",XMMPRM_66r
,8),TNSZ("insertps",XMMP_66r
,16),TSZ("pinsr",XMMPRM_66r
,16),INVALID
,
1602 /* [24] */ INVALID
, INVALID
, INVALID
, INVALID
,
1603 /* [28] */ INVALID
, INVALID
, INVALID
, INVALID
,
1604 /* [2C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1606 /* [30] */ INVALID
, INVALID
, INVALID
, INVALID
,
1607 /* [34] */ INVALID
, INVALID
, INVALID
, INVALID
,
1608 /* [38] */ INVALID
, INVALID
, INVALID
, INVALID
,
1609 /* [3C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1611 /* [40] */ TNSZ("dpps",XMMP_66r
,16),TNSZ("dppd",XMMP_66r
,16),TNSZ("mpsadbw",XMMP_66r
,16),INVALID
,
1612 /* [44] */ TNSZ("pclmulqdq",XMMP_66r
,16),INVALID
, INVALID
, INVALID
,
1613 /* [48] */ INVALID
, INVALID
, INVALID
, INVALID
,
1614 /* [4C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1616 /* [50] */ INVALID
, INVALID
, INVALID
, INVALID
,
1617 /* [54] */ INVALID
, INVALID
, INVALID
, INVALID
,
1618 /* [58] */ INVALID
, INVALID
, INVALID
, INVALID
,
1619 /* [5C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1621 /* [60] */ TNSZ("pcmpestrm",XMMP_66r
,16),TNSZ("pcmpestri",XMMP_66r
,16),TNSZ("pcmpistrm",XMMP_66r
,16),TNSZ("pcmpistri",XMMP_66r
,16),
1622 /* [64] */ INVALID
, INVALID
, INVALID
, INVALID
,
1623 /* [68] */ INVALID
, INVALID
, INVALID
, INVALID
,
1624 /* [6C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1626 /* [70] */ INVALID
, INVALID
, INVALID
, INVALID
,
1627 /* [74] */ INVALID
, INVALID
, INVALID
, INVALID
,
1628 /* [78] */ INVALID
, INVALID
, INVALID
, INVALID
,
1629 /* [7C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1631 /* [80] */ INVALID
, INVALID
, INVALID
, INVALID
,
1632 /* [84] */ INVALID
, INVALID
, INVALID
, INVALID
,
1633 /* [88] */ INVALID
, INVALID
, INVALID
, INVALID
,
1634 /* [8C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1636 /* [90] */ INVALID
, INVALID
, INVALID
, INVALID
,
1637 /* [94] */ INVALID
, INVALID
, INVALID
, INVALID
,
1638 /* [98] */ INVALID
, INVALID
, INVALID
, INVALID
,
1639 /* [9C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1641 /* [A0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1642 /* [A4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1643 /* [A8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1644 /* [AC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1646 /* [B0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1647 /* [B4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1648 /* [B8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1649 /* [BC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1651 /* [C0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1652 /* [C4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1653 /* [C8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1654 /* [CC] */ TNSZ("sha1rnds4",XMMP
,16),INVALID
, INVALID
, INVALID
,
1656 /* [D0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1657 /* [D4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1658 /* [D8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1659 /* [DC] */ INVALID
, INVALID
, INVALID
, TNSZ("aeskeygenassist",XMMP_66r
,16),
1661 /* [E0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1662 /* [E4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1663 /* [E8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1664 /* [EC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1666 /* [F0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1667 /* [F4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1668 /* [F8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1669 /* [FC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1672 const instable_t dis_opAVX660F3A
[256] = {
1673 /* [00] */ TNSZ("vpermq",VEX_MXI
,16),TNSZ("vpermpd",VEX_MXI
,16),TNSZ("vpblendd",VEX_RMRX
,16),INVALID
,
1674 /* [04] */ TNSZ("vpermilps",VEX_MXI
,8),TNSZ("vpermilpd",VEX_MXI
,16),TNSZ("vperm2f128",VEX_RMRX
,16),INVALID
,
1675 /* [08] */ TNSZ("vroundps",VEX_MXI
,16),TNSZ("vroundpd",VEX_MXI
,16),TNSZ("vroundss",VEX_RMRX
,16),TNSZ("vroundsd",VEX_RMRX
,16),
1676 /* [0C] */ TNSZ("vblendps",VEX_RMRX
,16),TNSZ("vblendpd",VEX_RMRX
,16),TNSZ("vpblendw",VEX_RMRX
,16),TNSZ("vpalignr",VEX_RMRX
,16),
1678 /* [10] */ INVALID
, INVALID
, INVALID
, INVALID
,
1679 /* [14] */ TNSZ("vpextrb",VEX_RRi
,8),TNSZ("vpextrw",VEX_RRi
,16),TNSZ("vpextrd",VEX_RRi
,16),TNSZ("vextractps",VEX_RM
,16),
1680 /* [18] */ TNSZ("vinsertf128",VEX_RMRX
,16),TNSZ("vextractf128",VEX_RX
,16),INVALID
, INVALID
,
1681 /* [1C] */ INVALID
, TNSZ("vcvtps2ph",VEX_RX
,16), INVALID
, INVALID
,
1683 /* [20] */ TNSZ("vpinsrb",VEX_RMRX
,8),TNSZ("vinsertps",VEX_RMRX
,16),TNSZ("vpinsrd",VEX_RMRX
,16),INVALID
,
1684 /* [24] */ INVALID
, INVALID
, INVALID
, INVALID
,
1685 /* [28] */ INVALID
, INVALID
, INVALID
, INVALID
,
1686 /* [2C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1688 /* [30] */ INVALID
, INVALID
, INVALID
, INVALID
,
1689 /* [34] */ INVALID
, INVALID
, INVALID
, INVALID
,
1690 /* [38] */ TNSZ("vinserti128",VEX_RMRX
,16),TNSZ("vextracti128",VEX_RIM
,16),INVALID
, INVALID
,
1691 /* [3C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1693 /* [40] */ TNSZ("vdpps",VEX_RMRX
,16),TNSZ("vdppd",VEX_RMRX
,16),TNSZ("vmpsadbw",VEX_RMRX
,16),INVALID
,
1694 /* [44] */ TNSZ("vpclmulqdq",VEX_RMRX
,16),INVALID
, TNSZ("vperm2i128",VEX_RMRX
,16),INVALID
,
1695 /* [48] */ INVALID
, INVALID
, TNSZ("vblendvps",VEX_RMRX
,8), TNSZ("vblendvpd",VEX_RMRX
,16),
1696 /* [4C] */ TNSZ("vpblendvb",VEX_RMRX
,16),INVALID
, INVALID
, INVALID
,
1698 /* [50] */ INVALID
, INVALID
, INVALID
, INVALID
,
1699 /* [54] */ INVALID
, INVALID
, INVALID
, INVALID
,
1700 /* [58] */ INVALID
, INVALID
, INVALID
, INVALID
,
1701 /* [5C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1703 /* [60] */ TNSZ("vpcmpestrm",VEX_MXI
,16),TNSZ("vpcmpestri",VEX_MXI
,16),TNSZ("vpcmpistrm",VEX_MXI
,16),TNSZ("vpcmpistri",VEX_MXI
,16),
1704 /* [64] */ INVALID
, INVALID
, INVALID
, INVALID
,
1705 /* [68] */ INVALID
, INVALID
, INVALID
, INVALID
,
1706 /* [6C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1708 /* [70] */ INVALID
, INVALID
, INVALID
, INVALID
,
1709 /* [74] */ INVALID
, INVALID
, INVALID
, INVALID
,
1710 /* [78] */ INVALID
, INVALID
, INVALID
, INVALID
,
1711 /* [7C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1713 /* [80] */ INVALID
, INVALID
, INVALID
, INVALID
,
1714 /* [84] */ INVALID
, INVALID
, INVALID
, INVALID
,
1715 /* [88] */ INVALID
, INVALID
, INVALID
, INVALID
,
1716 /* [8C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1718 /* [90] */ INVALID
, INVALID
, INVALID
, INVALID
,
1719 /* [94] */ INVALID
, INVALID
, INVALID
, INVALID
,
1720 /* [98] */ INVALID
, INVALID
, INVALID
, INVALID
,
1721 /* [9C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1723 /* [A0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1724 /* [A4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1725 /* [A8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1726 /* [AC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1728 /* [B0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1729 /* [B4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1730 /* [B8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1731 /* [BC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1733 /* [C0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1734 /* [C4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1735 /* [C8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1736 /* [CC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1738 /* [D0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1739 /* [D4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1740 /* [D8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1741 /* [DC] */ INVALID
, INVALID
, INVALID
, TNSZ("vaeskeygenassist",VEX_MXI
,16),
1743 /* [E0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1744 /* [E4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1745 /* [E8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1746 /* [EC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1748 /* [F0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1749 /* [F4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1750 /* [F8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1751 /* [FC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1755 * Decode table for 0x0F0D which uses the first byte of the mod_rm to
1756 * indicate a sub-code.
1758 const instable_t dis_op0F0D
[8] = {
1759 /* [00] */ INVALID
, TNS("prefetchw",PREF
), TNS("prefetchwt1",PREF
),INVALID
,
1760 /* [04] */ INVALID
, INVALID
, INVALID
, INVALID
,
1764 * Decode table for 0x0F opcodes
1767 const instable_t dis_op0F
[16][16] = {
1769 /* [00] */ IND(dis_op0F00
), IND(dis_op0F01
), TNS("lar",MR
), TNS("lsl",MR
),
1770 /* [04] */ INVALID
, TNS("syscall",NORM
), TNS("clts",NORM
), TNS("sysret",NORM
),
1771 /* [08] */ TNS("invd",NORM
), TNS("wbinvd",NORM
), INVALID
, TNS("ud2",NORM
),
1772 /* [0C] */ INVALID
, IND(dis_op0F0D
), INVALID
, INVALID
,
1774 /* [10] */ TNSZ("movups",XMMO
,16), TNSZ("movups",XMMOS
,16),TNSZ("movlps",XMMO
,8), TNSZ("movlps",XMMOS
,8),
1775 /* [14] */ TNSZ("unpcklps",XMMO
,16),TNSZ("unpckhps",XMMO
,16),TNSZ("movhps",XMMOM
,8),TNSZ("movhps",XMMOMS
,8),
1776 /* [18] */ IND(dis_op0F18
), INVALID
, INVALID
, INVALID
,
1777 /* [1C] */ INVALID
, INVALID
, INVALID
, TS("nop",Mw
),
1779 /* [20] */ TSy("mov",SREG
), TSy("mov",SREG
), TSy("mov",SREG
), TSy("mov",SREG
),
1780 /* [24] */ TSx("mov",SREG
), INVALID
, TSx("mov",SREG
), INVALID
,
1781 /* [28] */ TNSZ("movaps",XMMO
,16), TNSZ("movaps",XMMOS
,16),TNSZ("cvtpi2ps",XMMOMX
,8),TNSZ("movntps",XMMOS
,16),
1782 /* [2C] */ TNSZ("cvttps2pi",XMMOXMM
,8),TNSZ("cvtps2pi",XMMOXMM
,8),TNSZ("ucomiss",XMMO
,4),TNSZ("comiss",XMMO
,4),
1784 /* [30] */ TNS("wrmsr",NORM
), TNS("rdtsc",NORM
), TNS("rdmsr",NORM
), TNS("rdpmc",NORM
),
1785 /* [34] */ TNSx("sysenter",NORM
), TNSx("sysexit",NORM
), INVALID
, INVALID
,
1786 /* [38] */ INVALID
, INVALID
, INVALID
, INVALID
,
1787 /* [3C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1789 /* [40] */ TS("cmovx.o",MR
), TS("cmovx.no",MR
), TS("cmovx.b",MR
), TS("cmovx.ae",MR
),
1790 /* [44] */ TS("cmovx.e",MR
), TS("cmovx.ne",MR
), TS("cmovx.be",MR
), TS("cmovx.a",MR
),
1791 /* [48] */ TS("cmovx.s",MR
), TS("cmovx.ns",MR
), TS("cmovx.pe",MR
), TS("cmovx.po",MR
),
1792 /* [4C] */ TS("cmovx.l",MR
), TS("cmovx.ge",MR
), TS("cmovx.le",MR
), TS("cmovx.g",MR
),
1794 /* [50] */ TNS("movmskps",XMMOX3
), TNSZ("sqrtps",XMMO
,16), TNSZ("rsqrtps",XMMO
,16),TNSZ("rcpps",XMMO
,16),
1795 /* [54] */ TNSZ("andps",XMMO
,16), TNSZ("andnps",XMMO
,16), TNSZ("orps",XMMO
,16), TNSZ("xorps",XMMO
,16),
1796 /* [58] */ TNSZ("addps",XMMO
,16), TNSZ("mulps",XMMO
,16), TNSZ("cvtps2pd",XMMO
,8),TNSZ("cvtdq2ps",XMMO
,16),
1797 /* [5C] */ TNSZ("subps",XMMO
,16), TNSZ("minps",XMMO
,16), TNSZ("divps",XMMO
,16), TNSZ("maxps",XMMO
,16),
1799 /* [60] */ TNSZ("punpcklbw",MMO
,4),TNSZ("punpcklwd",MMO
,4),TNSZ("punpckldq",MMO
,4),TNSZ("packsswb",MMO
,8),
1800 /* [64] */ TNSZ("pcmpgtb",MMO
,8), TNSZ("pcmpgtw",MMO
,8), TNSZ("pcmpgtd",MMO
,8), TNSZ("packuswb",MMO
,8),
1801 /* [68] */ TNSZ("punpckhbw",MMO
,8),TNSZ("punpckhwd",MMO
,8),TNSZ("punpckhdq",MMO
,8),TNSZ("packssdw",MMO
,8),
1802 /* [6C] */ TNSZ("INVALID",MMO
,0), TNSZ("INVALID",MMO
,0), TNSZ("movd",MMO
,4), TNSZ("movq",MMO
,8),
1804 /* [70] */ TNSZ("pshufw",MMOPM
,8), TNS("psrXXX",MR
), TNS("psrXXX",MR
), TNS("psrXXX",MR
),
1805 /* [74] */ TNSZ("pcmpeqb",MMO
,8), TNSZ("pcmpeqw",MMO
,8), TNSZ("pcmpeqd",MMO
,8), TNS("emms",NORM
),
1806 /* [78] */ TNSy("vmread",RM
), TNSy("vmwrite",MR
), INVALID
, INVALID
,
1807 /* [7C] */ INVALID
, INVALID
, TNSZ("movd",MMOS
,4), TNSZ("movq",MMOS
,8),
1809 /* [80] */ TNS("jo",D
), TNS("jno",D
), TNS("jb",D
), TNS("jae",D
),
1810 /* [84] */ TNS("je",D
), TNS("jne",D
), TNS("jbe",D
), TNS("ja",D
),
1811 /* [88] */ TNS("js",D
), TNS("jns",D
), TNS("jp",D
), TNS("jnp",D
),
1812 /* [8C] */ TNS("jl",D
), TNS("jge",D
), TNS("jle",D
), TNS("jg",D
),
1814 /* [90] */ TNS("seto",Mb
), TNS("setno",Mb
), TNS("setb",Mb
), TNS("setae",Mb
),
1815 /* [94] */ TNS("sete",Mb
), TNS("setne",Mb
), TNS("setbe",Mb
), TNS("seta",Mb
),
1816 /* [98] */ TNS("sets",Mb
), TNS("setns",Mb
), TNS("setp",Mb
), TNS("setnp",Mb
),
1817 /* [9C] */ TNS("setl",Mb
), TNS("setge",Mb
), TNS("setle",Mb
), TNS("setg",Mb
),
1819 /* [A0] */ TSp("push",LSEG
), TSp("pop",LSEG
), TNS("cpuid",NORM
), TS("bt",RMw
),
1820 /* [A4] */ TS("shld",DSHIFT
), TS("shld",DSHIFTcl
), INVALID
, INVALID
,
1821 /* [A8] */ TSp("push",LSEG
), TSp("pop",LSEG
), TNS("rsm",NORM
), TS("bts",RMw
),
1822 /* [AC] */ TS("shrd",DSHIFT
), TS("shrd",DSHIFTcl
), IND(dis_op0FAE
), TS("imul",MRw
),
1824 /* [B0] */ TNS("cmpxchgb",RMw
), TS("cmpxchg",RMw
), TS("lss",MR
), TS("btr",RMw
),
1825 /* [B4] */ TS("lfs",MR
), TS("lgs",MR
), TS("movzb",MOVZ
), TNS("movzwl",MOVZ
),
1826 /* [B8] */ TNS("INVALID",MRw
), INVALID
, IND(dis_op0FBA
), TS("btc",RMw
),
1827 /* [BC] */ TS("bsf",MRw
), TS("bsr",MRw
), TS("movsb",MOVZ
), TNS("movswl",MOVZ
),
1829 /* [C0] */ TNS("xaddb",XADDB
), TS("xadd",RMw
), TNSZ("cmpps",XMMOPM
,16),TNS("movnti",RM
),
1830 /* [C4] */ TNSZ("pinsrw",MMOPRM
,2),TNS("pextrw",MMO3P
), TNSZ("shufps",XMMOPM
,16),IND(dis_op0FC7
),
1831 /* [C8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1832 /* [CC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1834 /* [D0] */ INVALID
, TNSZ("psrlw",MMO
,8), TNSZ("psrld",MMO
,8), TNSZ("psrlq",MMO
,8),
1835 /* [D4] */ TNSZ("paddq",MMO
,8), TNSZ("pmullw",MMO
,8), TNSZ("INVALID",MMO
,0), TNS("pmovmskb",MMOM3
),
1836 /* [D8] */ TNSZ("psubusb",MMO
,8), TNSZ("psubusw",MMO
,8), TNSZ("pminub",MMO
,8), TNSZ("pand",MMO
,8),
1837 /* [DC] */ TNSZ("paddusb",MMO
,8), TNSZ("paddusw",MMO
,8), TNSZ("pmaxub",MMO
,8), TNSZ("pandn",MMO
,8),
1839 /* [E0] */ TNSZ("pavgb",MMO
,8), TNSZ("psraw",MMO
,8), TNSZ("psrad",MMO
,8), TNSZ("pavgw",MMO
,8),
1840 /* [E4] */ TNSZ("pmulhuw",MMO
,8), TNSZ("pmulhw",MMO
,8), TNS("INVALID",XMMO
), TNSZ("movntq",MMOMS
,8),
1841 /* [E8] */ TNSZ("psubsb",MMO
,8), TNSZ("psubsw",MMO
,8), TNSZ("pminsw",MMO
,8), TNSZ("por",MMO
,8),
1842 /* [EC] */ TNSZ("paddsb",MMO
,8), TNSZ("paddsw",MMO
,8), TNSZ("pmaxsw",MMO
,8), TNSZ("pxor",MMO
,8),
1844 /* [F0] */ INVALID
, TNSZ("psllw",MMO
,8), TNSZ("pslld",MMO
,8), TNSZ("psllq",MMO
,8),
1845 /* [F4] */ TNSZ("pmuludq",MMO
,8), TNSZ("pmaddwd",MMO
,8), TNSZ("psadbw",MMO
,8), TNSZ("maskmovq",MMOIMPL
,8),
1846 /* [F8] */ TNSZ("psubb",MMO
,8), TNSZ("psubw",MMO
,8), TNSZ("psubd",MMO
,8), TNSZ("psubq",MMO
,8),
1847 /* [FC] */ TNSZ("paddb",MMO
,8), TNSZ("paddw",MMO
,8), TNSZ("paddd",MMO
,8), INVALID
,
1850 const instable_t dis_opAVX0F
[16][16] = {
1852 /* [00] */ INVALID
, INVALID
, INVALID
, INVALID
,
1853 /* [04] */ INVALID
, INVALID
, INVALID
, INVALID
,
1854 /* [08] */ INVALID
, INVALID
, INVALID
, INVALID
,
1855 /* [0C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1857 /* [10] */ TNSZ("vmovups",VEX_MX
,16), TNSZ("vmovups",VEX_RM
,16),TNSZ("vmovlps",VEX_RMrX
,8), TNSZ("vmovlps",VEX_RM
,8),
1858 /* [14] */ TNSZ("vunpcklps",VEX_RMrX
,16),TNSZ("vunpckhps",VEX_RMrX
,16),TNSZ("vmovhps",VEX_RMrX
,8),TNSZ("vmovhps",VEX_RM
,8),
1859 /* [18] */ INVALID
, INVALID
, INVALID
, INVALID
,
1860 /* [1C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1862 /* [20] */ INVALID
, INVALID
, INVALID
, INVALID
,
1863 /* [24] */ INVALID
, INVALID
, INVALID
, INVALID
,
1864 /* [28] */ TNSZ("vmovaps",VEX_MX
,16), TNSZ("vmovaps",VEX_RX
,16),INVALID
, TNSZ("vmovntps",VEX_RM
,16),
1865 /* [2C] */ INVALID
, INVALID
, TNSZ("vucomiss",VEX_MX
,4),TNSZ("vcomiss",VEX_MX
,4),
1867 /* [30] */ INVALID
, INVALID
, INVALID
, INVALID
,
1868 /* [34] */ INVALID
, INVALID
, INVALID
, INVALID
,
1869 /* [38] */ INVALID
, INVALID
, INVALID
, INVALID
,
1870 /* [3C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1872 /* [40] */ INVALID
, INVALID
, INVALID
, INVALID
,
1873 /* [44] */ INVALID
, INVALID
, INVALID
, INVALID
,
1874 /* [48] */ INVALID
, INVALID
, INVALID
, INVALID
,
1875 /* [4C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1877 /* [50] */ TNS("vmovmskps",VEX_MR
), TNSZ("vsqrtps",VEX_MX
,16), TNSZ("vrsqrtps",VEX_MX
,16),TNSZ("vrcpps",VEX_MX
,16),
1878 /* [54] */ TNSZ("vandps",VEX_RMrX
,16), TNSZ("vandnps",VEX_RMrX
,16), TNSZ("vorps",VEX_RMrX
,16), TNSZ("vxorps",VEX_RMrX
,16),
1879 /* [58] */ TNSZ("vaddps",VEX_RMrX
,16), TNSZ("vmulps",VEX_RMrX
,16), TNSZ("vcvtps2pd",VEX_MX
,8),TNSZ("vcvtdq2ps",VEX_MX
,16),
1880 /* [5C] */ TNSZ("vsubps",VEX_RMrX
,16), TNSZ("vminps",VEX_RMrX
,16), TNSZ("vdivps",VEX_RMrX
,16), TNSZ("vmaxps",VEX_RMrX
,16),
1882 /* [60] */ INVALID
, INVALID
, INVALID
, INVALID
,
1883 /* [64] */ INVALID
, INVALID
, INVALID
, INVALID
,
1884 /* [68] */ INVALID
, INVALID
, INVALID
, INVALID
,
1885 /* [6C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1887 /* [70] */ INVALID
, INVALID
, INVALID
, INVALID
,
1888 /* [74] */ INVALID
, INVALID
, INVALID
, TNS("vzeroupper", VEX_NONE
),
1889 /* [78] */ INVALID
, INVALID
, INVALID
, INVALID
,
1890 /* [7C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1892 /* [80] */ INVALID
, INVALID
, INVALID
, INVALID
,
1893 /* [84] */ INVALID
, INVALID
, INVALID
, INVALID
,
1894 /* [88] */ INVALID
, INVALID
, INVALID
, INVALID
,
1895 /* [8C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1897 /* [90] */ INVALID
, INVALID
, INVALID
, INVALID
,
1898 /* [94] */ INVALID
, INVALID
, INVALID
, INVALID
,
1899 /* [98] */ INVALID
, INVALID
, INVALID
, INVALID
,
1900 /* [9C] */ INVALID
, INVALID
, INVALID
, INVALID
,
1902 /* [A0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1903 /* [A4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1904 /* [A8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1905 /* [AC] */ INVALID
, INVALID
, TNSZ("vldmxcsr",VEX_MO
,2), INVALID
,
1907 /* [B0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1908 /* [B4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1909 /* [B8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1910 /* [BC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1912 /* [C0] */ INVALID
, INVALID
, TNSZ("vcmpps",VEX_RMRX
,16),INVALID
,
1913 /* [C4] */ INVALID
, INVALID
, TNSZ("vshufps",VEX_RMRX
,16),INVALID
,
1914 /* [C8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1915 /* [CC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1917 /* [D0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1918 /* [D4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1919 /* [D8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1920 /* [DC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1922 /* [E0] */ INVALID
, INVALID
, INVALID
, INVALID
,
1923 /* [E4] */ INVALID
, INVALID
, INVALID
, INVALID
,
1924 /* [E8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1925 /* [EC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1927 /* [F0] */ INVALID
, INVALID
, TNSZvr("andn",VEX_RMrX
,5),TNSZvr("bls",BLS
,5),
1928 /* [F4] */ INVALID
, TNSZvr("bzhi",VEX_VRMrX
,5),INVALID
, TNSZvr("bextr",VEX_VRMrX
,5),
1929 /* [F8] */ INVALID
, INVALID
, INVALID
, INVALID
,
1930 /* [FC] */ INVALID
, INVALID
, INVALID
, INVALID
,
1934 * Decode table for 0x80 opcodes
1937 const instable_t dis_op80
[8] = {
1939 /* [0] */ TNS("addb",IMlw
), TNS("orb",IMw
), TNS("adcb",IMlw
), TNS("sbbb",IMlw
),
1940 /* [4] */ TNS("andb",IMw
), TNS("subb",IMlw
), TNS("xorb",IMw
), TNS("cmpb",IMlw
),
1945 * Decode table for 0x81 opcodes.
1948 const instable_t dis_op81
[8] = {
1950 /* [0] */ TS("add",IMlw
), TS("or",IMw
), TS("adc",IMlw
), TS("sbb",IMlw
),
1951 /* [4] */ TS("and",IMw
), TS("sub",IMlw
), TS("xor",IMw
), TS("cmp",IMlw
),
1956 * Decode table for 0x82 opcodes.
1959 const instable_t dis_op82
[8] = {
1961 /* [0] */ TNSx("addb",IMlw
), TNSx("orb",IMlw
), TNSx("adcb",IMlw
), TNSx("sbbb",IMlw
),
1962 /* [4] */ TNSx("andb",IMlw
), TNSx("subb",IMlw
), TNSx("xorb",IMlw
), TNSx("cmpb",IMlw
),
1965 * Decode table for 0x83 opcodes.
1968 const instable_t dis_op83
[8] = {
1970 /* [0] */ TS("add",IMlw
), TS("or",IMlw
), TS("adc",IMlw
), TS("sbb",IMlw
),
1971 /* [4] */ TS("and",IMlw
), TS("sub",IMlw
), TS("xor",IMlw
), TS("cmp",IMlw
),
1975 * Decode table for 0xC0 opcodes.
1978 const instable_t dis_opC0
[8] = {
1980 /* [0] */ TNS("rolb",MvI
), TNS("rorb",MvI
), TNS("rclb",MvI
), TNS("rcrb",MvI
),
1981 /* [4] */ TNS("shlb",MvI
), TNS("shrb",MvI
), INVALID
, TNS("sarb",MvI
),
1985 * Decode table for 0xD0 opcodes.
1988 const instable_t dis_opD0
[8] = {
1990 /* [0] */ TNS("rolb",Mv
), TNS("rorb",Mv
), TNS("rclb",Mv
), TNS("rcrb",Mv
),
1991 /* [4] */ TNS("shlb",Mv
), TNS("shrb",Mv
), TNS("salb",Mv
), TNS("sarb",Mv
),
1995 * Decode table for 0xC1 opcodes.
1996 * 186 instruction set
1999 const instable_t dis_opC1
[8] = {
2001 /* [0] */ TS("rol",MvI
), TS("ror",MvI
), TS("rcl",MvI
), TS("rcr",MvI
),
2002 /* [4] */ TS("shl",MvI
), TS("shr",MvI
), TS("sal",MvI
), TS("sar",MvI
),
2006 * Decode table for 0xD1 opcodes.
2009 const instable_t dis_opD1
[8] = {
2011 /* [0] */ TS("rol",Mv
), TS("ror",Mv
), TS("rcl",Mv
), TS("rcr",Mv
),
2012 /* [4] */ TS("shl",Mv
), TS("shr",Mv
), TS("sal",Mv
), TS("sar",Mv
),
2017 * Decode table for 0xD2 opcodes.
2020 const instable_t dis_opD2
[8] = {
2022 /* [0] */ TNS("rolb",Mv
), TNS("rorb",Mv
), TNS("rclb",Mv
), TNS("rcrb",Mv
),
2023 /* [4] */ TNS("shlb",Mv
), TNS("shrb",Mv
), TNS("salb",Mv
), TNS("sarb",Mv
),
2026 * Decode table for 0xD3 opcodes.
2029 const instable_t dis_opD3
[8] = {
2031 /* [0] */ TS("rol",Mv
), TS("ror",Mv
), TS("rcl",Mv
), TS("rcr",Mv
),
2032 /* [4] */ TS("shl",Mv
), TS("shr",Mv
), TS("salb",Mv
), TS("sar",Mv
),
2037 * Decode table for 0xF6 opcodes.
2040 const instable_t dis_opF6
[8] = {
2042 /* [0] */ TNS("testb",IMw
), TNS("testb",IMw
), TNS("notb",Mw
), TNS("negb",Mw
),
2043 /* [4] */ TNS("mulb",MA
), TNS("imulb",MA
), TNS("divb",MA
), TNS("idivb",MA
),
2048 * Decode table for 0xF7 opcodes.
2051 const instable_t dis_opF7
[8] = {
2053 /* [0] */ TS("test",IMw
), TS("test",IMw
), TS("not",Mw
), TS("neg",Mw
),
2054 /* [4] */ TS("mul",MA
), TS("imul",MA
), TS("div",MA
), TS("idiv",MA
),
2059 * Decode table for 0xFE opcodes.
2062 const instable_t dis_opFE
[8] = {
2064 /* [0] */ TNS("incb",Mw
), TNS("decb",Mw
), INVALID
, INVALID
,
2065 /* [4] */ INVALID
, INVALID
, INVALID
, INVALID
,
2068 * Decode table for 0xFF opcodes.
2071 const instable_t dis_opFF
[8] = {
2073 /* [0] */ TS("inc",Mw
), TS("dec",Mw
), TNSyp("call",INM
), TNS("lcall",INM
),
2074 /* [4] */ TNSy("jmp",INM
), TNS("ljmp",INM
), TSp("push",M
), INVALID
,
2077 /* for 287 instructions, which are a mess to decode */
2079 const instable_t dis_opFP1n2
[8][8] = {
2081 /* bit pattern: 1101 1xxx MODxx xR/M */
2082 /* [0,0] */ TNS("fadds",M
), TNS("fmuls",M
), TNS("fcoms",M
), TNS("fcomps",M
),
2083 /* [0,4] */ TNS("fsubs",M
), TNS("fsubrs",M
), TNS("fdivs",M
), TNS("fdivrs",M
),
2085 /* [1,0] */ TNS("flds",M
), INVALID
, TNS("fsts",M
), TNS("fstps",M
),
2086 /* [1,4] */ TNSZ("fldenv",M
,28), TNSZ("fldcw",M
,2), TNSZ("fnstenv",M
,28), TNSZ("fnstcw",M
,2),
2088 /* [2,0] */ TNS("fiaddl",M
), TNS("fimull",M
), TNS("ficoml",M
), TNS("ficompl",M
),
2089 /* [2,4] */ TNS("fisubl",M
), TNS("fisubrl",M
), TNS("fidivl",M
), TNS("fidivrl",M
),
2091 /* [3,0] */ TNS("fildl",M
), TNSZ("tisttpl",M
,4), TNS("fistl",M
), TNS("fistpl",M
),
2092 /* [3,4] */ INVALID
, TNSZ("fldt",M
,10), INVALID
, TNSZ("fstpt",M
,10),
2094 /* [4,0] */ TNSZ("faddl",M
,8), TNSZ("fmull",M
,8), TNSZ("fcoml",M
,8), TNSZ("fcompl",M
,8),
2095 /* [4,1] */ TNSZ("fsubl",M
,8), TNSZ("fsubrl",M
,8), TNSZ("fdivl",M
,8), TNSZ("fdivrl",M
,8),
2097 /* [5,0] */ TNSZ("fldl",M
,8), TNSZ("fisttpll",M
,8), TNSZ("fstl",M
,8), TNSZ("fstpl",M
,8),
2098 /* [5,4] */ TNSZ("frstor",M
,108), INVALID
, TNSZ("fnsave",M
,108), TNSZ("fnstsw",M
,2),
2100 /* [6,0] */ TNSZ("fiadd",M
,2), TNSZ("fimul",M
,2), TNSZ("ficom",M
,2), TNSZ("ficomp",M
,2),
2101 /* [6,4] */ TNSZ("fisub",M
,2), TNSZ("fisubr",M
,2), TNSZ("fidiv",M
,2), TNSZ("fidivr",M
,2),
2103 /* [7,0] */ TNSZ("fild",M
,2), TNSZ("fisttp",M
,2), TNSZ("fist",M
,2), TNSZ("fistp",M
,2),
2104 /* [7,4] */ TNSZ("fbld",M
,10), TNSZ("fildll",M
,8), TNSZ("fbstp",M
,10), TNSZ("fistpll",M
,8),
2107 const instable_t dis_opFP3
[8][8] = {
2109 /* bit pattern: 1101 1xxx 11xx xREG */
2110 /* [0,0] */ TNS("fadd",FF
), TNS("fmul",FF
), TNS("fcom",F
), TNS("fcomp",F
),
2111 /* [0,4] */ TNS("fsub",FF
), TNS("fsubr",FF
), TNS("fdiv",FF
), TNS("fdivr",FF
),
2113 /* [1,0] */ TNS("fld",F
), TNS("fxch",F
), TNS("fnop",NORM
), TNS("fstp",F
),
2114 /* [1,4] */ INVALID
, INVALID
, INVALID
, INVALID
,
2116 /* [2,0] */ INVALID
, INVALID
, INVALID
, INVALID
,
2117 /* [2,4] */ INVALID
, TNS("fucompp",NORM
), INVALID
, INVALID
,
2119 /* [3,0] */ INVALID
, INVALID
, INVALID
, INVALID
,
2120 /* [3,4] */ INVALID
, INVALID
, INVALID
, INVALID
,
2122 /* [4,0] */ TNS("fadd",FF
), TNS("fmul",FF
), TNS("fcom",F
), TNS("fcomp",F
),
2123 /* [4,4] */ TNS("fsub",FF
), TNS("fsubr",FF
), TNS("fdiv",FF
), TNS("fdivr",FF
),
2125 /* [5,0] */ TNS("ffree",F
), TNS("fxch",F
), TNS("fst",F
), TNS("fstp",F
),
2126 /* [5,4] */ TNS("fucom",F
), TNS("fucomp",F
), INVALID
, INVALID
,
2128 /* [6,0] */ TNS("faddp",FF
), TNS("fmulp",FF
), TNS("fcomp",F
), TNS("fcompp",NORM
),
2129 /* [6,4] */ TNS("fsubp",FF
), TNS("fsubrp",FF
), TNS("fdivp",FF
), TNS("fdivrp",FF
),
2131 /* [7,0] */ TNS("ffreep",F
), TNS("fxch",F
), TNS("fstp",F
), TNS("fstp",F
),
2132 /* [7,4] */ TNS("fnstsw",M
), TNS("fucomip",FFC
), TNS("fcomip",FFC
), INVALID
,
2135 const instable_t dis_opFP4
[4][8] = {
2137 /* bit pattern: 1101 1001 111x xxxx */
2138 /* [0,0] */ TNS("fchs",NORM
), TNS("fabs",NORM
), INVALID
, INVALID
,
2139 /* [0,4] */ TNS("ftst",NORM
), TNS("fxam",NORM
), TNS("ftstp",NORM
), INVALID
,
2141 /* [1,0] */ TNS("fld1",NORM
), TNS("fldl2t",NORM
), TNS("fldl2e",NORM
), TNS("fldpi",NORM
),
2142 /* [1,4] */ TNS("fldlg2",NORM
), TNS("fldln2",NORM
), TNS("fldz",NORM
), INVALID
,
2144 /* [2,0] */ TNS("f2xm1",NORM
), TNS("fyl2x",NORM
), TNS("fptan",NORM
), TNS("fpatan",NORM
),
2145 /* [2,4] */ TNS("fxtract",NORM
), TNS("fprem1",NORM
), TNS("fdecstp",NORM
), TNS("fincstp",NORM
),
2147 /* [3,0] */ TNS("fprem",NORM
), TNS("fyl2xp1",NORM
), TNS("fsqrt",NORM
), TNS("fsincos",NORM
),
2148 /* [3,4] */ TNS("frndint",NORM
), TNS("fscale",NORM
), TNS("fsin",NORM
), TNS("fcos",NORM
),
2151 const instable_t dis_opFP5
[8] = {
2152 /* bit pattern: 1101 1011 111x xxxx */
2153 /* [0] */ TNS("feni",NORM
), TNS("fdisi",NORM
), TNS("fnclex",NORM
), TNS("fninit",NORM
),
2154 /* [4] */ TNS("fsetpm",NORM
), TNS("frstpm",NORM
), INVALID
, INVALID
,
2157 const instable_t dis_opFP6
[8] = {
2158 /* bit pattern: 1101 1011 11yy yxxx */
2159 /* [00] */ TNS("fcmov.nb",FF
), TNS("fcmov.ne",FF
), TNS("fcmov.nbe",FF
), TNS("fcmov.nu",FF
),
2160 /* [04] */ INVALID
, TNS("fucomi",F
), TNS("fcomi",F
), INVALID
,
2163 const instable_t dis_opFP7
[8] = {
2164 /* bit pattern: 1101 1010 11yy yxxx */
2165 /* [00] */ TNS("fcmov.b",FF
), TNS("fcmov.e",FF
), TNS("fcmov.be",FF
), TNS("fcmov.u",FF
),
2166 /* [04] */ INVALID
, INVALID
, INVALID
, INVALID
,
2170 * Main decode table for the op codes. The first two nibbles
2171 * will be used as an index into the table. If there is a
2172 * a need to further decode an instruction, the array to be
2173 * referenced is indicated with the other two entries being
2177 const instable_t dis_distable
[16][16] = {
2179 /* [0,0] */ TNS("addb",RMw
), TS("add",RMw
), TNS("addb",MRw
), TS("add",MRw
),
2180 /* [0,4] */ TNS("addb",IA
), TS("add",IA
), TSx("push",SEG
), TSx("pop",SEG
),
2181 /* [0,8] */ TNS("orb",RMw
), TS("or",RMw
), TNS("orb",MRw
), TS("or",MRw
),
2182 /* [0,C] */ TNS("orb",IA
), TS("or",IA
), TSx("push",SEG
), IND(dis_op0F
),
2184 /* [1,0] */ TNS("adcb",RMw
), TS("adc",RMw
), TNS("adcb",MRw
), TS("adc",MRw
),
2185 /* [1,4] */ TNS("adcb",IA
), TS("adc",IA
), TSx("push",SEG
), TSx("pop",SEG
),
2186 /* [1,8] */ TNS("sbbb",RMw
), TS("sbb",RMw
), TNS("sbbb",MRw
), TS("sbb",MRw
),
2187 /* [1,C] */ TNS("sbbb",IA
), TS("sbb",IA
), TSx("push",SEG
), TSx("pop",SEG
),
2189 /* [2,0] */ TNS("andb",RMw
), TS("and",RMw
), TNS("andb",MRw
), TS("and",MRw
),
2190 /* [2,4] */ TNS("andb",IA
), TS("and",IA
), TNS("%es:",OVERRIDE
), TNSx("daa",NORM
),
2191 /* [2,8] */ TNS("subb",RMw
), TS("sub",RMw
), TNS("subb",MRw
), TS("sub",MRw
),
2192 /* [2,C] */ TNS("subb",IA
), TS("sub",IA
), TNS("%cs:",OVERRIDE
), TNSx("das",NORM
),
2194 /* [3,0] */ TNS("xorb",RMw
), TS("xor",RMw
), TNS("xorb",MRw
), TS("xor",MRw
),
2195 /* [3,4] */ TNS("xorb",IA
), TS("xor",IA
), TNS("%ss:",OVERRIDE
), TNSx("aaa",NORM
),
2196 /* [3,8] */ TNS("cmpb",RMw
), TS("cmp",RMw
), TNS("cmpb",MRw
), TS("cmp",MRw
),
2197 /* [3,C] */ TNS("cmpb",IA
), TS("cmp",IA
), TNS("%ds:",OVERRIDE
), TNSx("aas",NORM
),
2199 /* [4,0] */ TSx("inc",R
), TSx("inc",R
), TSx("inc",R
), TSx("inc",R
),
2200 /* [4,4] */ TSx("inc",R
), TSx("inc",R
), TSx("inc",R
), TSx("inc",R
),
2201 /* [4,8] */ TSx("dec",R
), TSx("dec",R
), TSx("dec",R
), TSx("dec",R
),
2202 /* [4,C] */ TSx("dec",R
), TSx("dec",R
), TSx("dec",R
), TSx("dec",R
),
2204 /* [5,0] */ TSp("push",R
), TSp("push",R
), TSp("push",R
), TSp("push",R
),
2205 /* [5,4] */ TSp("push",R
), TSp("push",R
), TSp("push",R
), TSp("push",R
),
2206 /* [5,8] */ TSp("pop",R
), TSp("pop",R
), TSp("pop",R
), TSp("pop",R
),
2207 /* [5,C] */ TSp("pop",R
), TSp("pop",R
), TSp("pop",R
), TSp("pop",R
),
2209 /* [6,0] */ TSZx("pusha",IMPLMEM
,28),TSZx("popa",IMPLMEM
,28), TSx("bound",MR
), TNS("arpl",RMw
),
2210 /* [6,4] */ TNS("%fs:",OVERRIDE
), TNS("%gs:",OVERRIDE
), TNS("data16",DM
), TNS("addr16",AM
),
2211 /* [6,8] */ TSp("push",I
), TS("imul",IMUL
), TSp("push",Ib
), TS("imul",IMUL
),
2212 /* [6,C] */ TNSZ("insb",IMPLMEM
,1), TSZ("ins",IMPLMEM
,4), TNSZ("outsb",IMPLMEM
,1),TSZ("outs",IMPLMEM
,4),
2214 /* [7,0] */ TNSy("jo",BD
), TNSy("jno",BD
), TNSy("jb",BD
), TNSy("jae",BD
),
2215 /* [7,4] */ TNSy("je",BD
), TNSy("jne",BD
), TNSy("jbe",BD
), TNSy("ja",BD
),
2216 /* [7,8] */ TNSy("js",BD
), TNSy("jns",BD
), TNSy("jp",BD
), TNSy("jnp",BD
),
2217 /* [7,C] */ TNSy("jl",BD
), TNSy("jge",BD
), TNSy("jle",BD
), TNSy("jg",BD
),
2219 /* [8,0] */ IND(dis_op80
), IND(dis_op81
), INDx(dis_op82
), IND(dis_op83
),
2220 /* [8,4] */ TNS("testb",RMw
), TS("test",RMw
), TNS("xchgb",RMw
), TS("xchg",RMw
),
2221 /* [8,8] */ TNS("movb",RMw
), TS("mov",RMw
), TNS("movb",MRw
), TS("mov",MRw
),
2222 /* [8,C] */ TNS("movw",SM
), TS("lea",MR
), TNS("movw",MS
), TSp("pop",M
),
2224 /* [9,0] */ TNS("nop",NORM
), TS("xchg",RA
), TS("xchg",RA
), TS("xchg",RA
),
2225 /* [9,4] */ TS("xchg",RA
), TS("xchg",RA
), TS("xchg",RA
), TS("xchg",RA
),
2226 /* [9,8] */ TNS("cXtX",CBW
), TNS("cXtX",CWD
), TNSx("lcall",SO
), TNS("fwait",NORM
),
2227 /* [9,C] */ TSZy("pushf",IMPLMEM
,4),TSZy("popf",IMPLMEM
,4), TNS("sahf",NORM
), TNS("lahf",NORM
),
2229 /* [A,0] */ TNS("movb",OA
), TS("mov",OA
), TNS("movb",AO
), TS("mov",AO
),
2230 /* [A,4] */ TNSZ("movsb",SD
,1), TS("movs",SD
), TNSZ("cmpsb",SD
,1), TS("cmps",SD
),
2231 /* [A,8] */ TNS("testb",IA
), TS("test",IA
), TNS("stosb",AD
), TS("stos",AD
),
2232 /* [A,C] */ TNS("lodsb",SA
), TS("lods",SA
), TNS("scasb",AD
), TS("scas",AD
),
2234 /* [B,0] */ TNS("movb",IR
), TNS("movb",IR
), TNS("movb",IR
), TNS("movb",IR
),
2235 /* [B,4] */ TNS("movb",IR
), TNS("movb",IR
), TNS("movb",IR
), TNS("movb",IR
),
2236 /* [B,8] */ TS("mov",IR
), TS("mov",IR
), TS("mov",IR
), TS("mov",IR
),
2237 /* [B,C] */ TS("mov",IR
), TS("mov",IR
), TS("mov",IR
), TS("mov",IR
),
2239 /* [C,0] */ IND(dis_opC0
), IND(dis_opC1
), TNSyp("ret",RET
), TNSyp("ret",NORM
),
2240 /* [C,4] */ TNSx("les",MR
), TNSx("lds",MR
), TNS("movb",IMw
), TS("mov",IMw
),
2241 /* [C,8] */ TNSyp("enter",ENTER
), TNSyp("leave",NORM
), TNS("lret",RET
), TNS("lret",NORM
),
2242 /* [C,C] */ TNS("int",INT3
), TNS("int",INTx
), TNSx("into",NORM
), TNS("iret",NORM
),
2244 /* [D,0] */ IND(dis_opD0
), IND(dis_opD1
), IND(dis_opD2
), IND(dis_opD3
),
2245 /* [D,4] */ TNSx("aam",U
), TNSx("aad",U
), TNSx("falc",NORM
), TNSZ("xlat",IMPLMEM
,1),
2247 /* 287 instructions. Note that although the indirect field */
2248 /* indicates opFP1n2 for further decoding, this is not necessarily */
2249 /* the case since the opFP arrays are not partitioned according to key1 */
2250 /* and key2. opFP1n2 is given only to indicate that we haven't */
2251 /* finished decoding the instruction. */
2252 /* [D,8] */ IND(dis_opFP1n2
), IND(dis_opFP1n2
), IND(dis_opFP1n2
), IND(dis_opFP1n2
),
2253 /* [D,C] */ IND(dis_opFP1n2
), IND(dis_opFP1n2
), IND(dis_opFP1n2
), IND(dis_opFP1n2
),
2255 /* [E,0] */ TNSy("loopnz",BD
), TNSy("loopz",BD
), TNSy("loop",BD
), TNSy("jcxz",BD
),
2256 /* [E,4] */ TNS("inb",P
), TS("in",P
), TNS("outb",P
), TS("out",P
),
2257 /* [E,8] */ TNSyp("call",D
), TNSy("jmp",D
), TNSx("ljmp",SO
), TNSy("jmp",BD
),
2258 /* [E,C] */ TNS("inb",V
), TS("in",V
), TNS("outb",V
), TS("out",V
),
2260 /* [F,0] */ TNS("lock",LOCK
), TNS("icebp", NORM
), TNS("repnz",PREFIX
), TNS("repz",PREFIX
),
2261 /* [F,4] */ TNS("hlt",NORM
), TNS("cmc",NORM
), IND(dis_opF6
), IND(dis_opF7
),
2262 /* [F,8] */ TNS("clc",NORM
), TNS("stc",NORM
), TNS("cli",NORM
), TNS("sti",NORM
),
2263 /* [F,C] */ TNS("cld",NORM
), TNS("std",NORM
), IND(dis_opFE
), IND(dis_opFF
),
2269 * common functions to decode and disassemble an x86 or amd64 instruction
2273 * These are the individual fields of a REX prefix. Note that a REX
2274 * prefix with none of these set is still needed to:
2275 * - use the MOVSXD (sign extend 32 to 64 bits) instruction
2276 * - access the %sil, %dil, %bpl, %spl registers
2278 #define REX_W 0x08 /* 64 bit operand size when set */
2279 #define REX_R 0x04 /* high order bit extension of ModRM reg field */
2280 #define REX_X 0x02 /* high order bit extension of SIB index field */
2281 #define REX_B 0x01 /* extends ModRM r_m, SIB base, or opcode reg */
2284 * These are the individual fields of a VEX prefix.
2286 #define VEX_R 0x08 /* REX.R in 1's complement form */
2287 #define VEX_X 0x04 /* REX.X in 1's complement form */
2288 #define VEX_B 0x02 /* REX.B in 1's complement form */
2289 /* Vector Length, 0: scalar or 128-bit vector, 1: 256-bit vector */
2291 #define VEX_W 0x08 /* opcode specific, use like REX.W */
2292 #define VEX_m 0x1F /* VEX m-mmmm field */
2293 #define VEX_v 0x78 /* VEX register specifier */
2294 #define VEX_p 0x03 /* VEX pp field, opcode extension */
2296 /* VEX m-mmmm field, only used by three bytes prefix */
2297 #define VEX_m_0F 0x01 /* implied 0F leading opcode byte */
2298 #define VEX_m_0F38 0x02 /* implied 0F 38 leading opcode byte */
2299 #define VEX_m_0F3A 0x03 /* implied 0F 3A leading opcode byte */
2301 /* VEX pp field, providing equivalent functionality of a SIMD prefix */
2302 #define VEX_p_66 0x01
2303 #define VEX_p_F3 0x02
2304 #define VEX_p_F2 0x03
2307 * Even in 64 bit mode, usually only 4 byte immediate operands are supported.
2309 static int isize
[] = {1, 2, 4, 4};
2310 static int isize64
[] = {1, 2, 4, 8};
2313 * Just a bunch of useful macros.
2315 #define WBIT(x) (x & 0x1) /* to get w bit */
2316 #define REGNO(x) (x & 0x7) /* to get 3 bit register */
2317 #define VBIT(x) ((x)>>1 & 0x1) /* to get 'v' bit */
2318 #define OPSIZE(osize, wbit) ((wbit) ? isize[osize] : 1)
2319 #define OPSIZE64(osize, wbit) ((wbit) ? isize64[osize] : 1)
2321 #define REG_ONLY 3 /* mode to indicate a register operand (not memory) */
2323 #define BYTE_OPND 0 /* w-bit value indicating byte register */
2324 #define LONG_OPND 1 /* w-bit value indicating opnd_size register */
2325 #define MM_OPND 2 /* "value" used to indicate a mmx reg */
2326 #define XMM_OPND 3 /* "value" used to indicate a xmm reg */
2327 #define SEG_OPND 4 /* "value" used to indicate a segment reg */
2328 #define CONTROL_OPND 5 /* "value" used to indicate a control reg */
2329 #define DEBUG_OPND 6 /* "value" used to indicate a debug reg */
2330 #define TEST_OPND 7 /* "value" used to indicate a test reg */
2331 #define WORD_OPND 8 /* w-bit value indicating word size reg */
2332 #define YMM_OPND 9 /* "value" used to indicate a ymm reg */
2335 * The AVX2 gather instructions are a bit of a mess. While there's a pattern,
2336 * there's not really a consistent scheme that we can use to know what the mode
2337 * is supposed to be for a given type. Various instructions, like VPGATHERDD,
2338 * always match the value of VEX_L. Other instructions like VPGATHERDQ, have
2339 * some registers match VEX_L, but the VSIB is always XMM.
2341 * The simplest way to deal with this is to just define a table based on the
2342 * instruction opcodes, which are 0x90-0x93, so we subtract 0x90 to index into
2345 * We further have to subdivide this based on the value of VEX_W and the value
2346 * of VEX_L. The array is constructed to be indexed as:
2347 * [opcode - 0x90][VEX_W][VEX_L].
2350 typedef struct dis_gather_regs
{
2351 uint_t dgr_arg0
; /* src reg */
2352 uint_t dgr_arg1
; /* vsib reg */
2353 uint_t dgr_arg2
; /* dst reg */
2354 const char *dgr_suffix
; /* suffix to append */
2355 } dis_gather_regs_t
;
2357 static dis_gather_regs_t dis_vgather
[4][2][2] = {
2361 { XMM_OPND
, XMM_OPND
, XMM_OPND
, "d" },
2362 { YMM_OPND
, YMM_OPND
, YMM_OPND
, "d" }
2366 { XMM_OPND
, XMM_OPND
, XMM_OPND
, "q" },
2367 { YMM_OPND
, XMM_OPND
, YMM_OPND
, "q" }
2373 { XMM_OPND
, XMM_OPND
, XMM_OPND
, "d" },
2374 { XMM_OPND
, YMM_OPND
, XMM_OPND
, "d" },
2378 { XMM_OPND
, XMM_OPND
, XMM_OPND
, "q" },
2379 { YMM_OPND
, YMM_OPND
, YMM_OPND
, "q" },
2385 { XMM_OPND
, XMM_OPND
, XMM_OPND
, "s" },
2386 { YMM_OPND
, YMM_OPND
, YMM_OPND
, "s" }
2390 { XMM_OPND
, XMM_OPND
, XMM_OPND
, "d" },
2391 { YMM_OPND
, XMM_OPND
, YMM_OPND
, "d" }
2397 { XMM_OPND
, XMM_OPND
, XMM_OPND
, "s" },
2398 { XMM_OPND
, YMM_OPND
, XMM_OPND
, "s" }
2402 { XMM_OPND
, XMM_OPND
, XMM_OPND
, "d" },
2403 { YMM_OPND
, YMM_OPND
, YMM_OPND
, "d" }
2409 * Get the next byte and separate the op code into the high and low nibbles.
2412 dtrace_get_opcode(dis86_t
*x
, uint_t
*high
, uint_t
*low
)
2417 * x86 instructions have a maximum length of 15 bytes. Bail out if
2418 * we try to read more.
2420 if (x
->d86_len
>= 15)
2421 return (x
->d86_error
= 1);
2425 byte
= x
->d86_get_byte(x
->d86_data
);
2427 return (x
->d86_error
= 1);
2428 x
->d86_bytes
[x
->d86_len
++] = byte
;
2429 *low
= byte
& 0xf; /* ----xxxx low 4 bits */
2430 *high
= byte
>> 4 & 0xf; /* xxxx---- bits 7 to 4 */
2435 * Get and decode an SIB (scaled index base) byte
2438 dtrace_get_SIB(dis86_t
*x
, uint_t
*ss
, uint_t
*index
, uint_t
*base
)
2445 byte
= x
->d86_get_byte(x
->d86_data
);
2450 x
->d86_bytes
[x
->d86_len
++] = byte
;
2453 *index
= (byte
>> 3) & 0x7;
2454 *ss
= (byte
>> 6) & 0x3;
2458 * Get the byte following the op code and separate it into the
2459 * mode, register, and r/m fields.
2462 dtrace_get_modrm(dis86_t
*x
, uint_t
*mode
, uint_t
*reg
, uint_t
*r_m
)
2464 if (x
->d86_got_modrm
== 0) {
2465 if (x
->d86_rmindex
== -1)
2466 x
->d86_rmindex
= x
->d86_len
;
2467 dtrace_get_SIB(x
, mode
, reg
, r_m
);
2468 x
->d86_got_modrm
= 1;
2473 * Adjust register selection based on any REX prefix bits present.
2477 dtrace_rex_adjust(uint_t rex_prefix
, uint_t mode
, uint_t
*reg
, uint_t
*r_m
)
2479 #pragma unused (mode)
2480 if (reg
!= NULL
&& r_m
== NULL
) {
2481 if (rex_prefix
& REX_B
)
2484 if (reg
!= NULL
&& (REX_R
& rex_prefix
) != 0)
2486 if (r_m
!= NULL
&& (REX_B
& rex_prefix
) != 0)
2492 * Adjust register selection based on any VEX prefix bits present.
2493 * Notes: VEX.R, VEX.X and VEX.B use the inverted form compared with REX prefix
2497 dtrace_vex_adjust(uint_t vex_byte1
, uint_t mode
, uint_t
*reg
, uint_t
*r_m
)
2499 #pragma unused (mode)
2500 if (reg
!= NULL
&& r_m
== NULL
) {
2501 if (!(vex_byte1
& VEX_B
))
2504 if (reg
!= NULL
&& ((VEX_R
& vex_byte1
) == 0))
2506 if (r_m
!= NULL
&& ((VEX_B
& vex_byte1
) == 0))
2512 * Get an immediate operand of the given size, with sign extension.
2515 dtrace_imm_opnd(dis86_t
*x
, int wbit
, int size
, int opindex
)
2521 if (x
->d86_numopnds
< (uint_t
)opindex
+ 1)
2522 x
->d86_numopnds
= (uint_t
)opindex
+ 1;
2529 if (x
->d86_opnd_size
== SIZE16
)
2531 else if (x
->d86_opnd_size
== SIZE32
)
2554 x
->d86_opnd
[opindex
].d86_value
= 0;
2555 for (i
= 0; i
< size
; ++i
) {
2556 byte
= x
->d86_get_byte(x
->d86_data
);
2561 x
->d86_bytes
[x
->d86_len
++] = byte
;
2562 x
->d86_opnd
[opindex
].d86_value
|= (uint64_t)byte
<< (i
* 8);
2564 /* Do sign extension */
2565 if (x
->d86_bytes
[x
->d86_len
- 1] & 0x80) {
2566 for (; i
< (int)sizeof (uint64_t); i
++)
2567 x
->d86_opnd
[opindex
].d86_value
|=
2568 (uint64_t)0xff << (i
* 8);
2571 x
->d86_opnd
[opindex
].d86_mode
= MODE_SIGNED
;
2572 x
->d86_opnd
[opindex
].d86_value_size
= valsize
;
2573 x
->d86_imm_bytes
+= size
;
2578 * Get an ip relative operand of the given size, with sign extension.
2581 dtrace_disp_opnd(dis86_t
*x
, int wbit
, int size
, int opindex
)
2583 dtrace_imm_opnd(x
, wbit
, size
, opindex
);
2585 x
->d86_opnd
[opindex
].d86_mode
= MODE_IPREL
;
2590 * Check to see if there is a segment override prefix pending.
2591 * If so, print it in the current 'operand' location and set
2592 * the override flag back to false.
2596 dtrace_check_override(dis86_t
*x
, int opindex
)
2599 if (x
->d86_seg_prefix
) {
2600 (void) strlcat(x
->d86_opnd
[opindex
].d86_prefix
,
2601 x
->d86_seg_prefix
, PFIXLEN
);
2604 #pragma unused (opindex)
2606 x
->d86_seg_prefix
= NULL
;
2611 * Process a single instruction Register or Memory operand.
2613 * mode = addressing mode from ModRM byte
2614 * r_m = r_m (or reg if mode == 3) field from ModRM byte
2615 * wbit = indicates which register (8bit, 16bit, ... MMX, etc.) set to use.
2616 * o = index of operand that we are processing (0, 1 or 2)
2618 * the value of reg or r_m must have already been adjusted for any REX prefix.
2622 dtrace_get_operand(dis86_t
*x
, uint_t mode
, uint_t r_m
, int wbit
, int opindex
)
2624 int have_SIB
= 0; /* flag presence of scale-index-byte */
2625 uint_t ss
; /* scale-factor from opcode */
2626 uint_t index
; /* index register number */
2627 uint_t base
; /* base register number */
2628 int dispsize
; /* size of displacement in bytes */
2630 char *opnd
= x
->d86_opnd
[opindex
].d86_opnd
;
2632 #pragma unused (wbit)
2635 if (x
->d86_numopnds
< (uint_t
)opindex
+ 1)
2636 x
->d86_numopnds
= (uint_t
)opindex
+ 1;
2642 * first handle a simple register
2644 if (mode
== REG_ONLY
) {
2648 (void) strlcat(opnd
, dis_MMREG
[r_m
], OPLEN
);
2651 (void) strlcat(opnd
, dis_XMMREG
[r_m
], OPLEN
);
2654 (void) strlcat(opnd
, dis_YMMREG
[r_m
], OPLEN
);
2657 (void) strlcat(opnd
, dis_SEGREG
[r_m
], OPLEN
);
2660 (void) strlcat(opnd
, dis_CONTROLREG
[r_m
], OPLEN
);
2663 (void) strlcat(opnd
, dis_DEBUGREG
[r_m
], OPLEN
);
2666 (void) strlcat(opnd
, dis_TESTREG
[r_m
], OPLEN
);
2669 if (x
->d86_rex_prefix
== 0)
2670 (void) strlcat(opnd
, dis_REG8
[r_m
], OPLEN
);
2672 (void) strlcat(opnd
, dis_REG8_REX
[r_m
], OPLEN
);
2675 (void) strlcat(opnd
, dis_REG16
[r_m
], OPLEN
);
2678 if (x
->d86_opnd_size
== SIZE16
)
2679 (void) strlcat(opnd
, dis_REG16
[r_m
], OPLEN
);
2680 else if (x
->d86_opnd_size
== SIZE32
)
2681 (void) strlcat(opnd
, dis_REG32
[r_m
], OPLEN
);
2683 (void) strlcat(opnd
, dis_REG64
[r_m
], OPLEN
);
2686 #endif /* DIS_TEXT */
2691 * if symbolic representation, skip override prefix, if any
2693 dtrace_check_override(x
, opindex
);
2696 * Handle 16 bit memory references first, since they decode
2697 * the mode values more simply.
2698 * mode 1 is r_m + 8 bit displacement
2699 * mode 2 is r_m + 16 bit displacement
2700 * mode 0 is just r_m, unless r_m is 6 which is 16 bit disp
2702 if (x
->d86_addr_size
== SIZE16
) {
2703 if ((mode
== 0 && r_m
== 6) || mode
== 2)
2704 dtrace_imm_opnd(x
, WORD_OPND
, 2, opindex
);
2706 dtrace_imm_opnd(x
, BYTE_OPND
, 1, opindex
);
2708 if (mode
== 0 && r_m
== 6)
2709 x
->d86_opnd
[opindex
].d86_mode
= MODE_SIGNED
;
2711 x
->d86_opnd
[opindex
].d86_mode
= MODE_NONE
;
2713 x
->d86_opnd
[opindex
].d86_mode
= MODE_OFFSET
;
2714 (void) strlcat(opnd
, dis_addr16
[mode
][r_m
], OPLEN
);
2720 * 32 and 64 bit addressing modes are more complex since they
2721 * can involve an SIB (scaled index and base) byte to decode.
2723 if (r_m
== ESP_REGNO
|| r_m
== ESP_REGNO
+ 8) {
2725 dtrace_get_SIB(x
, &ss
, &index
, &base
);
2728 if (base
!= 5 || mode
!= 0)
2729 if (x
->d86_rex_prefix
& REX_B
)
2731 if (x
->d86_rex_prefix
& REX_X
)
2738 * Compute the displacement size and get its bytes
2746 else if ((r_m
& 7) == EBP_REGNO
||
2747 (have_SIB
&& (base
& 7) == EBP_REGNO
))
2751 dtrace_imm_opnd(x
, dispsize
== 4 ? LONG_OPND
: BYTE_OPND
,
2759 x
->d86_opnd
[opindex
].d86_mode
= MODE_OFFSET
;
2761 if (have_SIB
== 0) {
2762 if (x
->d86_mode
== SIZE32
) {
2764 (void) strlcat(opnd
, dis_addr32_mode0
[r_m
],
2767 (void) strlcat(opnd
, dis_addr32_mode12
[r_m
],
2771 (void) strlcat(opnd
, dis_addr64_mode0
[r_m
],
2774 x
->d86_opnd
[opindex
].d86_mode
=
2778 (void) strlcat(opnd
, dis_addr64_mode12
[r_m
],
2783 uint_t need_paren
= 0;
2786 const char *const *sf
;
2787 if (x
->d86_mode
== SIZE32
) /* NOTE this is not addr_size! */
2788 regs
= (char **)dis_REG32
;
2790 regs
= (char **)dis_REG64
;
2792 if (x
->d86_vsib
!= 0) {
2793 if (wbit
== YMM_OPND
) /* NOTE this is not addr_size! */
2794 bregs
= (char **)dis_YMMREG
;
2796 bregs
= (char **)dis_XMMREG
;
2797 sf
= dis_vscale_factor
;
2800 sf
= dis_scale_factor
;
2804 * print the base (if any)
2806 if (base
== EBP_REGNO
&& mode
== 0) {
2807 if (index
!= ESP_REGNO
|| x
->d86_vsib
!= 0) {
2808 (void) strlcat(opnd
, "(", OPLEN
);
2812 (void) strlcat(opnd
, "(", OPLEN
);
2813 (void) strlcat(opnd
, regs
[base
], OPLEN
);
2818 * print the index (if any)
2820 if (index
!= ESP_REGNO
|| x
->d86_vsib
) {
2821 (void) strlcat(opnd
, ",", OPLEN
);
2822 (void) strlcat(opnd
, bregs
[index
], OPLEN
);
2823 (void) strlcat(opnd
, sf
[ss
], OPLEN
);
2826 (void) strlcat(opnd
, ")", OPLEN
);
2832 * Operand sequence for standard instruction involving one register
2833 * and one register/memory operand.
2834 * wbit indicates a byte(0) or opnd_size(1) operation
2835 * vbit indicates direction (0 for "opcode r,r_m") or (1 for "opcode r_m, r")
2837 #define STANDARD_MODRM(x, mode, reg, r_m, rex_prefix, wbit, vbit) { \
2838 dtrace_get_modrm(x, &mode, ®, &r_m); \
2839 dtrace_rex_adjust(rex_prefix, mode, ®, &r_m); \
2840 dtrace_get_operand(x, mode, r_m, wbit, vbit); \
2841 dtrace_get_operand(x, REG_ONLY, reg, wbit, 1 - vbit); \
2845 * Similar to above, but allows for the two operands to be of different
2846 * classes (ie. wbit).
2847 * wbit is for the r_m operand
2848 * w2 is for the reg operand
2850 #define MIXED_MM(x, mode, reg, r_m, rex_prefix, wbit, w2, vbit) { \
2851 dtrace_get_modrm(x, &mode, ®, &r_m); \
2852 dtrace_rex_adjust(rex_prefix, mode, ®, &r_m); \
2853 dtrace_get_operand(x, mode, r_m, wbit, vbit); \
2854 dtrace_get_operand(x, REG_ONLY, reg, w2, 1 - vbit); \
2858 * Similar, but for 2 operands plus an immediate.
2859 * vbit indicates direction
2860 * 0 for "opcode imm, r, r_m" or
2861 * 1 for "opcode imm, r_m, r"
2863 #define THREEOPERAND(x, mode, reg, r_m, rex_prefix, wbit, w2, immsize, vbit) { \
2864 dtrace_get_modrm(x, &mode, ®, &r_m); \
2865 dtrace_rex_adjust(rex_prefix, mode, ®, &r_m); \
2866 dtrace_get_operand(x, mode, r_m, wbit, 2-vbit); \
2867 dtrace_get_operand(x, REG_ONLY, reg, w2, 1+vbit); \
2868 dtrace_imm_opnd(x, wbit, immsize, 0); \
2872 * Similar, but for 2 operands plus two immediates.
2874 #define FOUROPERAND(x, mode, reg, r_m, rex_prefix, wbit, w2, immsize) { \
2875 dtrace_get_modrm(x, &mode, ®, &r_m); \
2876 dtrace_rex_adjust(rex_prefix, mode, ®, &r_m); \
2877 dtrace_get_operand(x, mode, r_m, wbit, 2); \
2878 dtrace_get_operand(x, REG_ONLY, reg, w2, 3); \
2879 dtrace_imm_opnd(x, wbit, immsize, 1); \
2880 dtrace_imm_opnd(x, wbit, immsize, 0); \
2884 * 1 operands plus two immediates.
2886 #define ONEOPERAND_TWOIMM(x, mode, reg, r_m, rex_prefix, wbit, immsize) { \
2887 dtrace_get_modrm(x, &mode, ®, &r_m); \
2888 dtrace_rex_adjust(rex_prefix, mode, ®, &r_m); \
2889 dtrace_get_operand(x, mode, r_m, wbit, 2); \
2890 dtrace_imm_opnd(x, wbit, immsize, 1); \
2891 dtrace_imm_opnd(x, wbit, immsize, 0); \
2895 * Dissassemble a single x86 or amd64 instruction.
2897 * Mode determines the default operating mode (SIZE16, SIZE32 or SIZE64)
2898 * for interpreting instructions.
2900 * returns non-zero for bad opcode
2903 dtrace_disx86(dis86_t
*x
, uint_t cpu_mode
)
2905 instable_t
*dp
; /* decode table being used */
2911 #define NOMEM (nomem = 1)
2913 #define NOMEM /* nothing */
2915 uint_t opnd_size
; /* SIZE16, SIZE32 or SIZE64 */
2916 uint_t addr_size
; /* SIZE16, SIZE32 or SIZE64 */
2917 uint_t wbit
= 0; /* opcode wbit, 0 is 8 bit, !0 for opnd_size */
2918 uint_t w2
; /* wbit value for second operand */
2920 uint_t mode
= 0; /* mode value from ModRM byte */
2921 uint_t reg
= 0; /* reg value from ModRM byte */
2922 uint_t r_m
= 0; /* r_m value from ModRM byte */
2924 uint_t opcode1
= 0; /* high nibble of 1st byte */
2925 uint_t opcode2
= 0; /* low nibble of 1st byte */
2926 uint_t opcode3
= 0; /* extra opcode bits usually from ModRM byte */
2927 uint_t opcode4
= 0; /* high nibble of 2nd byte */
2928 uint_t opcode5
= 0; /* low nibble of 2nd byte */
2929 uint_t opcode6
= 0; /* high nibble of 3rd byte */
2930 uint_t opcode7
= 0; /* low nibble of 3rd byte */
2931 uint_t opcode_bytes
= 1;
2934 * legacy prefixes come in 5 flavors, you should have only one of each
2936 uint_t opnd_size_prefix
= 0;
2937 uint_t addr_size_prefix
= 0;
2938 uint_t segment_prefix
= 0;
2939 uint_t lock_prefix
= 0;
2940 uint_t rep_prefix
= 0;
2941 uint_t rex_prefix
= 0; /* amd64 register extension prefix */
2944 * Intel VEX instruction encoding prefix and fields
2947 /* 0xC4 means 3 bytes prefix, 0xC5 means 2 bytes prefix */
2948 uint_t vex_prefix
= 0;
2951 * VEX prefix byte 1, includes vex.r, vex.x and vex.b
2952 * (for 3 bytes prefix)
2954 uint_t vex_byte1
= 0;
2957 * For 32-bit mode, it should prefetch the next byte to
2958 * distinguish between AVX and les/lds
2960 uint_t vex_prefetch
= 0;
2970 dis_gather_regs_t
*vreg
;
2973 /* Instruction name for BLS* family of instructions */
2982 x
->d86_rmindex
= -1;
2985 x
->d86_numopnds
= 0;
2986 x
->d86_seg_prefix
= NULL
;
2988 for (i
= 0; i
< 4; ++i
) {
2989 x
->d86_opnd
[i
].d86_opnd
[0] = 0;
2990 x
->d86_opnd
[i
].d86_prefix
[0] = 0;
2991 x
->d86_opnd
[i
].d86_value_size
= 0;
2992 x
->d86_opnd
[i
].d86_value
= 0;
2993 x
->d86_opnd
[i
].d86_mode
= MODE_NONE
;
2996 x
->d86_rex_prefix
= 0;
2997 x
->d86_got_modrm
= 0;
3001 if (cpu_mode
== SIZE16
) {
3004 } else if (cpu_mode
== SIZE32
) {
3013 * Get one opcode byte and check for zero padding that follows
3016 if (dtrace_get_opcode(x
, &opcode1
, &opcode2
) != 0)
3019 if (opcode1
== 0 && opcode2
== 0 &&
3020 x
->d86_check_func
!= NULL
&& x
->d86_check_func(x
->d86_data
)) {
3022 (void) strncpy(x
->d86_mnem
, ".byte\t0", OPLEN
);
3028 * Gather up legacy x86 prefix bytes.
3031 uint_t
*which_prefix
= NULL
;
3033 dp
= (instable_t
*)&dis_distable
[opcode1
][opcode2
];
3035 switch (dp
->it_adrmode
) {
3037 which_prefix
= &rep_prefix
;
3040 which_prefix
= &lock_prefix
;
3043 which_prefix
= &segment_prefix
;
3045 x
->d86_seg_prefix
= (char *)dp
->it_name
;
3047 if (dp
->it_invalid64
&& cpu_mode
== SIZE64
)
3051 which_prefix
= &addr_size_prefix
;
3054 which_prefix
= &opnd_size_prefix
;
3057 if (which_prefix
== NULL
)
3059 *which_prefix
= (opcode1
<< 4) | opcode2
;
3060 if (dtrace_get_opcode(x
, &opcode1
, &opcode2
) != 0)
3065 * Handle amd64 mode PREFIX values.
3066 * Some of the segment prefixes are no-ops. (only FS/GS actually work)
3067 * We might have a REX prefix (opcodes 0x40-0x4f)
3069 if (cpu_mode
== SIZE64
) {
3070 if (segment_prefix
!= 0x64 && segment_prefix
!= 0x65)
3073 if (opcode1
== 0x4) {
3074 rex_prefix
= (opcode1
<< 4) | opcode2
;
3075 if (dtrace_get_opcode(x
, &opcode1
, &opcode2
) != 0)
3077 dp
= (instable_t
*)&dis_distable
[opcode1
][opcode2
];
3078 } else if (opcode1
== 0xC &&
3079 (opcode2
== 0x4 || opcode2
== 0x5)) {
3080 /* AVX instructions */
3081 vex_prefix
= (opcode1
<< 4) | opcode2
;
3082 x
->d86_rex_prefix
= 0x40;
3084 } else if (opcode1
== 0xC && (opcode2
== 0x4 || opcode2
== 0x5)) {
3085 /* LDS, LES or AVX */
3086 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
3089 if (mode
== REG_ONLY
) {
3091 vex_prefix
= (opcode1
<< 4) | opcode2
;
3092 x
->d86_rex_prefix
= 0x40;
3093 opcode3
= (((mode
<< 3) | reg
)>>1) & 0x0F;
3094 opcode4
= ((reg
<< 3) | r_m
) & 0x0F;
3098 if (vex_prefix
== VEX_2bytes
) {
3099 if (!vex_prefetch
) {
3100 if (dtrace_get_opcode(x
, &opcode3
, &opcode4
) != 0)
3103 vex_R
= ((opcode3
& VEX_R
) & 0x0F) >> 3;
3104 vex_L
= ((opcode4
& VEX_L
) & 0x0F) >> 2;
3105 vex_v
= (((opcode3
<< 4) | opcode4
) & VEX_v
) >> 3;
3106 vex_p
= opcode4
& VEX_p
;
3108 * The vex.x and vex.b bits are not defined in two bytes
3109 * mode vex prefix, their default values are 1
3111 vex_byte1
= (opcode3
& VEX_R
) | VEX_X
| VEX_B
;
3114 x
->d86_rex_prefix
|= REX_R
;
3116 if (dtrace_get_opcode(x
, &opcode1
, &opcode2
) != 0)
3122 &dis_opAVX660F
[(opcode1
<< 4) | opcode2
];
3126 &dis_opAVXF30F
[(opcode1
<< 4) | opcode2
];
3130 &dis_opAVXF20F
[(opcode1
<< 4) | opcode2
];
3134 &dis_opAVX0F
[opcode1
][opcode2
];
3138 } else if (vex_prefix
== VEX_3bytes
) {
3139 if (!vex_prefetch
) {
3140 if (dtrace_get_opcode(x
, &opcode3
, &opcode4
) != 0)
3143 vex_R
= (opcode3
& VEX_R
) >> 3;
3144 vex_X
= (opcode3
& VEX_X
) >> 2;
3145 vex_B
= (opcode3
& VEX_B
) >> 1;
3146 vex_m
= (((opcode3
<< 4) | opcode4
) & VEX_m
);
3147 vex_byte1
= opcode3
& (VEX_R
| VEX_X
| VEX_B
);
3150 x
->d86_rex_prefix
|= REX_R
;
3152 x
->d86_rex_prefix
|= REX_X
;
3154 x
->d86_rex_prefix
|= REX_B
;
3156 if (dtrace_get_opcode(x
, &opcode5
, &opcode6
) != 0)
3158 vex_W
= (opcode5
& VEX_W
) >> 3;
3159 vex_L
= (opcode6
& VEX_L
) >> 2;
3160 vex_v
= (((opcode5
<< 4) | opcode6
) & VEX_v
) >> 3;
3161 vex_p
= opcode6
& VEX_p
;
3164 x
->d86_rex_prefix
|= REX_W
;
3166 /* Only these three vex_m values valid; others are reserved */
3167 if ((vex_m
!= VEX_m_0F
) && (vex_m
!= VEX_m_0F38
) &&
3168 (vex_m
!= VEX_m_0F3A
))
3171 if (dtrace_get_opcode(x
, &opcode1
, &opcode2
) != 0)
3176 if (vex_m
== VEX_m_0F
) {
3179 [(opcode1
<< 4) | opcode2
];
3180 } else if (vex_m
== VEX_m_0F38
) {
3183 [(opcode1
<< 4) | opcode2
];
3184 } else if (vex_m
== VEX_m_0F3A
) {
3187 [(opcode1
<< 4) | opcode2
];
3193 if (vex_m
== VEX_m_0F
) {
3196 [(opcode1
<< 4) | opcode2
];
3197 } else if (vex_m
== VEX_m_0F38
) {
3200 [(opcode1
<< 4) | opcode2
];
3206 if (vex_m
== VEX_m_0F
) {
3209 [(opcode1
<< 4) | opcode2
];
3210 } else if (vex_m
== VEX_m_0F3A
) {
3213 [(opcode1
<< 4) | opcode2
];
3214 } else if (vex_m
== VEX_m_0F38
) {
3217 [(opcode1
<< 4) | opcode2
];
3224 &dis_opAVX0F
[opcode1
][opcode2
];
3229 if (dp
->it_vexwoxmm
) {
3240 * Deal with selection of operand and address size now.
3241 * Note that the REX.W bit being set causes opnd_size_prefix to be
3244 if (cpu_mode
== SIZE64
) {
3245 if ((rex_prefix
& REX_W
) || vex_W
)
3247 else if (opnd_size_prefix
)
3250 if (addr_size_prefix
)
3252 } else if (cpu_mode
== SIZE32
) {
3253 if (opnd_size_prefix
)
3255 if (addr_size_prefix
)
3258 if (opnd_size_prefix
)
3260 if (addr_size_prefix
)
3264 * The pause instruction - a repz'd nop. This doesn't fit
3265 * with any of the other prefix goop added for SSE, so we'll
3266 * special-case it here.
3268 if (rep_prefix
== 0xf3 && opcode1
== 0x9 && opcode2
== 0x0) {
3270 dp
= (instable_t
*)&dis_opPause
;
3274 * Some 386 instructions have 2 bytes of opcode before the mod_r/m
3275 * byte so we may need to perform a table indirection.
3277 if (dp
->it_indirect
== (instable_t
*)dis_op0F
) {
3278 if (dtrace_get_opcode(x
, &opcode4
, &opcode5
) != 0)
3281 if (opcode4
== 0x7 && opcode5
>= 0x1 && opcode5
<= 0x3) {
3284 if (dtrace_get_opcode(x
, &opcode6
, &opcode7
) != 0)
3287 subcode
= ((opcode6
& 0x3) << 1) |
3288 ((opcode7
& 0x8) >> 3);
3289 dp
= (instable_t
*)&dis_op0F7123
[opcode5
][subcode
];
3290 } else if ((opcode4
== 0xc) && (opcode5
>= 0x8)) {
3291 dp
= (instable_t
*)&dis_op0FC8
[0];
3292 } else if ((opcode4
== 0x3) && (opcode5
== 0xA)) {
3294 if (dtrace_get_opcode(x
, &opcode6
, &opcode7
) != 0)
3296 if (opnd_size
== SIZE16
)
3299 dp
= (instable_t
*)&dis_op0F3A
[(opcode6
<<4)|opcode7
];
3301 if (LIT_STRNEQL(dp
->it_name
, "INVALID"))
3304 switch (dp
->it_adrmode
) {
3310 if (opnd_size_prefix
== 0) {
3315 if (opnd_size_prefix
== 0) {
3316 /* SSSE3 MMX instructions */
3319 dp
->it_adrmode
= MMOPM_66o
;
3328 } else if ((opcode4
== 0x3) && (opcode5
== 0x8)) {
3330 if (dtrace_get_opcode(x
, &opcode6
, &opcode7
) != 0)
3332 dp
= (instable_t
*)&dis_op0F38
[(opcode6
<<4)|opcode7
];
3335 * Both crc32 and movbe have the same 3rd opcode
3336 * byte of either 0xF0 or 0xF1, so we use another
3337 * indirection to distinguish between the two.
3339 if (dp
->it_indirect
== (instable_t
*)dis_op0F38F0
||
3340 dp
->it_indirect
== (instable_t
*)dis_op0F38F1
) {
3342 dp
= dp
->it_indirect
;
3343 if (rep_prefix
!= 0xF2) {
3350 * The adx family of instructions (adcx and adox)
3351 * continue the classic Intel tradition of abusing
3352 * arbitrary prefixes without actually meaning the
3353 * prefix bit. Therefore, if we find either the
3354 * opnd_size_prefix or rep_prefix we end up zeroing it
3355 * out after making our determination so as to ensure
3356 * that we don't get confused and accidentally print
3357 * repz prefixes and the like on these instructions.
3359 * In addition, these instructions are actually much
3360 * closer to AVX instructions in semantics. Importantly,
3361 * they always default to having 32-bit operands.
3362 * However, if the CPU is in 64-bit mode, then and only
3363 * then, does it use REX.w promotes things to 64-bits
3364 * and REX.r allows 64-bit mode to use register r8-r15.
3366 if (dp
->it_indirect
== (instable_t
*)dis_op0F38F6
) {
3367 dp
= dp
->it_indirect
;
3368 if (opnd_size_prefix
== 0 &&
3369 rep_prefix
== 0xf3) {
3372 } else if (opnd_size_prefix
!= 0x66 &&
3377 opnd_size_prefix
= 0;
3380 if (rex_prefix
& REX_W
)
3385 if (LIT_STRNEQL(dp
->it_name
, "INVALID"))
3388 switch (dp
->it_adrmode
) {
3395 if (opnd_size_prefix
== 0) {
3400 if (opnd_size_prefix
== 0) {
3401 /* SSSE3 MMX instructions */
3404 dp
->it_adrmode
= MM
;
3411 if (rep_prefix
!= 0xF2) {
3417 if (rep_prefix
!= 0x0) {
3425 dp
= (instable_t
*)&dis_op0F
[opcode4
][opcode5
];
3430 * If still not at a TERM decode entry, then a ModRM byte
3431 * exists and its fields further decode the instruction.
3433 x
->d86_got_modrm
= 0;
3434 if (dp
->it_indirect
!= TERM
) {
3435 dtrace_get_modrm(x
, &mode
, &opcode3
, &r_m
);
3441 * decode 287 instructions (D8-DF) from opcodeN
3443 if (opcode1
== 0xD && opcode2
>= 0x8) {
3444 if (opcode2
== 0xB && mode
== 0x3 && opcode3
== 4)
3445 dp
= (instable_t
*)&dis_opFP5
[r_m
];
3446 else if (opcode2
== 0xA && mode
== 0x3 && opcode3
< 4)
3447 dp
= (instable_t
*)&dis_opFP7
[opcode3
];
3448 else if (opcode2
== 0xB && mode
== 0x3)
3449 dp
= (instable_t
*)&dis_opFP6
[opcode3
];
3450 else if (opcode2
== 0x9 && mode
== 0x3 && opcode3
>= 4)
3451 dp
= (instable_t
*)&dis_opFP4
[opcode3
- 4][r_m
];
3452 else if (mode
== 0x3)
3454 &dis_opFP3
[opcode2
- 8][opcode3
];
3457 &dis_opFP1n2
[opcode2
- 8][opcode3
];
3459 dp
= (instable_t
*)dp
->it_indirect
+ opcode3
;
3464 * In amd64 bit mode, ARPL opcode is changed to MOVSXD
3465 * (sign extend 32bit to 64 bit)
3467 if ((vex_prefix
== 0) && cpu_mode
== SIZE64
&&
3468 opcode1
== 0x6 && opcode2
== 0x3)
3470 dp
= (instable_t
*)&dis_opMOVSLD
;
3474 * at this point we should have a correct (or invalid) opcode
3476 if ((cpu_mode
== SIZE64
&& dp
->it_invalid64
) ||
3477 (cpu_mode
!= SIZE64
&& dp
->it_invalid32
))
3479 if (dp
->it_indirect
!= TERM
)
3483 * Deal with MMX/SSE opcodes which are changed by prefixes. Note, we do
3484 * need to include UNKNOWN below, as we may have instructions that
3485 * actually have a prefix, but don't exist in any other form.
3487 switch (dp
->it_adrmode
) {
3506 * This is horrible. Some SIMD instructions take the
3507 * form 0x0F 0x?? ..., which is easily decoded using the
3508 * existing tables. Other SIMD instructions use various
3509 * prefix bytes to overload existing instructions. For
3510 * Example, addps is F0, 58, whereas addss is F3 (repz),
3511 * F0, 58. Presumably someone got a raise for this.
3513 * If we see one of the instructions which can be
3514 * modified in this way (if we've got one of the SIMDO*
3515 * address modes), we'll check to see if the last prefix
3516 * was a repz. If it was, we strip the prefix from the
3517 * mnemonic, and we indirect using the dis_opSIMDrepz
3522 * Calculate our offset in dis_op0F
3524 if ((uintptr_t)dp
- (uintptr_t)dis_op0F
> sizeof (dis_op0F
))
3527 off
= ((uintptr_t)dp
- (uintptr_t)dis_op0F
) /
3528 sizeof (instable_t
);
3531 * Rewrite if this instruction used one of the magic prefixes.
3534 if (rep_prefix
== 0xf2)
3535 dp
= (instable_t
*)&dis_opSIMDrepnz
[off
];
3537 dp
= (instable_t
*)&dis_opSIMDrepz
[off
];
3539 } else if (opnd_size_prefix
) {
3540 dp
= (instable_t
*)&dis_opSIMDdata16
[off
];
3541 opnd_size_prefix
= 0;
3542 if (opnd_size
== SIZE16
)
3549 * More horribleness: the group 9 (0xF0 0xC7) instructions are
3550 * allowed an optional prefix of 0x66 or 0xF3. This is similar
3551 * to the SIMD business described above, but with a different
3552 * addressing mode (and an indirect table), so we deal with it
3553 * separately (if similarly).
3555 * Intel further complicated this with the release of Ivy Bridge
3556 * where they overloaded these instructions based on the ModR/M
3557 * bytes. The VMX instructions have a mode of 0 since they are
3558 * memory instructions but rdrand instructions have a mode of
3559 * 0b11 (REG_ONLY) because they only operate on registers. While
3560 * there are different prefix formats, for now it is sufficient
3561 * to use a single different table.
3565 * Calculate our offset in dis_op0FC7 (the group 9 table)
3567 if ((uintptr_t)dp
- (uintptr_t)dis_op0FC7
> sizeof (dis_op0FC7
))
3570 off
= ((uintptr_t)dp
- (uintptr_t)dis_op0FC7
) /
3571 sizeof (instable_t
);
3574 * If we have a mode of 0b11 then we have to rewrite this.
3576 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
3577 if (mode
== REG_ONLY
) {
3578 dp
= (instable_t
*)&dis_op0FC7m3
[off
];
3583 * Rewrite if this instruction used one of the magic prefixes.
3586 if (rep_prefix
== 0xf3)
3587 dp
= (instable_t
*)&dis_opF30FC7
[off
];
3591 } else if (opnd_size_prefix
) {
3592 dp
= (instable_t
*)&dis_op660FC7
[off
];
3593 opnd_size_prefix
= 0;
3594 if (opnd_size
== SIZE16
)
3602 * As with the "normal" SIMD instructions, the MMX
3603 * shuffle instructions are overloaded. These
3604 * instructions, however, are special in that they use
3605 * an extra byte, and thus an extra table. As of this
3606 * writing, they only use the opnd_size prefix.
3610 * Calculate our offset in dis_op0F7123
3612 if ((uintptr_t)dp
- (uintptr_t)dis_op0F7123
>
3613 sizeof (dis_op0F7123
))
3616 if (opnd_size_prefix
) {
3617 off
= ((uintptr_t)dp
- (uintptr_t)dis_op0F7123
) /
3618 sizeof (instable_t
);
3619 dp
= (instable_t
*)&dis_opSIMD7123
[off
];
3620 opnd_size_prefix
= 0;
3621 if (opnd_size
== SIZE16
)
3627 if (rep_prefix
== 0xf3) {
3630 * Calculate our offset in dis_op0F
3632 if ((uintptr_t)dp
- (uintptr_t)dis_op0F
3633 > sizeof (dis_op0F
))
3636 off
= ((uintptr_t)dp
- (uintptr_t)dis_op0F
) /
3637 sizeof (instable_t
);
3639 dp
= (instable_t
*)&dis_opSIMDrepz
[off
];
3649 * In 64 bit mode, some opcodes automatically use opnd_size == SIZE64.
3651 if (cpu_mode
== SIZE64
)
3652 if (dp
->it_always64
|| (opnd_size
== SIZE32
&& dp
->it_stackop
))
3657 * At this point most instructions can format the opcode mnemonic
3658 * including the prefixes.
3661 (void) strlcat(x
->d86_mnem
, "lock ", OPLEN
);
3663 if (rep_prefix
== 0xf2)
3664 (void) strlcat(x
->d86_mnem
, "repnz ", OPLEN
);
3665 else if (rep_prefix
== 0xf3)
3666 (void) strlcat(x
->d86_mnem
, "repz ", OPLEN
);
3668 if (cpu_mode
== SIZE64
&& addr_size_prefix
)
3669 (void) strlcat(x
->d86_mnem
, "addr32 ", OPLEN
);
3671 if (dp
->it_adrmode
!= CBW
&&
3672 dp
->it_adrmode
!= CWD
&&
3673 dp
->it_adrmode
!= XMMSFNC
) {
3674 if (LIT_STRNEQL(dp
->it_name
, "INVALID"))
3676 (void) strlcat(x
->d86_mnem
, dp
->it_name
, OPLEN
);
3677 if (dp
->it_avxsuf
&& dp
->it_suffix
) {
3678 (void) strlcat(x
->d86_mnem
, vex_W
!= 0 ? "q" : "d",
3680 } else if (dp
->it_suffix
) {
3681 char *types
[] = {"", "w", "l", "q"};
3682 if (opcode_bytes
== 2 && opcode4
== 4) {
3683 /* It's a cmovx.yy. Replace the suffix x */
3684 for (i
= 5; i
< OPLEN
; i
++) {
3685 if (x
->d86_mnem
[i
] == '.')
3688 x
->d86_mnem
[i
- 1] = *types
[opnd_size
];
3689 } else if ((opnd_size
== 2) && (opcode_bytes
== 3) &&
3690 ((opcode6
== 1 && opcode7
== 6) ||
3691 (opcode6
== 2 && opcode7
== 2))) {
3693 * To handle PINSRD and PEXTRD
3695 (void) strlcat(x
->d86_mnem
, "d", OPLEN
);
3697 (void) strlcat(x
->d86_mnem
, types
[opnd_size
],
3705 * Process operands based on the addressing modes.
3707 x
->d86_mode
= cpu_mode
;
3709 * In vex mode the rex_prefix has no meaning
3712 x
->d86_rex_prefix
= rex_prefix
;
3713 x
->d86_opnd_size
= opnd_size
;
3714 x
->d86_addr_size
= addr_size
;
3715 vbit
= 0; /* initialize for mem/reg -> reg */
3716 switch (dp
->it_adrmode
) {
3718 * amd64 instruction to sign extend 32 bit reg/mem operands
3719 * into 64 bit register values
3723 if (rex_prefix
== 0) {
3724 (void) strncpy(x
->d86_mnem
, "movzld", OPLEN
);
3725 x
->d86_mnem
[OPLEN
- 1] = '\0';
3728 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
3729 dtrace_rex_adjust(rex_prefix
, mode
, ®
, &r_m
);
3730 x
->d86_opnd_size
= SIZE64
;
3731 dtrace_get_operand(x
, REG_ONLY
, reg
, LONG_OPND
, 1);
3732 x
->d86_opnd_size
= opnd_size
= SIZE32
;
3734 dtrace_get_operand(x
, mode
, r_m
, wbit
, 0);
3738 * movsbl movsbw movsbq (0x0FBE) or movswl movswq (0x0FBF)
3739 * movzbl movzbw movzbq (0x0FB6) or movzwl movzwq (0x0FB7)
3740 * wbit lives in 2nd byte, note that operands
3741 * are different sized
3744 if (rex_prefix
& REX_W
) {
3745 /* target register size = 64 bit */
3746 x
->d86_mnem
[5] = 'q';
3748 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
3749 dtrace_rex_adjust(rex_prefix
, mode
, ®
, &r_m
);
3750 dtrace_get_operand(x
, REG_ONLY
, reg
, LONG_OPND
, 1);
3751 x
->d86_opnd_size
= opnd_size
= SIZE16
;
3752 wbit
= WBIT(opcode5
);
3753 dtrace_get_operand(x
, mode
, r_m
, wbit
, 0);
3757 if (rex_prefix
& REX_W
)
3759 x
->d86_opnd_size
= opnd_size
;
3761 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
3762 dtrace_rex_adjust(rex_prefix
, mode
, ®
, &r_m
);
3763 dtrace_get_operand(x
, REG_ONLY
, reg
, LONG_OPND
, 1);
3764 wbit
= WBIT(opcode7
);
3765 if (opnd_size_prefix
)
3766 x
->d86_opnd_size
= opnd_size
= SIZE16
;
3767 dtrace_get_operand(x
, mode
, r_m
, wbit
, 0);
3771 if (rex_prefix
& REX_W
)
3773 x
->d86_opnd_size
= opnd_size
;
3775 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
3776 dtrace_rex_adjust(rex_prefix
, mode
, ®
, &r_m
);
3777 wbit
= WBIT(opcode7
);
3778 if (opnd_size_prefix
)
3779 x
->d86_opnd_size
= opnd_size
= SIZE16
;
3782 dtrace_get_operand(x
, REG_ONLY
, reg
, LONG_OPND
, 0);
3783 dtrace_get_operand(x
, mode
, r_m
, wbit
, 1);
3786 dtrace_get_operand(x
, REG_ONLY
, reg
, LONG_OPND
, 1);
3787 dtrace_get_operand(x
, mode
, r_m
, wbit
, 0);
3792 * imul instruction, with either 8-bit or longer immediate
3793 * opcode 0x6B for byte, sign-extended displacement, 0x69 for word(s)
3797 THREEOPERAND(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, LONG_OPND
,
3798 OPSIZE(opnd_size
, opcode2
== 0x9), 1);
3801 /* memory or register operand to register, with 'w' bit */
3804 wbit
= WBIT(opcode2
);
3805 STANDARD_MODRM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, 0);
3808 /* register to memory or register operand, with 'w' bit */
3809 /* arpl happens to fit here also because it is odd */
3811 if (opcode_bytes
== 2)
3812 wbit
= WBIT(opcode5
);
3814 wbit
= WBIT(opcode2
);
3815 STANDARD_MODRM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, 1);
3818 /* xaddb instruction */
3821 STANDARD_MODRM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, 1);
3824 /* MMX register to memory or register operand */
3828 wbit
= !LIT_STRNEQL(dp
->it_name
, "movd") ? MM_OPND
: LONG_OPND
;
3832 MIXED_MM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, MM_OPND
, 1);
3835 /* MMX register to memory */
3837 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
3838 if (mode
== REG_ONLY
)
3841 MIXED_MM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, MM_OPND
, 1);
3844 /* Double shift. Has immediate operand specifying the shift. */
3847 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
3848 dtrace_rex_adjust(rex_prefix
, mode
, ®
, &r_m
);
3849 dtrace_get_operand(x
, mode
, r_m
, wbit
, 2);
3850 dtrace_get_operand(x
, REG_ONLY
, reg
, LONG_OPND
, 1);
3851 dtrace_imm_opnd(x
, wbit
, 1, 0);
3855 * Double shift. With no immediate operand, specifies using %cl.
3859 STANDARD_MODRM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, 1);
3862 /* immediate to memory or register operand */
3864 wbit
= WBIT(opcode2
);
3865 dtrace_rex_adjust(rex_prefix
, mode
, NULL
, &r_m
);
3866 dtrace_get_operand(x
, mode
, r_m
, wbit
, 1);
3868 * Have long immediate for opcode 0x81, but not 0x80 nor 0x83
3870 dtrace_imm_opnd(x
, wbit
, OPSIZE(opnd_size
, opcode2
== 1), 0);
3873 /* immediate to memory or register operand with the */
3874 /* 'w' bit present */
3876 wbit
= WBIT(opcode2
);
3877 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
3878 dtrace_rex_adjust(rex_prefix
, mode
, NULL
, &r_m
);
3879 dtrace_get_operand(x
, mode
, r_m
, wbit
, 1);
3880 dtrace_imm_opnd(x
, wbit
, OPSIZE(opnd_size
, wbit
), 0);
3883 /* immediate to register with register in low 3 bits */
3886 /* w-bit here (with regs) is bit 3 */
3887 wbit
= opcode2
>>3 & 0x1;
3888 reg
= REGNO(opcode2
);
3889 dtrace_rex_adjust(rex_prefix
, mode
, ®
, NULL
);
3892 dtrace_get_operand(x
, mode
, r_m
, wbit
, 1);
3893 dtrace_imm_opnd(x
, wbit
, OPSIZE64(opnd_size
, wbit
), 0);
3896 /* MMX immediate shift of register */
3900 goto mm_shift
; /* in next case */
3902 /* SIMD immediate shift of register */
3906 reg
= REGNO(opcode7
);
3907 dtrace_rex_adjust(rex_prefix
, mode
, ®
, NULL
);
3908 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 1);
3909 dtrace_imm_opnd(x
, wbit
, 1, 0);
3913 /* accumulator to memory operand */
3918 /* memory operand to accumulator */
3920 wbit
= WBIT(opcode2
);
3921 dtrace_get_operand(x
, REG_ONLY
, EAX_REGNO
, wbit
, 1 - vbit
);
3922 dtrace_imm_opnd(x
, wbit
, OPSIZE64(addr_size
, LONG_OPND
), vbit
);
3924 x
->d86_opnd
[vbit
].d86_mode
= MODE_OFFSET
;
3929 /* segment register to memory or register operand */
3934 /* memory or register operand to segment register */
3936 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
3937 dtrace_rex_adjust(rex_prefix
, mode
, NULL
, &r_m
);
3938 dtrace_get_operand(x
, mode
, r_m
, LONG_OPND
, vbit
);
3939 dtrace_get_operand(x
, REG_ONLY
, reg
, SEG_OPND
, 1 - vbit
);
3943 * rotate or shift instructions, which may shift by 1 or
3944 * consult the cl register, depending on the 'v' bit
3947 vbit
= VBIT(opcode2
);
3948 wbit
= WBIT(opcode2
);
3949 dtrace_rex_adjust(rex_prefix
, mode
, NULL
, &r_m
);
3950 dtrace_get_operand(x
, mode
, r_m
, wbit
, 1);
3953 (void) strlcat(x
->d86_opnd
[0].d86_opnd
, "%cl", OPLEN
);
3955 x
->d86_opnd
[0].d86_mode
= MODE_SIGNED
;
3956 x
->d86_opnd
[0].d86_value_size
= 1;
3957 x
->d86_opnd
[0].d86_value
= 1;
3962 * immediate rotate or shift instructions
3965 wbit
= WBIT(opcode2
);
3967 dtrace_rex_adjust(rex_prefix
, mode
, NULL
, &r_m
);
3968 dtrace_get_operand(x
, mode
, r_m
, wbit
, 1);
3969 dtrace_imm_opnd(x
, wbit
, 1, 0);
3972 /* bit test instructions */
3975 goto normal_imm_mem
;
3977 /* single memory or register operand with 'w' bit present */
3979 wbit
= WBIT(opcode2
);
3981 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
3982 dtrace_rex_adjust(rex_prefix
, mode
, NULL
, &r_m
);
3983 dtrace_get_operand(x
, mode
, r_m
, wbit
, 0);
3987 if (cpu_mode
== SIZE64
&& mode
== 3 && r_m
== 0) {
3989 (void) strncpy(x
->d86_mnem
, "swapgs", OPLEN
);
3990 x
->d86_mnem
[OPLEN
- 1] = '\0';
3994 } else if (mode
== 3 && r_m
== 1) {
3996 (void) strncpy(x
->d86_mnem
, "rdtscp", OPLEN
);
4004 /* prefetch instruction - memory operand, but no memory acess */
4009 /* single memory or register operand */
4015 /* single memory or register byte operand */
4030 vminstr
= "vmlaunch";
4033 vminstr
= "vmresume";
4042 (void) strncpy(x
->d86_mnem
, vminstr
, OPLEN
);
4044 if (r_m
< 1 || r_m
> 4)
4084 (void) strncpy(x
->d86_mnem
, vinstr
, OPLEN
);
4094 (void) strncpy(x
->d86_mnem
, "monitor", OPLEN
);
4095 x
->d86_mnem
[OPLEN
- 1] = '\0';
4099 } else if (r_m
== 1) {
4101 (void) strncpy(x
->d86_mnem
, "mwait", OPLEN
);
4102 x
->d86_mnem
[OPLEN
- 1] = '\0';
4106 } else if (r_m
== 2) {
4108 (void) strncpy(x
->d86_mnem
, "clac", OPLEN
);
4112 } else if (r_m
== 3) {
4114 (void) strncpy(x
->d86_mnem
, "stac", OPLEN
);
4127 (void) strncpy(x
->d86_mnem
, "xgetbv", OPLEN
);
4131 } else if (r_m
== 1) {
4133 (void) strncpy(x
->d86_mnem
, "xsetbv", OPLEN
);
4144 /* Similar to M, but only memory (no direct registers) */
4146 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
4149 dtrace_rex_adjust(rex_prefix
, mode
, NULL
, &r_m
);
4150 dtrace_get_operand(x
, mode
, r_m
, wbit
, 0);
4153 /* move special register to register or reverse if vbit */
4161 wbit
= CONTROL_OPND
;
4179 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
4180 dtrace_rex_adjust(rex_prefix
, mode
, ®
, &r_m
);
4181 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, vbit
);
4182 dtrace_get_operand(x
, REG_ONLY
, r_m
, LONG_OPND
, 1 - vbit
);
4187 * single register operand with register in the low 3
4191 if (opcode_bytes
== 2)
4192 reg
= REGNO(opcode5
);
4194 reg
= REGNO(opcode2
);
4195 dtrace_rex_adjust(rex_prefix
, mode
, ®
, NULL
);
4196 dtrace_get_operand(x
, REG_ONLY
, reg
, LONG_OPND
, 0);
4201 * register to accumulator with register in the low 3
4202 * bits of op code, xchg instructions
4206 reg
= REGNO(opcode2
);
4207 dtrace_rex_adjust(rex_prefix
, mode
, ®
, NULL
);
4208 dtrace_get_operand(x
, REG_ONLY
, reg
, LONG_OPND
, 0);
4209 dtrace_get_operand(x
, REG_ONLY
, EAX_REGNO
, LONG_OPND
, 1);
4213 * single segment register operand, with register in
4214 * bits 3-4 of op code byte
4218 reg
= (x
->d86_bytes
[x
->d86_len
- 1] >> 3) & 0x3;
4219 dtrace_get_operand(x
, REG_ONLY
, reg
, SEG_OPND
, 0);
4223 * single segment register operand, with register in
4224 * bits 3-5 of op code
4228 /* long seg reg from opcode */
4229 reg
= (x
->d86_bytes
[x
->d86_len
- 1] >> 3) & 0x7;
4230 dtrace_get_operand(x
, REG_ONLY
, reg
, SEG_OPND
, 0);
4233 /* memory or register operand to register */
4236 x
->d86_got_modrm
= 1;
4238 STANDARD_MODRM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, 0);
4244 STANDARD_MODRM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, 1);
4247 /* MMX/SIMD-Int memory or mm reg to mm reg */
4251 wbit
= !LIT_STRNEQL(dp
->it_name
, "movd") ? MM_OPND
: LONG_OPND
;
4255 MIXED_MM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, MM_OPND
, 0);
4260 wbit
= !LIT_STRNEQL(dp
->it_name
, "movd") ? MM_OPND
: LONG_OPND
;
4264 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
4265 if (mode
!= REG_ONLY
)
4268 dtrace_rex_adjust(rex_prefix
, mode
, ®
, &r_m
);
4269 dtrace_get_operand(x
, mode
, r_m
, wbit
, 0);
4270 dtrace_get_operand(x
, REG_ONLY
, reg
, MM_OPND
, 1);
4271 mode
= 0; /* change for memory access size... */
4274 /* MMX/SIMD-Int and SIMD-FP predicated mm reg to r32 */
4281 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
4282 if (mode
!= REG_ONLY
)
4285 THREEOPERAND(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, LONG_OPND
, 1,
4291 THREEOPERAND(x
, mode
, reg
, r_m
, rex_prefix
, LONG_OPND
, XMM_OPND
,
4295 /* MMX/SIMD-Int predicated r32/mem to mm reg */
4305 THREEOPERAND(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, w2
, 1, 1);
4308 /* MMX/SIMD-Int predicated mm/mem to mm reg */
4311 wbit
= w2
= MM_OPND
;
4314 /* MMX/SIMD-Int mm reg to r32 */
4317 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
4318 if (mode
!= REG_ONLY
)
4321 MIXED_MM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, LONG_OPND
, 0);
4324 /* SIMD memory or xmm reg operand to xmm reg */
4331 STANDARD_MODRM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, 0);
4333 if (dp
->it_adrmode
== XMMXIMPL
&& mode
!= REG_ONLY
)
4338 * movlps and movhlps share opcodes. They differ in the
4339 * addressing modes allowed for their operands.
4340 * movhps and movlhps behave similarly.
4342 if (mode
== REG_ONLY
) {
4343 if (LIT_STRNEQL(dp
->it_name
, "movlps")) {
4344 (void) strncpy(x
->d86_mnem
, "movhlps", OPLEN
);
4345 x
->d86_mnem
[OPLEN
- 1] = '\0';
4346 } else if (strcmp(dp
->it_name
, "movhps") == 0) {
4347 (void) strncpy(x
->d86_mnem
, "movlhps", OPLEN
);
4348 x
->d86_mnem
[OPLEN
- 1] = '\0';
4352 if (dp
->it_adrmode
== XMMXIMPL
)
4353 mode
= 0; /* change for memory access size... */
4356 /* SIMD xmm reg to memory or xmm reg */
4361 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
4363 if ((LIT_STRNEQL(dp
->it_name
, "movlps") ||
4364 LIT_STRNEQL(dp
->it_name
, "movhps") ||
4365 LIT_STRNEQL(dp
->it_name
, "movntps")) &&
4370 MIXED_MM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, XMM_OPND
, 1);
4373 /* SIMD memory to xmm reg */
4378 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
4380 if (mode
== REG_ONLY
) {
4381 if (LIT_STRNEQL(dp
->it_name
, "movhps")) {
4382 (void) strncpy(x
->d86_mnem
, "movlhps", OPLEN
);
4383 x
->d86_mnem
[OPLEN
- 1] = '\0';
4388 MIXED_MM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, XMM_OPND
, 0);
4391 /* SIMD memory or r32 to xmm reg */
4394 MIXED_MM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, XMM_OPND
, 0);
4399 MIXED_MM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, XMM_OPND
, 1);
4402 /* SIMD memory or mm reg to xmm reg */
4404 /* SIMD mm to xmm */
4407 MIXED_MM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, XMM_OPND
, 0);
4410 /* SIMD memory or xmm reg to mm reg */
4415 MIXED_MM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, MM_OPND
, 0);
4419 /* SIMD memory or xmm reg to r32 */
4422 MIXED_MM(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, LONG_OPND
, 0);
4425 /* SIMD xmm to r32 */
4428 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
4429 if (mode
!= REG_ONLY
)
4431 dtrace_rex_adjust(rex_prefix
, mode
, ®
, &r_m
);
4432 dtrace_get_operand(x
, mode
, r_m
, XMM_OPND
, 0);
4433 dtrace_get_operand(x
, REG_ONLY
, reg
, LONG_OPND
, 1);
4437 /* SIMD predicated memory or xmm reg with/to xmm reg */
4443 THREEOPERAND(x
, mode
, reg
, r_m
, rex_prefix
, wbit
, XMM_OPND
, 1,
4448 * cmpps and cmpss vary their instruction name based
4449 * on the value of imm8. Other XMMP instructions,
4450 * such as shufps, require explicit specification of
4453 if (dp
->it_name
[0] == 'c' &&
4454 dp
->it_name
[1] == 'm' &&
4455 dp
->it_name
[2] == 'p' &&
4456 strlen(dp
->it_name
) == 5) {
4457 uchar_t pred
= x
->d86_opnd
[0].d86_value
& 0xff;
4459 if (pred
>= (sizeof (dis_PREDSUFFIX
) / sizeof (char *)))
4462 (void) strncpy(x
->d86_mnem
, "cmp", OPLEN
);
4463 x
->d86_mnem
[OPLEN
- 1] = '\0';
4464 (void) strlcat(x
->d86_mnem
, dis_PREDSUFFIX
[pred
],
4466 (void) strlcat(x
->d86_mnem
,
4467 dp
->it_name
+ strlen(dp
->it_name
) - 2,
4469 x
->d86_opnd
[0] = x
->d86_opnd
[1];
4470 x
->d86_opnd
[1] = x
->d86_opnd
[2];
4471 x
->d86_numopnds
= 2;
4477 FOUROPERAND(x
, mode
, reg
, r_m
, rex_prefix
, XMM_OPND
, XMM_OPND
,
4483 ONEOPERAND_TWOIMM(x
, mode
, reg
, r_m
, rex_prefix
, XMM_OPND
, 1);
4487 /* immediate operand to accumulator */
4489 wbit
= WBIT(opcode2
);
4490 dtrace_get_operand(x
, REG_ONLY
, EAX_REGNO
, wbit
, 1);
4491 dtrace_imm_opnd(x
, wbit
, OPSIZE(opnd_size
, wbit
), 0);
4495 /* memory or register operand to accumulator */
4497 wbit
= WBIT(opcode2
);
4498 dtrace_rex_adjust(rex_prefix
, mode
, NULL
, &r_m
);
4499 dtrace_get_operand(x
, mode
, r_m
, wbit
, 0);
4502 /* si register to di register used to reference memory */
4505 dtrace_check_override(x
, 0);
4506 x
->d86_numopnds
= 2;
4507 if (addr_size
== SIZE64
) {
4508 (void) strlcat(x
->d86_opnd
[0].d86_opnd
, "(%rsi)",
4510 (void) strlcat(x
->d86_opnd
[1].d86_opnd
, "(%rdi)",
4512 } else if (addr_size
== SIZE32
) {
4513 (void) strlcat(x
->d86_opnd
[0].d86_opnd
, "(%esi)",
4515 (void) strlcat(x
->d86_opnd
[1].d86_opnd
, "(%edi)",
4518 (void) strlcat(x
->d86_opnd
[0].d86_opnd
, "(%si)",
4520 (void) strlcat(x
->d86_opnd
[1].d86_opnd
, "(%di)",
4527 /* accumulator to di register */
4529 wbit
= WBIT(opcode2
);
4531 dtrace_check_override(x
, 1);
4532 x
->d86_numopnds
= 2;
4533 dtrace_get_operand(x
, REG_ONLY
, EAX_REGNO
, wbit
, 0);
4534 if (addr_size
== SIZE64
)
4535 (void) strlcat(x
->d86_opnd
[1].d86_opnd
, "(%rdi)",
4537 else if (addr_size
== SIZE32
)
4538 (void) strlcat(x
->d86_opnd
[1].d86_opnd
, "(%edi)",
4541 (void) strlcat(x
->d86_opnd
[1].d86_opnd
, "(%di)",
4546 /* si register to accumulator */
4548 wbit
= WBIT(opcode2
);
4550 dtrace_check_override(x
, 0);
4551 x
->d86_numopnds
= 2;
4552 if (addr_size
== SIZE64
)
4553 (void) strlcat(x
->d86_opnd
[0].d86_opnd
, "(%rsi)",
4555 else if (addr_size
== SIZE32
)
4556 (void) strlcat(x
->d86_opnd
[0].d86_opnd
, "(%esi)",
4559 (void) strlcat(x
->d86_opnd
[0].d86_opnd
, "(%si)",
4561 dtrace_get_operand(x
, REG_ONLY
, EAX_REGNO
, wbit
, 1);
4566 * single operand, a 16/32 bit displacement
4570 dtrace_disp_opnd(x
, wbit
, OPSIZE(opnd_size
, LONG_OPND
), 0);
4574 /* jmp/call indirect to memory or register operand */
4577 (void) strlcat(x
->d86_opnd
[0].d86_prefix
, "*", OPLEN
);
4579 dtrace_rex_adjust(rex_prefix
, mode
, NULL
, &r_m
);
4580 dtrace_get_operand(x
, mode
, r_m
, LONG_OPND
, 0);
4585 * for long jumps and long calls -- a new code segment
4586 * register and an offset in IP -- stored in object
4587 * code in reverse order. Note - not valid in amd64
4590 dtrace_check_override(x
, 1);
4592 dtrace_imm_opnd(x
, wbit
, OPSIZE(opnd_size
, LONG_OPND
), 1);
4594 x
->d86_opnd
[1].d86_mode
= MODE_SIGNED
;
4596 /* will now get segment operand */
4597 dtrace_imm_opnd(x
, wbit
, 2, 0);
4601 * jmp/call. single operand, 8 bit displacement.
4602 * added to current EIP in 'compofff'
4605 dtrace_disp_opnd(x
, BYTE_OPND
, 1, 0);
4609 /* single 32/16 bit immediate operand */
4612 dtrace_imm_opnd(x
, wbit
, OPSIZE(opnd_size
, LONG_OPND
), 0);
4615 /* single 8 bit immediate operand */
4618 dtrace_imm_opnd(x
, wbit
, 1, 0);
4623 dtrace_imm_opnd(x
, wbit
, 2, 0);
4624 dtrace_imm_opnd(x
, wbit
, 1, 1);
4625 switch (opnd_size
) {
4627 x
->d86_memsize
= (x
->d86_opnd
[1].d86_value
+ 1) * 8;
4630 x
->d86_memsize
= (x
->d86_opnd
[1].d86_value
+ 1) * 4;
4633 x
->d86_memsize
= (x
->d86_opnd
[1].d86_value
+ 1) * 2;
4639 /* 16-bit immediate operand */
4642 dtrace_imm_opnd(x
, wbit
, 2, 0);
4645 /* single 8 bit port operand */
4647 dtrace_check_override(x
, 0);
4648 dtrace_imm_opnd(x
, BYTE_OPND
, 1, 0);
4652 /* single operand, dx register (variable port instruction) */
4654 x
->d86_numopnds
= 1;
4655 dtrace_check_override(x
, 0);
4657 (void) strlcat(x
->d86_opnd
[0].d86_opnd
, "(%dx)", OPLEN
);
4663 * The int instruction, which has two forms:
4664 * int 3 (breakpoint) or
4665 * int n, where n is indicated in the subsequent
4666 * byte (format Ib). The int 3 instruction (opcode 0xCC),
4667 * where, although the 3 looks like an operand,
4668 * it is implied by the opcode. It must be converted
4669 * to the correct base and output.
4673 x
->d86_numopnds
= 1;
4674 x
->d86_opnd
[0].d86_mode
= MODE_SIGNED
;
4675 x
->d86_opnd
[0].d86_value_size
= 1;
4676 x
->d86_opnd
[0].d86_value
= 3;
4681 /* single 8 bit immediate operand */
4683 dtrace_imm_opnd(x
, BYTE_OPND
, 1, 0);
4687 /* an unused byte must be discarded */
4689 if (x
->d86_get_byte(x
->d86_data
) < 0)
4697 if (opnd_size
== SIZE16
)
4698 (void) strlcat(x
->d86_mnem
, "cbtw", OPLEN
);
4699 else if (opnd_size
== SIZE32
)
4700 (void) strlcat(x
->d86_mnem
, "cwtl", OPLEN
);
4702 (void) strlcat(x
->d86_mnem
, "cltq", OPLEN
);
4710 if (opnd_size
== SIZE16
)
4711 (void) strlcat(x
->d86_mnem
, "cwtd", OPLEN
);
4712 else if (opnd_size
== SIZE32
)
4713 (void) strlcat(x
->d86_mnem
, "cltd", OPLEN
);
4715 (void) strlcat(x
->d86_mnem
, "cqtd", OPLEN
);
4723 * sfence is sfence if mode is REG_ONLY. If mode isn't
4724 * REG_ONLY, mnemonic should be 'clflush'.
4726 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
4728 /* sfence doesn't take operands */
4730 if (mode
== REG_ONLY
) {
4731 (void) strlcat(x
->d86_mnem
, "sfence", OPLEN
);
4733 (void) strlcat(x
->d86_mnem
, "clflush", OPLEN
);
4734 dtrace_rex_adjust(rex_prefix
, mode
, ®
, &r_m
);
4735 dtrace_get_operand(x
, mode
, r_m
, BYTE_OPND
, 0);
4739 if (mode
!= REG_ONLY
) {
4740 dtrace_rex_adjust(rex_prefix
, mode
, ®
, &r_m
);
4741 dtrace_get_operand(x
, mode
, r_m
, LONG_OPND
, 0);
4748 * no disassembly, the mnemonic was all there was so go on
4751 if (dp
->it_invalid32
&& cpu_mode
!= SIZE64
)
4760 * XRSTOR and LFENCE share the same opcode but differ in mode
4762 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
4764 if (mode
== REG_ONLY
) {
4766 * Only the following exact byte sequences are allowed:
4771 if ((uint8_t)x
->d86_bytes
[x
->d86_len
- 1] != 0xe8 &&
4772 (uint8_t)x
->d86_bytes
[x
->d86_len
- 1] != 0xf0)
4776 (void) strncpy(x
->d86_mnem
, "xrstor", OPLEN
);
4778 dtrace_rex_adjust(rex_prefix
, mode
, ®
, &r_m
);
4779 dtrace_get_operand(x
, mode
, r_m
, BYTE_OPND
, 0);
4786 x
->d86_numopnds
= 1;
4787 (void) strlcat(x
->d86_opnd
[0].d86_opnd
, "%st(X)", OPLEN
);
4788 x
->d86_opnd
[0].d86_opnd
[4] = r_m
+ '0';
4793 /* float reg to float reg, with ret bit present */
4795 vbit
= opcode2
>> 2 & 0x1; /* vbit = 1: st -> st(i) */
4797 case FFC
: /* case for vbit always = 0 */
4799 x
->d86_numopnds
= 2;
4800 (void) strlcat(x
->d86_opnd
[1 - vbit
].d86_opnd
, "%st", OPLEN
);
4801 (void) strlcat(x
->d86_opnd
[vbit
].d86_opnd
, "%st(X)", OPLEN
);
4802 x
->d86_opnd
[vbit
].d86_opnd
[4] = r_m
+ '0';
4807 /* AVX instructions */
4809 /* op(ModR/M.r/m) */
4810 x
->d86_numopnds
= 1;
4811 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
4813 if ((dp
== &dis_opAVX0F
[0xA][0xE]) && (reg
== 3))
4814 (void) strncpy(x
->d86_mnem
, "vstmxcsr", OPLEN
);
4816 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
4817 dtrace_get_operand(x
, mode
, r_m
, wbit
, 0);
4821 /* ModR/M.reg := op(VEX.vvvv, ModR/M.r/m) */
4822 x
->d86_numopnds
= 3;
4823 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
4824 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
4827 * In classic Intel fashion, the opcodes for all of the FMA
4828 * instructions all have two possible mnemonics which vary by
4829 * one letter, which is selected based on the value of the wbit.
4830 * When wbit is one, they have the 'd' suffix and when 'wbit' is
4831 * 0, they have the 's' suffix. Otherwise, the FMA instructions
4832 * are all a standard VEX_RMrX.
4835 if (dp
->it_adrmode
== FMA
) {
4836 size_t len
= strlen(dp
->it_name
);
4837 (void) strncpy(x
->d86_mnem
, dp
->it_name
, OPLEN
);
4838 if (len
+ 1 < OPLEN
) {
4839 (void) strncpy(x
->d86_mnem
+ len
,
4840 vex_W
!= 0 ? "d" : "s", OPLEN
- len
);
4845 if (mode
!= REG_ONLY
) {
4846 if ((dp
== &dis_opAVXF20F
[0x10]) ||
4847 (dp
== &dis_opAVXF30F
[0x10])) {
4848 /* vmovsd <m64>, <xmm> */
4849 /* or vmovss <m64>, <xmm> */
4850 x
->d86_numopnds
= 2;
4855 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 2);
4857 * VEX prefix uses the 1's complement form to encode the
4860 dtrace_get_operand(x
, REG_ONLY
, (0xF - vex_v
), wbit
, 1);
4862 if ((dp
== &dis_opAVXF20F
[0x2A]) ||
4863 (dp
== &dis_opAVXF30F
[0x2A])) {
4865 * vcvtsi2si </r,m>, <xmm>, <xmm> or vcvtsi2ss </r,m>,
4871 else if ((mode
== REG_ONLY
) &&
4872 (dp
== &dis_opAVX0F
[0x1][0x6])) { /* vmovlhps */
4873 (void) strncpy(x
->d86_mnem
, "vmovlhps", OPLEN
);
4874 } else if ((mode
== REG_ONLY
) &&
4875 (dp
== &dis_opAVX0F
[0x1][0x2])) { /* vmovhlps */
4876 (void) strncpy(x
->d86_mnem
, "vmovhlps", OPLEN
);
4879 dtrace_get_operand(x
, mode
, r_m
, wbit
, 0);
4884 /* ModR/M.reg := op(MODR/M.r/m, VEX.vvvv) */
4885 x
->d86_numopnds
= 3;
4886 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
4887 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
4889 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 2);
4891 * VEX prefix uses the 1's complement form to encode the
4894 dtrace_get_operand(x
, REG_ONLY
, (0xF - vex_v
), wbit
, 0);
4896 dtrace_get_operand(x
, mode
, r_m
, wbit
, 1);
4900 /* ModR/M.reg := op(MODR/M.r/m, VSIB, VEX.vvvv) */
4901 x
->d86_numopnds
= 3;
4905 * All instructions that use VSIB are currently a mess. See the
4906 * comment around the dis_gather_regs_t structure definition.
4909 vreg
= &dis_vgather
[opcode2
][vex_W
][vex_L
];
4912 (void) strncpy(x
->d86_mnem
, dp
->it_name
, OPLEN
);
4913 (void) strlcat(x
->d86_mnem
+ strlen(dp
->it_name
),
4914 vreg
->dgr_suffix
, OPLEN
- strlen(dp
->it_name
));
4917 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
4918 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
4920 dtrace_get_operand(x
, REG_ONLY
, reg
, vreg
->dgr_arg2
, 2);
4922 * VEX prefix uses the 1's complement form to encode the
4925 dtrace_get_operand(x
, REG_ONLY
, (0xF - vex_v
), vreg
->dgr_arg0
,
4927 dtrace_get_operand(x
, mode
, r_m
, vreg
->dgr_arg1
, 1);
4931 /* ModR/M.rm := op(VEX.vvvv, ModR/M.reg) */
4932 x
->d86_numopnds
= 3;
4934 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
4935 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
4937 if (mode
!= REG_ONLY
) {
4938 if ((dp
== &dis_opAVXF20F
[0x11]) ||
4939 (dp
== &dis_opAVXF30F
[0x11])) {
4940 /* vmovsd <xmm>, <m64> */
4941 /* or vmovss <xmm>, <m64> */
4942 x
->d86_numopnds
= 2;
4947 dtrace_get_operand(x
, mode
, r_m
, wbit
, 2);
4948 dtrace_get_operand(x
, REG_ONLY
, (0xF - vex_v
), wbit
, 1);
4949 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 0);
4953 /* ModR/M.reg := op(VEX.vvvv, ModR/M.r_m, imm8[7:4]) */
4954 x
->d86_numopnds
= 4;
4956 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
4957 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
4958 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 3);
4959 dtrace_get_operand(x
, REG_ONLY
, (0xF - vex_v
), wbit
, 2);
4960 if (dp
== &dis_opAVX660F3A
[0x18]) {
4961 /* vinsertf128 <imm8>, <xmm>, <ymm>, <ymm> */
4962 dtrace_get_operand(x
, mode
, r_m
, XMM_OPND
, 1);
4963 } else if ((dp
== &dis_opAVX660F3A
[0x20]) ||
4964 (dp
== & dis_opAVX660F
[0xC4])) {
4965 /* vpinsrb <imm8>, <reg/mm>, <xmm>, <xmm> */
4966 /* or vpinsrw <imm8>, <reg/mm>, <xmm>, <xmm> */
4967 dtrace_get_operand(x
, mode
, r_m
, LONG_OPND
, 1);
4968 } else if (dp
== &dis_opAVX660F3A
[0x22]) {
4969 /* vpinsrd/q <imm8>, <reg/mm>, <xmm>, <xmm> */
4972 x
->d86_mnem
[6] = 'q';
4974 dtrace_get_operand(x
, mode
, r_m
, LONG_OPND
, 1);
4976 dtrace_get_operand(x
, mode
, r_m
, wbit
, 1);
4979 /* one byte immediate number */
4980 dtrace_imm_opnd(x
, wbit
, 1, 0);
4982 /* vblendvpd, vblendvps, vblendvb use the imm encode the regs */
4983 if ((dp
== &dis_opAVX660F3A
[0x4A]) ||
4984 (dp
== &dis_opAVX660F3A
[0x4B]) ||
4985 (dp
== &dis_opAVX660F3A
[0x4C])) {
4987 int regnum
= (x
->d86_opnd
[0].d86_value
& 0xF0) >> 4;
4989 x
->d86_opnd
[0].d86_mode
= MODE_NONE
;
4992 (void) strncpy(x
->d86_opnd
[0].d86_opnd
,
4993 dis_YMMREG
[regnum
], OPLEN
);
4995 (void) strncpy(x
->d86_opnd
[0].d86_opnd
,
4996 dis_XMMREG
[regnum
], OPLEN
);
5002 /* ModR/M.reg := op(ModR/M.rm) */
5003 x
->d86_numopnds
= 2;
5005 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
5006 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
5009 if ((dp
== &dis_opAVXF20F
[0xE6]) ||
5010 (dp
== &dis_opAVX660F
[0x5A]) ||
5011 (dp
== &dis_opAVX660F
[0xE6])) {
5012 /* vcvtpd2dq <ymm>, <xmm> */
5013 /* or vcvtpd2ps <ymm>, <xmm> */
5014 /* or vcvttpd2dq <ymm>, <xmm> */
5015 dtrace_get_operand(x
, REG_ONLY
, reg
, XMM_OPND
, 1);
5016 dtrace_get_operand(x
, mode
, r_m
, wbit
, 0);
5017 } else if ((dp
== &dis_opAVXF30F
[0xE6]) ||
5018 (dp
== &dis_opAVX0F
[0x5][0xA]) ||
5019 (dp
== &dis_opAVX660F38
[0x13]) ||
5020 (dp
== &dis_opAVX660F38
[0x18]) ||
5021 (dp
== &dis_opAVX660F38
[0x19]) ||
5022 (dp
== &dis_opAVX660F38
[0x58]) ||
5023 (dp
== &dis_opAVX660F38
[0x78]) ||
5024 (dp
== &dis_opAVX660F38
[0x79]) ||
5025 (dp
== &dis_opAVX660F38
[0x59])) {
5026 /* vcvtdq2pd <xmm>, <ymm> */
5027 /* or vcvtps2pd <xmm>, <ymm> */
5028 /* or vcvtph2ps <xmm>, <ymm> */
5029 /* or vbroadcasts* <xmm>, <ymm> */
5030 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 1);
5031 dtrace_get_operand(x
, mode
, r_m
, XMM_OPND
, 0);
5032 } else if (dp
== &dis_opAVX660F
[0x6E]) {
5033 /* vmovd/q <reg/mem 32/64>, <xmm> */
5036 x
->d86_mnem
[4] = 'q';
5038 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 1);
5039 dtrace_get_operand(x
, mode
, r_m
, LONG_OPND
, 0);
5041 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 1);
5042 dtrace_get_operand(x
, mode
, r_m
, wbit
, 0);
5048 /* ModR/M.reg := op(ModR/M.rm, imm8) */
5049 x
->d86_numopnds
= 3;
5051 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
5052 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
5054 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 2);
5055 dtrace_get_operand(x
, mode
, r_m
, wbit
, 1);
5057 /* one byte immediate number */
5058 dtrace_imm_opnd(x
, wbit
, 1, 0);
5062 /* VEX.vvvv := op(ModR/M.rm, imm8) */
5063 x
->d86_numopnds
= 3;
5065 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
5067 (void) strncpy(x
->d86_mnem
, dis_AVXvgrp7
[opcode2
- 1][reg
],
5070 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
5072 dtrace_get_operand(x
, REG_ONLY
, (0xF - vex_v
), wbit
, 2);
5073 dtrace_get_operand(x
, REG_ONLY
, r_m
, wbit
, 1);
5075 /* one byte immediate number */
5076 dtrace_imm_opnd(x
, wbit
, 1, 0);
5080 /* ModR/M.reg (reg32/64) := op(ModR/M.rm) */
5081 if (dp
== &dis_opAVX660F
[0xC5]) {
5082 /* vpextrw <imm8>, <xmm>, <reg> */
5083 x
->d86_numopnds
= 2;
5086 x
->d86_numopnds
= 2;
5090 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
5091 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
5092 dtrace_get_operand(x
, REG_ONLY
, reg
, LONG_OPND
, vbit
);
5093 dtrace_get_operand(x
, mode
, r_m
, wbit
, vbit
- 1);
5096 dtrace_imm_opnd(x
, wbit
, 1, 0);
5101 /* implicit(eflags/r32) := op(ModR/M.reg, ModR/M.rm) */
5102 x
->d86_numopnds
= 2;
5104 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
5105 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
5106 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 1);
5107 dtrace_get_operand(x
, mode
, r_m
, wbit
, 0);
5111 /* ModR/M.rm := op(ModR/M.reg) */
5112 /* vextractf128 || vcvtps2ph */
5113 if (dp
== &dis_opAVX660F3A
[0x19] ||
5114 dp
== &dis_opAVX660F3A
[0x1d]) {
5115 x
->d86_numopnds
= 3;
5117 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
5118 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
5120 dtrace_get_operand(x
, mode
, r_m
, XMM_OPND
, 2);
5121 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 1);
5123 /* one byte immediate number */
5124 dtrace_imm_opnd(x
, wbit
, 1, 0);
5128 x
->d86_numopnds
= 2;
5130 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
5131 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
5132 dtrace_get_operand(x
, mode
, r_m
, wbit
, 1);
5133 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 0);
5137 /* ModR/M.rm := op(ModR/M.reg) */
5138 x
->d86_numopnds
= 2;
5140 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
5141 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
5143 if (dp
== &dis_opAVX660F
[0x7E]) {
5144 /* vmovd/q <reg/mem 32/64>, <xmm> */
5147 x
->d86_mnem
[4] = 'q';
5149 dtrace_get_operand(x
, mode
, r_m
, LONG_OPND
, 1);
5151 dtrace_get_operand(x
, mode
, r_m
, wbit
, 1);
5153 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 0);
5157 /* ModR/M.rm := op(ModR/M.reg, imm) */
5158 x
->d86_numopnds
= 3;
5160 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
5161 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
5164 if (dp
== &dis_opAVX660F3A
[0x16]) {
5165 /* vpextrd/q <imm>, <xmm>, <reg/mem 32/64> */
5167 x
->d86_mnem
[6] = 'q';
5170 dtrace_get_operand(x
, mode
, r_m
, LONG_OPND
, 2);
5171 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 1);
5173 /* one byte immediate number */
5174 dtrace_imm_opnd(x
, wbit
, 1, 0);
5177 /* ModR/M.rm := op(ModR/M.reg, imm) */
5178 x
->d86_numopnds
= 3;
5180 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
5181 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
5183 dtrace_get_operand(x
, mode
, r_m
, XMM_OPND
, 2);
5184 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 1);
5185 /* one byte immediate number */
5186 dtrace_imm_opnd(x
, wbit
, 1, 0);
5190 /* ModR/M.rm := op(ModR/M.reg) */
5191 if (dp
== &dis_opAVX660F3A
[0x17]) { /* vextractps */
5192 x
->d86_numopnds
= 3;
5194 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
5195 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
5197 dtrace_get_operand(x
, mode
, r_m
, LONG_OPND
, 2);
5198 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 1);
5199 /* one byte immediate number */
5200 dtrace_imm_opnd(x
, wbit
, 1, 0);
5203 x
->d86_numopnds
= 2;
5205 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
5206 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
5209 dtrace_get_operand(x
, mode
, r_m
, wbit
, vbit
);
5210 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, vbit
- 1);
5215 /* ModR/M.rm := op(VEX.vvvv, ModR/M.reg) */
5216 x
->d86_numopnds
= 3;
5218 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
5219 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
5220 dtrace_get_operand(x
, mode
, r_m
, wbit
, 2);
5221 /* VEX use the 1's complement form encode the XMM/YMM regs */
5222 dtrace_get_operand(x
, REG_ONLY
, (0xF - vex_v
), wbit
, 1);
5223 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 0);
5227 /* ModR/M.reg := op(VEX.vvvv, ModR/M.rm) */
5228 x
->d86_numopnds
= 3;
5230 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
5231 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
5232 dtrace_get_operand(x
, REG_ONLY
, reg
, wbit
, 2);
5233 dtrace_get_operand(x
, REG_ONLY
, (0xF - vex_v
), wbit
, 1);
5234 dtrace_get_operand(x
, REG_ONLY
, r_m
, wbit
, 0);
5240 (void) strncpy(x
->d86_mnem
, "vzeroall", OPLEN
);
5246 * The BLS instructions are VEX instructions that are based on
5247 * VEX.0F38.F3; however, they are considered special group 17
5248 * and like everything else, they use the bits in 3-5 of the
5249 * MOD R/M to determine the sub instruction. Unlike many others
5250 * like the VMX instructions, these are valid both for memory
5251 * and register forms.
5254 dtrace_get_modrm(x
, &mode
, ®
, &r_m
);
5255 dtrace_vex_adjust(vex_byte1
, mode
, ®
, &r_m
);
5265 blsinstr
= "blsmsk";
5277 x
->d86_numopnds
= 2;
5279 (void) strncpy(x
->d86_mnem
, blsinstr
, OPLEN
);
5281 dtrace_get_operand(x
, REG_ONLY
, (0xF - vex_v
), wbit
, 1);
5282 dtrace_get_operand(x
, mode
, r_m
, wbit
, 0);
5285 /* an invalid op code */
5301 * compute the size of any memory accessed by the instruction
5303 if (x
->d86_memsize
!= 0) {
5305 } else if (dp
->it_stackop
) {
5306 switch (opnd_size
) {
5317 } else if (nomem
|| mode
== REG_ONLY
) {
5320 } else if (dp
->it_size
!= 0) {
5322 * In 64 bit mode descriptor table entries
5323 * go up to 10 bytes and popf/pushf are always 8 bytes
5325 if (x
->d86_mode
== SIZE64
&& dp
->it_size
== 6)
5326 x
->d86_memsize
= 10;
5327 else if (x
->d86_mode
== SIZE64
&& opcode1
== 0x9 &&
5328 (opcode2
== 0xc || opcode2
== 0xd))
5331 x
->d86_memsize
= dp
->it_size
;
5333 } else if (wbit
== 0) {
5336 } else if (wbit
== LONG_OPND
) {
5337 if (opnd_size
== SIZE64
)
5339 else if (opnd_size
== SIZE32
)
5344 } else if (wbit
== SEG_OPND
) {
5355 (void) strlcat(x
->d86_mnem
, "undef", OPLEN
);
5363 * Some instructions should have immediate operands printed
5364 * as unsigned integers. We compare against this table.
5366 static char *unsigned_ops
[] = {
5367 "or", "and", "xor", "test", "in", "out", "lcall", "ljmp",
5368 "rcr", "rcl", "ror", "rol", "shl", "shr", "sal", "psr", "psl",
5374 isunsigned_op(char *opcode
)
5378 int is_unsigned
= 0;
5381 * Work back to start of last mnemonic, since we may have
5382 * prefixes on some opcodes.
5384 where
= opcode
+ strlen(opcode
) - 1;
5385 while (where
> opcode
&& *where
!= ' ')
5390 for (i
= 0; unsigned_ops
[i
]; ++i
) {
5391 if (strncmp(where
, unsigned_ops
[i
],
5392 strlen(unsigned_ops
[i
])))
5397 return (is_unsigned
);
5401 * Print a numeric immediate into end of buf, maximum length buflen.
5402 * The immediate may be an address or a displacement. Mask is set
5403 * for address size. If the immediate is a "small negative", or
5404 * if it's a negative displacement of any magnitude, print as -<absval>.
5405 * Respect the "octal" flag. "Small negative" is defined as "in the
5406 * interval [NEG_LIMIT, 0)".
5408 * Also, "isunsigned_op()" instructions never print negatives.
5410 * Return whether we decided to print a negative value or not.
5413 #define NEG_LIMIT -255
5415 enum {POS
, TRY_NEG
};
5418 print_imm(dis86_t
*dis
, uint64_t usv
, uint64_t mask
, char *buf
,
5419 size_t buflen
, int disp
, int try_neg
)
5422 int64_t sv
= (int64_t)usv
;
5423 int octal
= dis
->d86_flags
& DIS_F_OCTAL
;
5425 curlen
= strlen(buf
);
5427 if (try_neg
== TRY_NEG
&& sv
< 0 &&
5428 (disp
|| sv
>= NEG_LIMIT
) &&
5429 !isunsigned_op(dis
->d86_mnem
)) {
5430 dis
->d86_sprintf_func(buf
+ curlen
, buflen
- curlen
,
5431 octal
? "-0%llo" : "-0x%llx", (-sv
) & mask
);
5435 dis
->d86_sprintf_func(buf
+ curlen
, buflen
- curlen
,
5436 octal
? "+0%llo" : "+0x%llx", usv
& mask
);
5438 dis
->d86_sprintf_func(buf
+ curlen
, buflen
- curlen
,
5439 octal
? "0%llo" : "0x%llx", usv
& mask
);
5460 dtrace_disx86_str(dis86_t
*dis
, uint_t mode
, uint64_t pc
, char *buf
,
5463 uint64_t reltgt
= 0;
5466 int (*lookup
)(void *, uint64_t, char *, size_t);
5469 uint64_t usv
, mask
, save_mask
, save_usv
;
5470 static uint64_t masks
[] =
5471 {0xffU
, 0xffffU
, 0xffffffffU
, 0xffffffffffffffffULL
};
5474 dis
->d86_sprintf_func(buf
, buflen
, "%-6s ", dis
->d86_mnem
);
5477 * For PC-relative jumps, the pc is really the next pc after executing
5478 * this instruction, so increment it appropriately.
5482 for (i
= 0; i
< dis
->d86_numopnds
; i
++) {
5483 d86opnd_t
*op
= &dis
->d86_opnd
[i
];
5486 (void) strlcat(buf
, ",", buflen
);
5488 (void) strlcat(buf
, op
->d86_prefix
, buflen
);
5491 * sv is for the signed, possibly-truncated immediate or
5492 * displacement; usv retains the original size and
5493 * unsignedness for symbol lookup.
5496 sv
= usv
= op
->d86_value
;
5499 * About masks: for immediates that represent
5500 * addresses, the appropriate display size is
5501 * the effective address size of the instruction.
5502 * This includes MODE_OFFSET, MODE_IPREL, and
5503 * MODE_RIPREL. Immediates that are simply
5504 * immediate values should display in the operand's
5505 * size, however, since they don't represent addresses.
5508 /* d86_addr_size is SIZEnn, which is log2(real size) */
5509 mask
= masks
[dis
->d86_addr_size
];
5511 /* d86_value_size and d86_imm_bytes are in bytes */
5512 if (op
->d86_mode
== MODE_SIGNED
||
5513 op
->d86_mode
== MODE_IMPLIED
)
5514 mask
= masks
[log2(op
->d86_value_size
)];
5516 switch (op
->d86_mode
) {
5520 (void) strlcat(buf
, op
->d86_opnd
, buflen
);
5529 if (dis
->d86_seg_prefix
)
5530 (void) strlcat(buf
, dis
->d86_seg_prefix
,
5533 if (op
->d86_mode
== MODE_SIGNED
||
5534 op
->d86_mode
== MODE_IMPLIED
) {
5535 (void) strlcat(buf
, "$", buflen
);
5538 if (print_imm(dis
, usv
, mask
, buf
, buflen
,
5540 (op
->d86_mode
== MODE_SIGNED
||
5541 op
->d86_mode
== MODE_IMPLIED
)) {
5544 * We printed a negative value for an
5545 * immediate that wasn't a
5546 * displacement. Note that fact so we can
5547 * print the positive value as an
5554 (void) strlcat(buf
, op
->d86_opnd
, buflen
);
5565 reltgt
= (uint16_t)reltgt
;
5568 reltgt
= (uint32_t)reltgt
;
5572 (void) print_imm(dis
, usv
, mask
, buf
, buflen
,
5575 if (op
->d86_mode
== MODE_RIPREL
)
5576 (void) strlcat(buf
, "(%rip)", buflen
);
5582 * The symbol lookups may result in false positives,
5583 * particularly on object files, where small numbers may match
5584 * the 0-relative non-relocated addresses of symbols.
5587 lookup
= dis
->d86_sym_lookup
;
5589 if ((dis
->d86_flags
& DIS_F_NOIMMSYM
) == 0 &&
5590 lookup(dis
->d86_data
, tgt
, NULL
, 0) == 0) {
5591 (void) strlcat(buf
, "\t<", buflen
);
5592 curlen
= strlen(buf
);
5593 lookup(dis
->d86_data
, tgt
, buf
+ curlen
,
5595 (void) strlcat(buf
, ">", buflen
);
5599 * If we printed a negative immediate above, print the
5600 * positive in case our heuristic was unhelpful
5603 (void) strlcat(buf
, "\t<", buflen
);
5604 (void) print_imm(dis
, save_usv
, save_mask
, buf
, buflen
,
5606 (void) strlcat(buf
, ">", buflen
);
5611 /* Print symbol or effective address for reltgt */
5613 (void) strlcat(buf
, "\t<", buflen
);
5614 curlen
= strlen(buf
);
5615 lookup(dis
->d86_data
, reltgt
, buf
+ curlen
,
5617 (void) strlcat(buf
, ">", buflen
);
5621 #endif /* DIS_TEXT */