Intel® X86 Encoder Decoder
|
Here is a minimal example of using Intel® XED from the file examples/xed-min.c.
More...
Here is a minimal example of using Intel® XED from the file examples/xed-min.c.
#include <stdio.h>
int main(int argc, char** argv);
int main(int argc, char** argv) {
unsigned int bytes = 0;
unsigned char itext[15] = { 0xf, 0x85, 0x99, 0x00, 0x00, 0x00 };
if (long_mode) {
}
else {
}
for(bytes = 0;bytes<=15;bytes++) {
bytes);
}
(void) argc; (void) argv;
return 0;
}
There is a makefile in the examples directory. Here's how to compile it from a kit:
% gcc -Ipath-to-xed-kit/include -Ipath-to-xed-kit/examples \
-c path-to-xed-kit/examples/xed-min.c
% gcc -o xed-min xed-min.o path-to-xed-kit/lib/libxed.a
where path-to-xed-kit is where you have your include, examples and lib directories from an installed Intel® XED kit.
Here is a more detailed example (examples/xed-ex1.c) that walks the operands much like the printing routines do for the xed_decoded_inst_t .
#include "xed-examples-util.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define TBUFSZ 90
int main(int argc, char** argv);
printf("REAL REP ");
printf("\tcorresponding no-rep iclass: %s\n" ,
}
printf("F3 PREFIX\n");
}
printf("F2 PREFIX\n");
}
printf("67 PREFIX\n");
}
printf("66-OSZ PREFIX\n");
}
printf("MANDATORY 66 PREFIX\n");
}
printf("ANY 66 PREFIX\n");
}
printf("REX2 PREFIX\n");
}
printf("RING0 only\n");
}
}
printf("BROADCAST\n");
#if defined(XED_APX)
{
printf("[APX] ");
printf("New-Data-Destination ");
}
printf("No-Flags ");
}
printf("Uses-EGPR ");
}
printf("Zero-Upper ");
}
printf("\n");
}
#endif
{
printf("AMX\n");
printf("AVX512 KMASK-OP\n");
else {
sse = 1;
printf("SSE\n");
}
printf("AVX\n");
printf("AVX512\n");
printf("SCALAR\n");
else {
printf("Vector length: %u\n", vl_bits);
}
printf( "AVX512 vector elements: %u\n", vec_elements);
}
}
}
printf("WRITE-MASKING\n");
if (np)
printf("Number of legacy prefixes: %u \n", np);
{
break;
{
break;
if (r) {
printf("\t\t{Leaf 0x%08x, subleaf 0x%08x, %s[%u:%u]} = %u\n",
}
else {
printf("Could not find cpuid leaf information\n");
}
}
}
{
static char const* rounding_modes[5] = { "", "rne-sae", "rd-sae", "ru-sae", "rz-sae"};
printf("suppress-all-exceptions (SAE) set\n");
if (t>0 && t<5)
printf("rounding mode override = %s\n", rounding_modes[t]);
}
}
printf("HINT: NOT TAKEN\n");
printf("HINT: TAKEN\n");
printf("CET NO-TRACK\n");
}
printf("ATTRIBUTES: ");
for(i=0;i<nattributes;i++) {
}
printf("\n");
}
printf("READS ZF\n");
}
}
}
unsigned int i, nflags;
assert(rfi);
printf("FLAGS:\n");
printf(" reads-rflags ");
}
printf(" may-write-rflags ");
}
printf(" must-write-rflags ");
}
}
for( i=0;i<nflags ;i++) {
char buf[500];
printf("%s ", buf);
}
printf("\n");
{
char buf[500];
printf(" read: %30s mask=0x%x\n",
buf,
printf(" written: %30s mask=0x%x\n",
buf,
printf(" undefined: %30s mask=0x%x\n",
buf,
}
#if defined(XED_APX)
assert(okay);
printf(" default:%13sof=%u, sf=%u, zf=%u, cf=%u\n",
"",
}
#endif
}
}
printf("Memory Operands\n");
for( i=0;i<memops ; i++) {
printf(" %u ",i);
printf(" read ");
r_or_w = 1;
}
printf("written ");
r_or_w = 1;
}
if (!r_or_w) {
printf(" agen ");
}
}
printf("BASE= %3s/%3s ",
}
printf("INDEX= %3s/%3s ",
printf("SCALE= %u ",
}
}
{
if (disp_bits)
{
xed_int64_t disp;
printf("DISPLACEMENT_BYTES= %u ", disp_bits);
}
}
printf(" ASZ%u=%u\n",
i,
}
printf(" MemopBytes = %u\n",
}
unsigned int i, noperands;
char tbuf[TBUFSZ];
printf("Operands\n");
printf("# TYPE DETAILS VIS RW OC2 BITS BYTES NELEM ELEMSZ ELEMTYPE REGCLASS\n");
printf("# ==== ======= === == === ==== ===== ===== ====== ======== ========\n");
tbuf[0]=0;
for( i=0; i < noperands ; i++) {
printf("%u %6s ",
switch(op_name) {
break;
if (disp_bytes) {
char buf[40];
const unsigned int no_leading_zeros=0;
xed_int64_t disp =
#if defined (_WIN32) && !defined(PIN_CRT)
_snprintf_s(tbuf, TBUFSZ, TBUFSZ,
"BRANCH_DISPLACEMENT_BYTES=%u 0x%s",
disp_bytes,buf);
#else
snprintf(tbuf, TBUFSZ,
"BRANCH_DISPLACEMENT_BYTES=%u 0x%s",
disp_bytes,buf);
#endif
}
}
break;
char buf[64];
const unsigned int no_leading_zeros=0;
(xed_uint64_t)x,
ibits));
}
else {
}
#if defined (_WIN32) && !defined(PIN_CRT)
_snprintf_s(tbuf, TBUFSZ, TBUFSZ,
"0x%s(%ub)",buf,ibits);
#else
snprintf(tbuf,TBUFSZ,
"0x%s(%db)",buf,ibits);
#endif
break;
}
#if defined (_WIN32) && !defined(PIN_CRT)
_snprintf_s(tbuf, TBUFSZ, TBUFSZ,
"0x%02x",(int)x);
#else
snprintf(tbuf,TBUFSZ,
"0x%02x",(int)x);
#endif
break;
}
{
#if defined (_WIN32) && !defined(PIN_CRT)
_snprintf_s(tbuf, TBUFSZ, TBUFSZ,
"%s=%s",
#else
snprintf(tbuf,TBUFSZ,
"%s=%s",
#endif
break;
}
default:
printf("need to add support for printing operand: %s",
assert(0);
}
printf("%21s", tbuf);
printf(" %10s %3s %9s",
printf( " %3u", bits);
printf(" %4u", (bits +7) >> 3);
printf(" %10s",
printf(" %10s\n",
}
}
{
char buf[TBUFSZ];
#define FLDFMT "%-8s %-21s " // Field format -> position (name)
#define FLDFMT_S FLDFMT"= 0b%s\n" // Row format -> position (name) = string
#define FLDFMT_B FLDFMT"= 0b%01u\n" // Row format -> position (name) = bit
printf("[Encoding Bits]\n");
{
#if defined(XED_APX)
{
}
#endif
printf("====================== EVEX payload #0 ======================\n");
printf("%-30s = 0x62\n", "P0");
printf("====================== EVEX payload #1 ======================\n");
printf(FLDFMT_S, "P1[2:0]", "(EVEX.mmm)", buf);
printf("====================== EVEX payload #2 ======================\n");
printf(FLDFMT_S, "P2[1:0]", "(EVEX.pp)", buf);
printf(FLDFMT_B, "P2[2]", "(EVEX.U / APX.X4)", ubit_x4);
printf(FLDFMT_S, "P2[3:6]", "(EVEX.vvvv / APX.DFV)", buf);
printf("====================== EVEX payload #3 ======================\n");
printf(FLDFMT_S, "P3[0:2]", "(EVEX.aaa)", buf);
#if defined(XED_APX)
if (machine_mode64) {
printf(FLDFMT_S, "P3[0:3]", "(APX.SCC)", buf);
}
}
#endif
}
else if (evvspace == 0)
{
printf(FLDFMT_S, "P3[0:2]", "(EVEX.aaa)", buf);
}
#if defined(XED_APX)
else if (evvspace == 1)
{
printf(FLDFMT_S, "P3[0:1]", "(EVEX.aa)", buf);
}
else if (evvspace == 2)
{
printf(FLDFMT_S, "P3[0:3]", "(APX.SCC)", buf);
}
#endif
printf(FLDFMT_S, "P3[5:6]", "(EVEX.LL/RC)", buf);
}
printf("========================== Opcode ===========================\n");
{
printf("=========================== ModRM ===========================\n");
printf(FLDFMT_S, "p[0:2]", "(R/M)", buf);
printf(FLDFMT_S, "p[3:5]", "(REG)", buf);
printf(FLDFMT_S, "p[6:7]", "(MOD)", buf);
}
}
int main(int argc, char** argv) {
char const* decode_text=0;
unsigned int len;
xed_uint32_t operands_value[XED_MAX_INPUT_OPERNADS] = {0};
#if defined(XED_MPX)
unsigned int mpx_mode=0;
#endif
#if defined(XED_CET)
unsigned int cet_mode=0;
#endif
first_argv = 1;
for(i=1;i< argcu;i++) {
if (strcmp(argv[i], "-64") == 0) {
assert(already_set_mode == 0);
already_set_mode = 1;
first_argv++;
}
#if defined(XED_MPX)
else if (strcmp(argv[i], "-mpx") == 0) {
mpx_mode = 1;
first_argv++;
}
#endif
#if defined(XED_CET)
else if (strcmp(argv[i], "-cet") == 0) {
cet_mode = 1;
first_argv++;
}
#endif
else if (strcmp(argv[i], "-16") == 0) {
assert(already_set_mode == 0);
already_set_mode = 1;
first_argv++;
}
else if (strcmp(argv[i], "-s16") == 0) {
already_set_mode = 1;
first_argv++;
}
else if (strcmp(argv[i], "-chip") == 0) {
assert(i+1 < argcu);
first_argv+=2;
}
else if (strcmp(argv[i], "-v") == 0)
{
verbose = 1;
first_argv++;
}
else if (strcmp(argv[i], "-set") == 0) {
assert(i+2 < argcu);
if (operands_index >= XED_MAX_INPUT_OPERNADS) {
printf("ERROR: too many -set operands, max is %d\n", XED_MAX_INPUT_OPERNADS);
exit(1);
}
printf("ERROR: operand %s doesn't exist\n", argv[i+1]);
exit(1);
}
operands_value[operands_index] =
XED_STATIC_CAST(xed_uint8_t, xed_atoi_general(argv[i+2],1000));
operands_index++;
first_argv+=3;
}
}
assert(first_argv < argcu);
#if defined(XED_MPX)
#endif
#if defined(XED_CET)
#endif
for (i = 0; i < operands_index; i++)
for(i=first_argv; i< argcu;i++)
decode_text = xedex_append_string(decode_text,argv[i]);
len = (unsigned int) strlen(decode_text);
if ((len & 1) == 1) {
printf("Must supply even number of nibbles per substring\n");
exit(1);
}
printf("Must supply at most 30 nibbles (15 bytes)\n");
exit(1);
}
bytes = xed_convert_ascii_to_hex(decode_text,
itext,
if (bytes == 0) {
printf("Must supply some hex bytes\n");
exit(1);
}
printf("Attempting to decode: ");
for(i=0;i<bytes;i++)
printf("\n");
bytes);
xed_decode_error(0, 0, itext, xed_error, dec_length);
if (verbose) {
print_enc_bits(&xedd, xed_error);
}
exit(1);
}
printf("iclass %s\t",
printf("category %s\t" ,
printf("ISA-extension %s\t",
printf("ISA-set %s\n" ,
printf("instruction-length %u\n",
printf("operand-width %u\n",
printf("effective-operand-width %u\n",
printf("effective-address-width %u\n",
printf("stack-address-width %u\n",
printf("iform-enum-name %s\n",
printf("iform-enum-name-dispatch (zero based) %u\n",
printf("iclass-max-iform-dispatch %u\n",
printf("Nominal opcode position %u\n",
printf("Nominal opcode 0x%02x\n",
print_operands(&xedd);
print_memops(&xedd);
print_flags(&xedd);
print_reads_zf_flag(&xedd);
print_attributes(&xedd);
print_misc(&xedd);
print_branch_hints(&xedd);
if (verbose) {
print_enc_bits(&xedd, xed_error);
}
return 0;
}
Here are a few examples of running the program:
% ./xed-ex1 01 c0
iclass ADD category BINARY ISA-extension BASE ISA-set I86
instruction-length 2
operand-width 32
effective-operand-width 32
effective-address-width 32
stack-address-width 32
iform-enum-name ADD_GPRv_GPRv_01
iform-enum-name-dispatch (zero based) 14
iclass-max-iform-dispatch 42
Nominal opcode position 0
Nominal opcode 0x01
Operands
# TYPE DETAILS VIS RW OC2 BITS BYTES NELEM ELEMSZ ELEMTYPE REGCLASS
# ==== ======= === == === ==== ===== ===== ====== ======== ========
0 REG0 REG0=EAX EXPLICIT RW V 32 4 1 32 INT GPR
1 REG1 REG1=EAX EXPLICIT R V 32 4 1 32 INT GPR
2 REG2 REG2=EFLAGS SUPPRESSED W Y 32 4 1 32 INT FLAGS
Memory Operands
MemopBytes = 0
FLAGS:
must-write-rflags of-mod sf-mod zf-mod af-mod pf-mod cf-mod
read: mask=0x0
written: of sf zf af pf cf mask=0x8d5
undefined: mask=0x0
ATTRIBUTES: SCALABLE
ISA SET: [I86]
===============================================================================
% ./xed-ex1 f2 0f 58 9c 24 e0 00 00 00
iclass ADDSD category SSE ISA-extension SSE2 ISA-set SSE2
instruction-length 9
operand-width 32
effective-operand-width 32
effective-address-width 32
stack-address-width 32
iform-enum-name ADDSD_XMMsd_MEMsd
iform-enum-name-dispatch (zero based) 0
iclass-max-iform-dispatch 2
Nominal opcode position 2
Nominal opcode 0x58
Operands
# TYPE DETAILS VIS RW OC2 BITS BYTES NELEM ELEMSZ ELEMTYPE REGCLASS
# ==== ======= === == === ==== ===== ===== ====== ======== ========
0 REG0 REG0=XMM3 EXPLICIT RW SD 64 8 1 64 DOUBLE XMM
1 MEM0 (see below) EXPLICIT R SD 64 8 1 64 DOUBLE INVALID
Memory Operands
0 read SEG= SS BASE= ESP/GPR DISPLACEMENT_BYTES= 4 0x00000000000000e0 base10=224 ASZ0=32
MemopBytes = 8
ATTRIBUTES: MXCSR SIMD_SCALAR
F2 PREFIX
EXCEPTION TYPE: SSE_TYPE_3
SSE
SCALAR
Number of legacy prefixes: 1
ISA SET: [SSE2]
0 CPUID GROUP NAME: [SSE2]
0 CPUID RECORD NAME: [SSE2]
{Leaf 0x00000001, subleaf 0x00000000, EDX[26:26]} = 1
===============================================================================
./xed-ex1 f3 90
iclass PAUSE category MISC ISA-extension PAUSE ISA-set PAUSE
instruction-length 2
operand-width 32
effective-operand-width 32
effective-address-width 32
stack-address-width 32
iform-enum-name PAUSE
iform-enum-name-dispatch (zero based) 0
iclass-max-iform-dispatch 1
Nominal opcode position 1
Nominal opcode 0x90
Operands
# TYPE DETAILS VIS RW OC2 BITS BYTES NELEM ELEMSZ ELEMTYPE REGCLASS
# ==== ======= === == === ==== ===== ===== ====== ======== ========
Memory Operands
MemopBytes = 0
ATTRIBUTES: NOTSX
F3 PREFIX
Number of legacy prefixes: 1
ISA SET: [PAUSE]
===============================================================================
@ XED_OPERAND_IMM0
Definition: xed-operand-enum.h:205
static XED_INLINE xed_iclass_enum_t xed_decoded_inst_get_iclass(const xed_decoded_inst_t *p)
Definition: xed-decoded-inst-api.h:75
xed_reg_enum_t reg
the register containing the bits (EAX,EBX,ECX,EDX)
Definition: xed-cpuid-rec.h:35
@ XED_ATTRIBUTE_RING0
Definition: xed-attribute-enum.h:216
XED_DLL_EXPORT int xed_itoa_hex_ul(char *buf, xed_uint64_t f, xed_uint_t bits_to_print, xed_bool_t leading_zeros, int buflen, xed_bool_t lowercase)
XED_DLL_EXPORT xed_error_enum_t xed_decode(xed_decoded_inst_t *xedd, const xed_uint8_t *itext, const unsigned int bytes)
This is the main interface to the decoder.
static XED_INLINE xed_bits_t xed3_operand_get_nd(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1687
const XED_DLL_EXPORT char * xed_extension_enum_t2str(const xed_extension_enum_t p)
This converts strings to xed_extension_enum_t types.
XED_DLL_EXPORT xed_bool_t xed_flag_dfv_get_default_flags_values(xed_reg_enum_t dfv_reg, xed_flag_dfv_t *p)
static XED_INLINE xed_bits_t xed3_operand_get_evvspace(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1679
static XED_INLINE xed_bits_t xed3_operand_get_has_modrm(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1391
xed_address_width_enum_t stack_addr_width
for 16b/32b modes
Definition: xed-state.h:43
a data structure representing a CPUID record
Definition: xed-cpuid-rec.h:32
XED_DLL_EXPORT xed_bool_t xed_classify_apx(const xed_decoded_inst_t *d)
True for APX instructions. includes instructions with EGPRs, REX2 and encodings that are treated as i...
static XED_INLINE xed_bits_t xed3_operand_get_bcrc(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1615
XED_DLL_EXPORT xed_int64_t xed_sign_extend_arbitrary_to_64(xed_uint64_t x, unsigned int bits)
arbitrary sign extension from a qty of "bits" length to 64b
@ XED_OPERAND_REG7
Definition: xed-operand-enum.h:266
#define XED_MAX_INSTRUCTION_BYTES
Definition: xed-common-defs.h:32
const XED_DLL_EXPORT char * xed_cpuid_rec_enum_t2str(const xed_cpuid_rec_enum_t p)
This converts strings to xed_cpuid_rec_enum_t types.
@ XED_OPERAND_INVALID
Definition: xed-operand-enum.h:169
static XED_INLINE unsigned int xed_flag_set_mask(const xed_flag_set_t *p)
Definition: xed-flags.h:241
static XED_INLINE xed_bits_t xed3_operand_get_nf(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1695
static XED_INLINE xed_iform_enum_t xed_decoded_inst_get_iform_enum(const xed_decoded_inst_t *p)
Definition: xed-decoded-inst-api.h:377
static XED_INLINE xed_bits_t xed3_operand_get_mask(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1631
Definition: xed-flags.h:116
xed_operand_enum_t
Definition: xed-operand-enum.h:168
static XED_INLINE xed_bits_t xed3_operand_get_vexdest210(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1551
XED_DLL_EXPORT xed_bool_t xed_classify_avx512_maskop(const xed_decoded_inst_t *d)
@ XED_MACHINE_MODE_LEGACY_32
32b protected mode
Definition: xed-machine-mode-enum.h:40
XED_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_dfv_reg(const xed_decoded_inst_t *xedd)
xed_uint8_t bit_end
the bit end index for the feature
Definition: xed-cpuid-rec.h:37
XED_DLL_EXPORT xed_operand_enum_t str2xed_operand_enum_t(const char *s)
This converts strings to xed_operand_enum_t types.
xed_uint32_t zf
Definition: xed-flags.h:63
XED_DLL_EXPORT void xed3_set_generic_operand(xed_decoded_inst_t *d, xed_operand_enum_t operand, xed_uint32_t val)
@ XED_OPERAND_REG5
Definition: xed-operand-enum.h:264
struct xed_flag_dfv_s::@6 s
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_rep_prefix(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_cpuid_rec_enum_t xed_get_cpuid_rec_enum_for_group(xed_cpuid_group_enum_t group, xed_uint_t i)
Returns the name of the i'th cpuid record associated with the given cpuid group. This function is cal...
const XED_DLL_EXPORT char * xed_cpuid_group_enum_t2str(const xed_cpuid_group_enum_t p)
This converts strings to xed_cpuid_group_enum_t types.
XED_DLL_EXPORT xed_bool_t xed_simple_flag_writes_flags(const xed_simple_flag_t *p)
XED_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_base_reg(const xed_decoded_inst_t *p, unsigned int mem_idx)
XED_DLL_EXPORT xed_bool_t xed_simple_flag_get_may_write(const xed_simple_flag_t *p)
Definition: xed-flags.h:166
static XED_INLINE xed_bits_t xed3_operand_get_has_egpr(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:767
xed_machine_mode_enum_t
Definition: xed-machine-mode-enum.h:35
static XED_INLINE xed_bits_t xed3_operand_get_scc(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1703
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_real_rep(const xed_operand_values_t *p)
static XED_INLINE xed_uint_t xed_decoded_inst_get_length(const xed_decoded_inst_t *p)
Definition: xed-decoded-inst-api.h:287
unsigned int xed_bits_t
Definition: xed-types.h:54
XED_DLL_EXPORT void xed_decoded_inst_zero_set_mode(xed_decoded_inst_t *p, const xed_state_t *dstate)
#define XED_MAX_CPUID_GROUPS_PER_ISA_SET
Definition: xed-cpuid-rec.h:41
XED_DLL_EXPORT xed_uint32_t xed_operand_values_get_effective_operand_width(const xed_operand_values_t *p)
static XED_INLINE xed_extension_enum_t xed_decoded_inst_get_extension(const xed_decoded_inst_t *p)
Definition: xed-decoded-inst-api.h:61
static XED_INLINE unsigned int xed_decoded_inst_get_iform_enum_dispatch(const xed_decoded_inst_t *p)
Definition: xed-decoded-inst-api.h:388
XED_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_reg(const xed_decoded_inst_t *p, xed_operand_enum_t reg_operand)
const XED_DLL_EXPORT char * xed_operand_element_type_enum_t2str(const xed_operand_element_type_enum_t p)
This converts strings to xed_operand_element_type_enum_t types.
XED_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_index_reg(const xed_decoded_inst_t *p, unsigned int mem_idx)
static XED_INLINE xed_bits_t xed3_operand_get_rexr4(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:759
XED_DLL_EXPORT unsigned int xed_decoded_inst_operand_element_size_bits(const xed_decoded_inst_t *p, unsigned int operand_index)
Return the size of an element in bits (for SSE and AVX operands)
const XED_DLL_EXPORT xed_simple_flag_t * xed_decoded_inst_get_rflags_info(const xed_decoded_inst_t *p)
See the comment on xed_decoded_inst_uses_rflags().
static XED_INLINE xed_bits_t xed3_operand_get_vexdest3(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1543
static XED_INLINE void xed_decoded_inst_set_mode(xed_decoded_inst_t *p, xed_machine_mode_enum_t mmode, xed_address_width_enum_t stack_addr_width)
Definition: xed-decoded-inst-api.h:261
const XED_DLL_EXPORT char * xed_isa_set_enum_t2str(const xed_isa_set_enum_t p)
This converts strings to xed_isa_set_enum_t types.
struct xed_flag_set_s::@7 s
static XED_INLINE xed_bits_t xed3_operand_get_rexx(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:719
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_repne_prefix(const xed_operand_values_t *p)
@ XED_ERROR_NONE
There was no error.
Definition: xed-error-enum.h:49
const XED_DLL_EXPORT char * xed_operand_enum_t2str(const xed_operand_enum_t p)
This converts strings to xed_operand_enum_t types.
@ XED_OPERAND_REG6
Definition: xed-operand-enum.h:265
@ XED_OPERAND_REG9
Definition: xed-operand-enum.h:268
@ XED_OPERAND_RELBR
Definition: xed-operand-enum.h:269
xed_isa_set_enum_t
Definition: xed-isa-set-enum.h:308
xed_machine_mode_enum_t mmode
real architected machine modes
Definition: xed-state.h:41
XED_DLL_EXPORT xed_reg_class_enum_t xed_reg_class(xed_reg_enum_t r)
Returns the register class of the given input register.
@ XED_OPERAND_IMM1
Definition: xed-operand-enum.h:207
XED_DLL_EXPORT int xed_flag_action_print(const xed_flag_action_t *p, char *buf, int buflen)
static XED_INLINE xed_bits_t xed3_operand_get_pos_nominal_opcode(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1383
@ XED_ATTRIBUTE_SIMD_SCALAR
Definition: xed-attribute-enum.h:219
XED_DLL_EXPORT xed_uint32_t xed_decoded_inst_get_attribute(const xed_decoded_inst_t *p, xed_attribute_enum_t attr)
@ XED_OPERAND_REG8
Definition: xed-operand-enum.h:267
@ XED_OPERAND_BASE0
Definition: xed-operand-enum.h:174
const XED_DLL_EXPORT xed_flag_set_t * xed_simple_flag_get_read_flag_set(const xed_simple_flag_t *p)
static XED_INLINE xed_bits_t xed3_operand_get_rex2(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:735
xed_uint32_t cf
Definition: xed-flags.h:41
static XED_INLINE xed_bits_t xed3_operand_get_vexdest4(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1623
xed_uint32_t value
the required feature value
Definition: xed-cpuid-rec.h:38
XED_DLL_EXPORT xed_uint64_t xed_decoded_inst_get_unsigned_immediate(const xed_decoded_inst_t *p)
Definition: xed-flags.h:53
@ XED_ATTRIBUTE_APX_NDD
Definition: xed-attribute-enum.h:135
@ XED_ADDRESS_WIDTH_16b
16b addressing
Definition: xed-address-width-enum.h:33
XED_DLL_EXPORT xed_bool_t xed_simple_flag_reads_flags(const xed_simple_flag_t *p)
static XED_INLINE xed_bits_t xed3_operand_get_rexx4(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:751
#define XED_MAX_CPUID_RECS_PER_GROUP
Definition: xed-cpuid-rec.h:42
XED_DLL_EXPORT int xed_flag_set_print(const xed_flag_set_t *p, char *buf, int buflen)
XED_DLL_EXPORT xed_iclass_enum_t xed_rep_remove(xed_iclass_enum_t x)
XED_DLL_EXPORT xed_uint32_t xed_operand_values_get_effective_address_width(const xed_operand_values_t *p)
XED_DLL_EXPORT int xed_itoa_bin(char *buf, xed_uint64_t f, xed_uint_t bits_to_print, xed_uint_t buflen)
Convert the input value f into its binary representation as a string and store it in buf.
static XED_INLINE xed_bits_t xed3_operand_get_map(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1287
xed_uint32_t zf
Definition: xed-flags.h:40
XED_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_seg_reg(const xed_decoded_inst_t *p, unsigned int mem_idx)
XED_DLL_EXPORT xed_bool_t xed_classify_avx(const xed_decoded_inst_t *d)
unsigned int xed_uint_t
Definition: xed-types.h:52
xed_uint32_t subleaf
cpuid subleaf
Definition: xed-cpuid-rec.h:34
@ XED_OPERAND_REG4
Definition: xed-operand-enum.h:263
@ XED_REG_INVALID
Definition: xed-reg-enum.h:449
XED_DLL_EXPORT xed_uint32_t xed_inst_get_attribute(const xed_inst_t *p, xed_attribute_enum_t attr)
@ XED_MACHINE_MODE_LEGACY_16
16b protected mode
Definition: xed-machine-mode-enum.h:41
XED_DLL_EXPORT xed_bool_t xed_operand_values_cet_no_track(const xed_operand_values_t *p)
Definition: xed-inst.h:250
@ XED_OPERAND_ABSBR
Definition: xed-operand-enum.h:170
const XED_DLL_EXPORT char * xed_category_enum_t2str(const xed_category_enum_t p)
This converts strings to xed_category_enum_t types.
static XED_INLINE xed_bits_t xed3_operand_get_llrc(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1607
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_number_of_memory_operands(const xed_decoded_inst_t *p)
XED_DLL_EXPORT unsigned int xed_decoded_inst_operand_length_bits(const xed_decoded_inst_t *p, unsigned int operand_index)
Return the length in bits of the operand_index'th operand.
@ XED_OPERAND_MEM0
Definition: xed-operand-enum.h:218
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_immediate_width_bits(const xed_decoded_inst_t *p)
static XED_INLINE xed_bits_t xed3_operand_get_sae(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1647
XED_DLL_EXPORT void xed_decoded_inst_zero(xed_decoded_inst_t *p)
static const XED_INLINE xed_operand_values_t * xed_decoded_inst_operands_const(const xed_decoded_inst_t *p)
Definition: xed-decoded-inst-api.h:147
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_address_size_prefix(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_branch_displacement_width_bits(const xed_decoded_inst_t *p)
xed_iclass_enum_t
Definition: xed-iclass-enum.h:2002
XED_DLL_EXPORT unsigned int xed_decoded_inst_operand_elements(const xed_decoded_inst_t *p, unsigned int operand_index)
Return the number of element in the operand (for SSE and AVX operands)
XED_DLL_EXPORT xed_operand_element_type_enum_t xed_decoded_inst_operand_element_type(const xed_decoded_inst_t *p, unsigned int operand_index)
Return the type of an element of type xed_operand_element_type_enum_t (for SSE and AVX operands)
const XED_DLL_EXPORT char * xed_iclass_enum_t2str(const xed_iclass_enum_t p)
This converts strings to xed_iclass_enum_t types.
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_masked_vector_operation(xed_decoded_inst_t *p)
@ XED_OPERAND_PTR
Definition: xed-operand-enum.h:256
@ XED_OPERAND_MEM1
Definition: xed-operand-enum.h:219
const XED_DLL_EXPORT char * xed_chip_enum_t2str(const xed_chip_enum_t p)
This converts strings to xed_chip_enum_t types.
#define XED_STATIC_CAST(x, y)
Definition: xed-portability.h:27
#define XED_REINTERPRET_CAST(x, y)
Definition: xed-portability.h:28
static XED_INLINE xed_bits_t xed3_operand_get_roundc(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1639
const XED_DLL_EXPORT char * xed_reg_enum_t2str(const xed_reg_enum_t p)
This converts strings to xed_reg_enum_t types.
static XED_INLINE xed_bits_t xed3_operand_get_reg(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:839
XED_DLL_EXPORT xed_bool_t xed_classify_sse(const xed_decoded_inst_t *d)
#define XED_FMT_LX16
Definition: xed-portability.h:137
xed_cpuid_group_enum_t
Definition: xed-cpuid-group-enum.h:344
static XED_INLINE xed_uint_t xed_decoded_inst_get_machine_mode_bits(const xed_decoded_inst_t *p)
Definition: xed-decoded-inst-api.h:314
unsigned int xed_bool_t
Definition: xed-types.h:55
xed_chip_enum_t
Definition: xed-chip-enum.h:101
static XED_INLINE xed_bits_t xed3_operand_get_rexb4(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:743
const XED_DLL_EXPORT char * xed_operand_visibility_enum_t2str(const xed_operand_visibility_enum_t p)
This converts strings to xed_operand_visibility_enum_t types.
const XED_DLL_EXPORT xed_flag_set_t * xed_simple_flag_get_undefined_flag_set(const xed_simple_flag_t *p)
const XED_DLL_EXPORT xed_flag_set_t * xed_simple_flag_get_written_flag_set(const xed_simple_flag_t *p)
XED_DLL_EXPORT unsigned int xed_simple_flag_get_nflags(const xed_simple_flag_t *p)
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_memory_displacement(const xed_operand_values_t *p)
static XED_INLINE xed_bits_t xed3_operand_get_vexvalid(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1471
XED_DLL_EXPORT xed_bool_t xed_simple_flag_get_must_write(const xed_simple_flag_t *p)
static XED_INLINE xed_bits_t xed3_operand_get_rexw(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:703
XED_DLL_EXPORT xed_int32_t xed_decoded_inst_get_signed_immediate(const xed_decoded_inst_t *p)
xed_cpuid_rec_enum_t
Definition: xed-cpuid-rec-enum.h:171
static XED_INLINE xed_category_enum_t xed_decoded_inst_get_category(const xed_decoded_inst_t *p)
Definition: xed-decoded-inst-api.h:54
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_avx512_dest_elements(const xed_decoded_inst_t *p)
Returns the maximum number elements processed for an AVX512 vector instruction.
const XED_DLL_EXPORT char * xed_error_enum_t2str(const xed_error_enum_t p)
This converts strings to xed_error_enum_t types.
XED_DLL_EXPORT void xed_strcpy(char *dst, const char *src)
XED_DLL_EXPORT xed_bits_t xed_operand_values_get_pp_vex_prefix(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_bool_t xed_get_cpuid_rec(xed_cpuid_rec_enum_t cpuid_bit, xed_cpuid_rec_t *p)
provides the details of the CPUID specification, if the enumeration value is not sufficient....
static XED_INLINE xed_exception_enum_t xed_inst_exception(const xed_inst_t *p)
Definition: xed-inst.h:359
static XED_INLINE xed_bits_t xed3_operand_get_nominal_opcode(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1375
xed_exception_enum_t
Definition: xed-exception-enum.h:114
@ XED_OPERAND_AGEN
Definition: xed-operand-enum.h:171
xed_error_enum_t
Definition: xed-error-enum.h:48
Definition: xed-inst.h:53
XED_DLL_EXPORT xed_uint32_t xed_operand_values_get_stack_address_width(const xed_operand_values_t *p)
static XED_INLINE xed_isa_set_enum_t xed_decoded_inst_get_isa_set(xed_decoded_inst_t const *const p)
Definition: xed-decoded-inst-api.h:68
const XED_DLL_EXPORT char * xed_exception_enum_t2str(const xed_exception_enum_t p)
This converts strings to xed_exception_enum_t types.
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_is_broadcast(const xed_decoded_inst_t *p)
xed_address_width_enum_t
Definition: xed-address-width-enum.h:31
static XED_INLINE xed_bits_t xed3_operand_get_mod(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:831
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_immediate_is_signed(const xed_decoded_inst_t *p)
static XED_INLINE void xed3_operand_set_mpxmode(xed_decoded_inst_t *d, xed_bits_t opval)
Definition: xed-operand-accessors.h:1523
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_is_apx_zu(const xed_decoded_inst_t *p)
Return non-zero value for APX-Promtoed zero-upper instructions (ZU).
XED_DLL_EXPORT xed_int64_t xed_decoded_inst_get_memory_displacement(const xed_decoded_inst_t *p, unsigned int mem_idx)
@ XED_OPERAND_REG0
Definition: xed-operand-enum.h:259
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_operand_size_prefix(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_scale(const xed_decoded_inst_t *p, unsigned int mem_idx)
static const XED_INLINE xed_inst_t * xed_decoded_inst_inst(const xed_decoded_inst_t *p)
Definition: xed-decoded-inst-api.h:46
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_nprefixes(const xed_decoded_inst_t *p)
@ XED_CHIP_INVALID
Definition: xed-chip-enum.h:102
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_uses_rflags(const xed_decoded_inst_t *p)
This returns 1 if the flags are read or written.
XED_DLL_EXPORT xed_bool_t xed_classify_amx(const xed_decoded_inst_t *d)
static XED_INLINE void xed_state_zero(xed_state_t *p)
clear the xed_state_t
Definition: xed-state.h:88
@ XED_OPERAND_REG1
Definition: xed-operand-enum.h:260
static XED_INLINE xed_bits_t xed3_operand_get_zeroing(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1599
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_vector_length_bits(xed_decoded_inst_t const *const p)
XED_DLL_EXPORT xed_bool_t xed_classify_avx512(const xed_decoded_inst_t *d)
XED_DLL_EXPORT unsigned int xed_attribute_max(void)
@ XED_ADDRESS_WIDTH_32b
32b addressing
Definition: xed-address-width-enum.h:34
#define XED_FMT_LD
Definition: xed-portability.h:136
@ XED_OPERAND_REG2
Definition: xed-operand-enum.h:261
XED_DLL_EXPORT unsigned int xed_decoded_inst_get_memory_operand_length(const xed_decoded_inst_t *p, unsigned int memop_idx)
returns bytes
xed_uint8_t bit_start
the bit start index for the feature
Definition: xed-cpuid-rec.h:36
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_mem_read(const xed_decoded_inst_t *p, unsigned int mem_idx)
static XED_INLINE void xed_decoded_inst_set_input_chip(xed_decoded_inst_t *p, xed_chip_enum_t chip)
Set a user-specified xed_chip_enum_t chip name for restricting decode.
Definition: xed-decoded-inst-api.h:353
static XED_INLINE xed_bits_t xed3_operand_get_rexr(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:711
const XED_DLL_EXPORT xed_flag_action_t * xed_simple_flag_get_flag_action(const xed_simple_flag_t *p, unsigned int i)
XED_DLL_EXPORT xed_chip_enum_t str2xed_chip_enum_t(const char *s)
This converts strings to xed_chip_enum_t types.
@ XED_ADDRESS_WIDTH_64b
64b addressing
Definition: xed-address-width-enum.h:35
static XED_INLINE xed_operand_enum_t xed_operand_name(const xed_operand_t *p)
Definition: xed-inst.h:80
XED_DLL_EXPORT xed_int64_t xed_decoded_inst_get_branch_displacement(const xed_decoded_inst_t *p)
const XED_DLL_EXPORT char * xed_reg_class_enum_t2str(const xed_reg_class_enum_t p)
This converts strings to xed_reg_class_enum_t types.
const XED_DLL_EXPORT char * xed_iform_enum_t2str(const xed_iform_enum_t p)
This converts strings to xed_iform_enum_t types.
Encapsulates machine modes for decoder/encoder requests.
Definition: xed-state.h:39
static XED_INLINE xed_operand_visibility_enum_t xed_operand_operand_visibility(const xed_operand_t *p)
Definition: xed-inst.h:87
static XED_INLINE unsigned int xed_inst_noperands(const xed_inst_t *p)
Definition: xed-inst.h:312
@ XED_OPERAND_BASE1
Definition: xed-operand-enum.h:175
static XED_INLINE xed_bits_t xed3_operand_get_ubit(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:1663
const XED_DLL_EXPORT char * xed_operand_width_enum_t2str(const xed_operand_width_enum_t p)
This converts strings to xed_operand_width_enum_t types.
static XED_INLINE xed_operand_width_enum_t xed_operand_width(const xed_operand_t *p)
Definition: xed-inst.h:111
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_memory_displacement_width(const xed_decoded_inst_t *p, unsigned int mem_idx)
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_branch_displacement_width(const xed_decoded_inst_t *p)
XED_DLL_EXPORT xed_cpuid_group_enum_t xed_get_cpuid_group_enum_for_isa_set(xed_isa_set_enum_t isaset, xed_uint_t i)
Returns the name of the i'th cpuid group associated with the given isa-set. This function is called r...
static XED_INLINE xed_uint8_t xed_decoded_inst_get_second_immediate(const xed_decoded_inst_t *p)
Definition: xed-decoded-inst-api.h:521
static XED_INLINE void xed3_operand_set_cet(xed_decoded_inst_t *d, xed_bits_t opval)
Definition: xed-operand-accessors.h:1531
@ XED_MACHINE_MODE_LONG_64
64b operating mode
Definition: xed-machine-mode-enum.h:37
XED_DLL_EXPORT void xed_tables_init(void)
static XED_INLINE xed_bits_t xed3_operand_get_rexb(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:727
xed_uint32_t of
Definition: xed-flags.h:38
xed_uint32_t leaf
cpuid leaf
Definition: xed-cpuid-rec.h:33
const XED_DLL_EXPORT xed_operand_t * xed_inst_operand(const xed_inst_t *p, unsigned int i)
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_mem_written(const xed_decoded_inst_t *p, unsigned int mem_idx)
xed_operand_action_enum_t
Definition: xed-operand-action-enum.h:35
XED_DLL_EXPORT xed_attribute_enum_t xed_attribute(unsigned int i)
xed_reg_enum_t
Definition: xed-reg-enum.h:448
xed_uint32_t sf
Definition: xed-flags.h:39
@ XED_OPERAND_REG3
Definition: xed-operand-enum.h:262
Definition: xed-flags.h:35
@ XED_ATTRIBUTE_APX_NF
Definition: xed-attribute-enum.h:136
@ XED_EXCEPTION_INVALID
Definition: xed-exception-enum.h:115
XED_DLL_EXPORT xed_operand_action_enum_t xed_decoded_inst_operand_action(const xed_decoded_inst_t *p, unsigned int operand_index)
Interpret the operand action in light of AVX512 masking and zeroing/merging.
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_66_prefix(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_bool_t xed_operand_values_branch_not_taken_hint(const xed_operand_values_t *p)
@ XED_CPUID_GROUP_INVALID
Definition: xed-cpuid-group-enum.h:345
XED_DLL_EXPORT unsigned int xed_decoded_inst_get_memop_address_width(const xed_decoded_inst_t *p, xed_uint_t memop_idx)
Returns the addressing width in bits (16,32,64) for MEM0 (memop_idx==0) or MEM1 (memop_idx==1).
xed_attribute_enum_t
Definition: xed-attribute-enum.h:132
const XED_DLL_EXPORT char * xed_operand_action_enum_t2str(const xed_operand_action_enum_t p)
This converts strings to xed_operand_action_enum_t types.
@ XED_CPUID_REC_INVALID
Definition: xed-cpuid-rec-enum.h:172
Definition: xed-decoded-inst.h:53
static XED_INLINE xed_bits_t xed3_operand_get_rm(const xed_decoded_inst_t *d)
Definition: xed-operand-accessors.h:855
XED_DLL_EXPORT xed_bool_t xed_operand_values_mandatory_66_prefix(const xed_operand_values_t *p)
const XED_DLL_EXPORT char * xed_attribute_enum_t2str(const xed_attribute_enum_t p)
This converts strings to xed_attribute_enum_t types.
XED_DLL_EXPORT xed_bool_t xed_operand_values_branch_taken_hint(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_uint32_t xed_decoded_inst_get_operand_width(const xed_decoded_inst_t *p)
Returns the operand width in bits: 8/16/32/64.