capstone icon indicating copy to clipboard operation
capstone copied to clipboard

x86: vmovsd has incorrect access for operands

Open tobast opened this issue 2 years ago • 2 comments

Hello,

When disassembling a vmovsd instruction that stores to memory in x86, eg. vmovsd qword ptr [rdx], xmm0 (c5fb1102), the first operand is marked as read instead of written by capstone.

Indeed,

$ ./cstool/cstool -d x64 'c5 fb 11 02'
 0  c5 fb 11 02                                      vmovsd     qword ptr [rdx], xmm0
        ID: 1046 (vmovsd)
        Prefix:0x00 0x00 0x00 0x00
        Opcode:0xc5 0xfb 0x00 0x00
        rex: 0x40
        addr_size: 8
        modrm: 0x2
        disp: 0x0
        sib: 0x0
        op_count: 2
                operands[0].type: MEM
                        operands[0].mem.base: REG = rdx
                operands[0].size: 8
                operands[0].access: READ
                operands[1].type: REG = xmm0
                operands[1].size: 16
                operands[1].access: READ
        Registers read: rdx xmm0
        Groups: avx

I found that, indeed, in X86MappingInsnOp.inc, many of the versions of VMOVSD… were using CS_AC_READ, CS_AC_READ, 0 for their attributes; I am however unsure of where this should be addressed, and what other instructions might be affected the same way.

This issue seems to be present in both next, 5.0 and 4.0.2.

tobast avatar Aug 14 '23 15:08 tobast

Ideally, the X86 should also be ported to the new "auto-sync" mechanism, it would fix many X86 problems and regressions. Sadly, we don't have time and hands to do that, as we focus on non-x86 due to the slightly different implementation of it in LLVM. External help on https://github.com/capstone-engine/llvm-capstone/issues/13 is welcome.

XVilka avatar Aug 16 '23 03:08 XVilka

iShot_2023-11-20_14 42 40

I had the same problem with the arm64. version: 5.0.0

pkilller avatar Nov 20 '23 06:11 pkilller