M68K: Branch targets are a separate addressing mode; PC relative displacements printed as target addresses (#1068)

* Branch targets are a separate addressing mode

Branch targets are relative displacements that identify code locations. These are neither .w nor .l nor immediates. This change removes the immediate #s before branch target addresses in disassembly, and represents the actual branch instructions more accurately in the cs_m68k_op datastructure.

M68K Python bindings have also been updated.

* m68k_inst.pc handles better; print target for PC relative offsets

Previous changes to branch operations relied on m68k_inst.pc pointing to (start of instruction + 2). This was not the case - it pointed to the end of the current instruction. This change makes it so that m68k_inst.pc points to (start of instruction), which is simple to work with.

It also changes printing of PC relative offsets to print the absolute target address, which is consistent with how most 68000 assemblers & disassemblers behave.
6 files changed
tree: 7c75646e246a43de8a0597ea855917c19111f518
  1. arch/
  2. bindings/
  3. contrib/
  4. cstool/
  5. docs/
  6. include/
  7. msvc/
  8. packages/
  9. suite/
  10. tests/
  11. windows/
  12. windowsce/
  13. xcode/
  14. .appveyor.yml
  15. .gitignore
  16. .travis.yml
  17. capstone.pc.in
  18. ChangeLog
  19. CMakeLists.txt
  20. COMPILE.TXT
  21. COMPILE_CMAKE.TXT
  22. COMPILE_MSVC.TXT
  23. config.mk
  24. CREDITS.TXT
  25. cs.c
  26. cs_priv.h
  27. functions.mk
  28. HACK.TXT
  29. LEB128.h
  30. LICENSE.TXT
  31. LICENSE_LLVM.TXT
  32. make.sh
  33. Makefile
  34. MathExtras.h
  35. MCDisassembler.h
  36. MCFixedLenDisassembler.h
  37. MCInst.c
  38. MCInst.h
  39. MCInstrDesc.c
  40. MCInstrDesc.h
  41. MCRegisterInfo.c
  42. MCRegisterInfo.h
  43. nmake-x86.bat
  44. nmake.bat
  45. pkgconfig.mk
  46. README.md
  47. RELEASE_NOTES
  48. SStream.c
  49. SStream.h
  50. TODO
  51. utils.c
  52. utils.h
README.md

Capstone Engine

Build Status Build status

Capstone is a disassembly framework with the target of becoming the ultimate disasm engine for binary analysis and reversing in the security community.

Created by Nguyen Anh Quynh, then developed and maintained by a small community, Capstone offers some unparalleled features:

  • Support multiple hardware architectures: ARM, ARM64 (ARMv8), M68K, Mips, PPC, Sparc, SystemZ, TMS320C64X, M680X, XCore and X86 (including X86_64).

  • Having clean/simple/lightweight/intuitive architecture-neutral API.

  • Provide details on disassembled instruction (called “decomposer” by others).

  • Provide semantics of the disassembled instruction, such as list of implicit registers read & written.

  • Implemented in pure C language, with lightweight bindings for PHP, PowerShell, Emacs, Haskell, Perl, Python, Ruby, C#, NodeJS, Java, GO, C++, OCaml, Lua, Rust, Delphi, Free Pascal & Vala ready either in main code, or provided externally by the community).

  • Native support for all popular platforms: Windows, Mac OSX, iOS, Android, Linux, *BSD, Solaris, etc.

  • Thread-safe by design.

  • Special support for embedding into firmware or OS kernel.

  • High performance & suitable for malware analysis (capable of handling various X86 malware tricks).

  • Distributed under the open source BSD license.

Further information is available at http://www.capstone-engine.org

Compile

See COMPILE.TXT file for how to compile and install Capstone.

Documentation

See docs/README for how to customize & program your own tools with Capstone.

Hack

See HACK.TXT file for the structure of the source code.

License

This project is released under the BSD license. If you redistribute the binary or source code of Capstone, please attach file LICENSE.TXT with your products.