Skip to content

[WIP] Capstone v6 support #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 41 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
bd0d9a6
sys: bump capstone to 6.0.0-alpha4, fix arm64 and sysz rename
jiegec May 23, 2025
e794cd0
rs: rename arm64 -> aarch64 and sysz -> systemz to follow upstream
jiegec May 23, 2025
e8d28fa
rs: adapt to capstone v6 changes, mainly in aarch64
jiegec May 23, 2025
82776cf
rs: use aarch64_reg::Type for windows compat
jiegec May 23, 2025
b5ba6cd
rs: run cargo fmt to make ci happy
jiegec May 23, 2025
f819683
rs, sys: mention capstone 6.0.0-alpha4 and arch renaming in CHANGELOG
jiegec May 23, 2025
81b8f84
rs: avoid possible panics in library functions
jiegec May 23, 2025
c046d65
rs: add missing doc comments
jiegec May 23, 2025
cf181eb
rs, sys: generate arm_spsr_cspr_bits as bitfield enum
jiegec May 24, 2025
dbaa68d
rs: add previously failed testcase from issue 175
jiegec May 24, 2025
2434a33
ci: rename arch_arm64 to arch_aarch64 feature
jiegec May 24, 2025
fe0037b
sys: add Alpha arch support
jiegec May 24, 2025
30395c2
rs, sys: fix feature detection after renaming
jiegec May 24, 2025
4b82151
sys: add HPPA arch support
jiegec May 24, 2025
9262f5e
sys: add LoongArch arch support
jiegec May 24, 2025
0f406b2
sys: add Xtensa arch support
jiegec May 24, 2025
5de6e80
sys: add ARC arch support
jiegec May 24, 2025
4f00085
sys: move bpf bindings around to become in order
jiegec May 24, 2025
47ec2a7
rs: add Alpha arch support
jiegec May 24, 2025
2a17cf9
sys: fix build.rs lifetime for Rust 1.70.0
jiegec May 24, 2025
240bf5d
rs: add HPPA arch support
jiegec May 24, 2025
f16b5fd
rs: add LoongArch arch support
jiegec May 24, 2025
fd27c2c
rs: rename variable to reflect its type
jiegec May 24, 2025
82bf2e2
rs: disable failing hppa test due to upstream bug
jiegec May 24, 2025
bf6ed1f
rs: add Xtensa arch support
jiegec May 24, 2025
73c58d8
rs: fix tests on windows
jiegec May 24, 2025
65d5bdd
rs: add ARC arch support
jiegec May 24, 2025
f541a20
rs: fix type conversion on windows
jiegec May 24, 2025
265669b
rs: bump capstone to 6.0.0-Alpha4-8-gefc0ba44 to fix upstream bugs
jiegec May 26, 2025
b042b2a
rs: update tests after upstream bugs are fixed
jiegec May 26, 2025
804f160
rs: test CS_OPT_UNSIGNED using x86 code
jiegec May 26, 2025
9905c32
rs, sys: bump capstone to 6.0.0-Alpha4-13-gfe6bdc6e
jiegec Jun 15, 2025
202cf86
sys: bump capstone to 6.0.0-Alpha4-25-g717d8b05
jiegec Jul 9, 2025
f8f2520
rs: bump capstone to 6.0.0-Alpha4-25-g717d8b05
jiegec Jul 9, 2025
4b199bb
rs: add access mode to sparc operand
jiegec Jul 9, 2025
d878ee3
rs: document recent changes in CHANGELOG
jiegec Jul 9, 2025
05aea5d
rs: update tests for sparc, not a bug actually
jiegec Jul 9, 2025
6c99b35
rs: apply cargo clippy
jiegec Jul 9, 2025
0f57559
rs: fix tests on windows
jiegec Jul 9, 2025
36a2b30
rs, sys: bump capstone to 6.0.0-Alpha5
jiegec Aug 4, 2025
071ee66
rs: zero initialize cs_insn to make valgrind happy
jiegec Aug 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ jobs:
- name: test (with bindgen)
run: env ${{ matrix.rust.env }} FEATURES="use_bindgen" ./capstone-rs/ci/test.sh

- name: test (only enable x86 and arm64)
run: env ${{ matrix.rust.env }} FEATURES=std,full,arch_x86,arch_arm64 NO_DEFAULT_FEATURES=1 ./capstone-rs/ci/test.sh
- name: test (only enable x86 and aarch64)
run: env ${{ matrix.rust.env }} FEATURES=std,full,arch_x86,arch_aarch64 NO_DEFAULT_FEATURES=1 ./capstone-rs/ci/test.sh
14 changes: 12 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- TriCore arch support
- MOS65XX arch support
- SH arch support
- Alpha arch support
- HPPA arch support
- LoongArch arch support
- Xtensa arch support
- ARC arch support
- Arch-specific features flags to enable/disable arch support
- Expose X86 instruction encoding info via `X86InsnDetail::encoding()`
- Make RegAccessType available for ARM64
- Make AccessType available for ARM64 & Sparc
- New operands types are added to `ArmOperandType`
- Rename RegAccessType to AccessType while keeping type alias
- Expose `CS_OPT_UNSIGNED` via `Capstone::set_unsigned`
- Expose `CS_OPT_MNEMONIC` via `Capstone::set_mnemonic`
- Expose `cs_disasm_iter` via `Capstone::disasm_iter`
- Add `check_only` feature to speed up `cargo check` by building without native code
- Rename ARM64 to AARCH64, SYSZ to SYSTEMZ to follow upstream changes

### Changed
- `InsnDetail::regs_read()`/`InsnDetail::regs_write()` return more of the accessed registers
- Bump bundled capstone to 5.0.6
- Bump bundled capstone to 6.0.0-Alpha5
- Rename ARM64 to AARCH64, SYSZ to SYSTEMZ to follow upstream changes
- AArch64 support is rewritten to follow upstream changes
- Endian must be specified for Sparc/SystemZ, since little endian support is added

### Fixed
- `impl Display for Insn<'_>` now avoids to print trailing space
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ More complex demos welcome!
- `use_bindgen`: run `bindgen` to generate Rust bindings to Capstone C library
instead of using pre-generated bindings (not recommended)
- `arch_$ARCH`<sup>&dagger;</sup>: enable arch `$ARCH` support in capstone,
e.g. `arch_arm64` enables arch arm64 support
e.g. `arch_aarch64` enables arch aarch64 support.
- `support_all_archs`<sup>&dagger;</sup>: enable all archs available
in capstone, imply all `arch_$ARCH` features
- `check_only`: do not compile and link capstone C library,
Expand Down
18 changes: 14 additions & 4 deletions capstone-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ full = ["capstone-sys/full"]
use_bindgen = ["capstone-sys/use_bindgen"]
# arch specific features to reduce binary size
support_all_archs = [
"arch_aarch64",
"arch_alpha",
"arch_arc",
"arch_arm",
"arch_arm64",
"arch_bpf",
"arch_evm",
"arch_hppa",
"arch_loongarch",
"arch_m680x",
"arch_m68k",
"arch_mips",
Expand All @@ -50,18 +54,23 @@ support_all_archs = [
"arch_riscv",
"arch_sh",
"arch_sparc",
"arch_sysz",
"arch_systemz",
"arch_tms320c64x",
"arch_tricore",
"arch_wasm",
"arch_x86",
"arch_xcore",
"arch_xtensa",
"capstone-sys/support_all_archs",
]
arch_aarch64 = ["capstone-sys/arch_aarch64"]
arch_alpha = ["capstone-sys/arch_alpha"]
arch_arc = ["capstone-sys/arch_arc"]
arch_arm = ["capstone-sys/arch_arm"]
arch_arm64 = ["capstone-sys/arch_arm64"]
arch_bpf = ["capstone-sys/arch_bpf"]
arch_evm = ["capstone-sys/arch_evm"]
arch_hppa = ["capstone-sys/arch_hppa"]
arch_loongarch = ["capstone-sys/arch_loongarch"]
arch_m680x = ["capstone-sys/arch_m680x"]
arch_m68k = ["capstone-sys/arch_m68k"]
arch_mips = ["capstone-sys/arch_mips"]
Expand All @@ -70,11 +79,12 @@ arch_powerpc = ["capstone-sys/arch_powerpc"]
arch_riscv = ["capstone-sys/arch_riscv"]
arch_sh = ["capstone-sys/arch_sh"]
arch_sparc = ["capstone-sys/arch_sparc"]
arch_sysz = ["capstone-sys/arch_sysz"]
arch_systemz = ["capstone-sys/arch_systemz"]
arch_tms320c64x = ["capstone-sys/arch_tms320c64x"]
arch_tricore = ["capstone-sys/arch_tricore"]
arch_wasm = ["capstone-sys/arch_wasm"]
arch_x86 = ["capstone-sys/arch_x86"]
arch_xcore = ["capstone-sys/arch_xcore"]
arch_xtensa = ["capstone-sys/arch_xtensa"]
# Can be used to accelerate check builds by not building C code
check_only = ["capstone-sys/check_only"]
Loading
Loading