intelxed / xed

The X86 Encoder Decoder (XED), is a software library for encoding and decoding X86 (IA32 and Intel64) instructions
https://intelxed.github.io/
Apache License 2.0
1.39k stars 145 forks source link

Wrong operand typre returned by xed_decoded_inst_operand_element_type() #229

Open jeffli678 opened 4 years ago

jeffli678 commented 4 years ago

For instruction pminub xmm0, xmm (hex 660fdac1), the two operands should both be XED_OPERAND_ELEMENT_TYPE_UINT. However, XED_OPERAND_ELEMENT_TYPE_INT is returned by xed_decoded_inst_operand_element_type().

This can be confirmed by running the xed example 1 (see column ELEMTYPE):

$ ./xed-ex1 660fdac1
Attempting to decode: 66 0f da c1 
iclass PMINUB   category SSE    ISA-extension SSE2  ISA-set SSE2
instruction-length 4
operand-width 32
effective-operand-width 32
effective-address-width 32
stack-address-width 32
iform-enum-name PMINUB_XMMdq_XMMdq
iform-enum-name-dispatch (zero based) 3
iclass-max-iform-dispatch 4
Operands
#   TYPE               DETAILS        VIS  RW       OC2 BITS BYTES NELEM ELEMSZ   ELEMTYPE   REGCLASS
#   ====               =======        ===  ==       === ==== ===== ===== ======   ========   ========
0   REG0             REG0=XMM0   EXPLICIT  RW        DQ  128    16     4     32        INT        XMM
1   REG1             REG1=XMM1   EXPLICIT   R        DQ  128    16     4     32        INT        XMM
Memory Operands
  MemopBytes = 0
ATTRIBUTES: REQUIRES_ALIGNMENT 
ANY 66 PREFIX
EXCEPTION TYPE: SSE_TYPE_4
SSE
Vector length: 128 
Number of legacy prefixes: 1 
ISA SET: [SSE2]
0   CPUID BIT NAME: [SSE2]
    Leaf 0x00000001, subleaf 0x00000000, EDX[26]
markcharney commented 4 years ago

The element types are missing from the older stuff (before AVX); XED generally attempts to infer type information from the oc2 thing (dq, etc) when not present. I can fix this one instruction but would have to allocate some time to add types to the all the older stuff. Thanks for reminding me.