capstone icon indicating copy to clipboard operation
capstone copied to clipboard

Disassembly Error, repne movsd

Open jskew opened this issue 1 year ago • 2 comments

import capstone

print(capstone.__version__)
md = capstone.Cs( capstone.CS_ARCH_X86, capstone.CS_MODE_32 )
insn = next(md.disasm(b'\xf2\xa4', 0, 1)); print('%s %s %s' % (insn.bytes.hex(), insn.mnemonic, insn.op_str))
insn = next(md.disasm(b'\xf2\xa5', 0, 1)); print('%s %s %s' % (insn.bytes.hex(), insn.mnemonic, insn.op_str))

5.0.3

f2a4 repne movsb byte ptr es:[edi], byte ptr [esi]
f2a5 movsd dword ptr es:[edi], dword ptr [esi]

It should be:

f2a4 repne movsb byte ptr es:[edi], byte ptr [esi]
f2a5 repne movsd dword ptr es:[edi], dword ptr [esi]

jskew avatar Sep 29 '24 20:09 jskew

x:\capstone\arch\X86\X86Mapping.c

static bool valid_repne(cs_struct *h, unsigned int opcode)

//if (opcode == X86_MOVSW) // REP MOVSB replace if (opcode == X86_MOVSL) // REP MOVSD

jskew avatar Nov 16 '24 05:11 jskew

Is this a fix? If yes, please open a PR with it and add a test case.

Rot127 avatar Nov 18 '24 11:11 Rot127