Skip to content

5.0.0rc4 branch instruction imm ambiguous #2072

Closed
@vacuastreas

Description

@vacuastreas
>>> import capstone
>>> capstone.version_bind()
(5, 0, 1280)
>>> cs = capstone.Cs(capstone.CS_ARCH_ARM64, capstone.CS_MODE_ARM)
>>> cs.detail = True
>>> inst_bytes = b'\x07\x00\x00\x14'
>>> inst = cs.disasm(inst_bytes, 0xfffffff044444444)
>>> inst = next(inst)
>>> inst
<CsInsn 0xfffffff044444444 [07000014]: b #0xfffffff044444460>
>>> operand = inst.operands[0]
>>> hex(operand.imm)
'-0xfbbbbbba0'

operand.imm currently outputs as signed version of the branch label which is incorrect.
Should it be:

  • the unsigned label
  • the signed imm26 encoded in the instruction
    • multiply by 4
    • without multiply by 4

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