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.63k stars 1.56k forks source link

arm: Sign of immediate is unclear #2056

Open akihikodaki opened 1 year ago

akihikodaki commented 1 year ago

This issue was found during the discussion at: https://github.com/capstone-engine/capstone/pull/771#issuecomment-1594586622

Some instructions interpret immediates as signed while the others interpret them as unsigned. However, the imm member of cs_arm_op is typed as signed, which causes two problems:

It will be nice if we can change how to store and load immediate values in cs_arm_op depending on instructions.

Rot127 commented 1 year ago

Just as a note. LLVM saves immediate values in general as int64_t. We can think about doing just that. So we mimic LLVM as close as possible.