capstone-engine / capstone

Capstone disassembly/disassembler framework for ARM, ARM64 (ARMv8), Alpha, BPF, Ethereum VM, HPPA, LoongArch, M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH, Sparc, SystemZ, TMS320C64X, TriCore, Webassembly, XCore and X86.
http://www.capstone-engine.org
7.18k stars 1.52k forks source link

ARM Thumb instruction RSB detials operands issue #2382

Open yakamoz423 opened 4 weeks ago

yakamoz423 commented 4 weeks ago

Work environment

Questions Answers
OS/arch/bits Windows x64
Architecture armv8
Source of Capstone git clone
Version/git commit next 1a6921f5cc3e1084a6658ad05ed2c00a7ff1fd00

Instruction bytes giving faulty results

0x4240

Steps to get the wrong result

With cstool:

cstool -dr thumbbe 4240

 0  42 40  rsbs r0, r0, #0
        ID: 352 (rsb)
        op_count: 3
                operands[0].type: REG = r0
                operands[0].access: WRITE
                operands[1].type: IMM = 0x0
                operands[1].access: READ
                operands[2].type: REG = r0
                operands[2].access: READ
        Update-flags: True
        Registers read: r0
        Registers modified: cpsr r0
        Groups: IsThumb

You can see the order of the operands[1] and [2] is reversed.