Skip to content

Wrong disasm result in ARMv7-M #1985

@syheliel

Description

@syheliel

POC:

import capstone
function_bytes = b"\xDF\xF8\x34\xD0\x00\x21\x03\xE0"
md = capstone.Cs(capstone.CS_ARCH_ARM, capstone.CS_MODE_ARM)
count = 0
for insn in md.disasm(function_bytes,0):
	import binascii
	print(f"{insn.address:x}: {binascii.hexlify(insn.bytes).decode()} : {insn.mnemonic} {insn.op_str}")
	count += 1

In capstone, it is parsed as:

0: dff834d0 : ldrsbtle pc, [r4], -pc
4: 002103e0 : and r2, r3, r0, lsl #2

But it doesn't match with IDA's result, this is my IDA's setting:
image
And this is IDA's result, 002103e0 should be taken as two different insns:0021 and 03e0
image
How can I config my capstone to get the IDA's result?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions