Commit graph

26 commits

Author SHA1 Message Date
Amaan Mujawar
54fcf14f05
AArch64: Add option for explicit shifted wide immediates (#2995)
Add CS_OPT_SYNTAX_AARCH64_EXPLICIT_WIDE_IMM to print shifted
MOVN and MOVZ instructions in their explicit forms instead of using
the equivalent MOV aliases.

Keep the existing LLVM-compatible alias output as the default, and
retain MOV aliases for unshifted instructions when the option is
enabled.

Expose the option through cstool and the Python bindings, and add
regression tests for MOVN, MOVZ, 32-bit and 64-bit forms.

Fixes #2890

Signed-off-by: Amaan Mujawar <amaansmujawar@gmail.com>
2026-07-16 15:24:18 +00:00
مصطفي محمود كمال الدين
19243483f6
Add frm operands to float/double instructions (#2972)
---------

Co-authored-by: Rot127 <45763064+Rot127@users.noreply.github.com>
2026-06-23 13:28:28 +00:00
billow
4eeceba201
Add M68K ColdFire ISA support (#2927)
* regenerate arch/M68K/M68KInstructionTable.inc

* Add M68K ColdFire ISA support

* Apply suggestions from code review

Co-authored-by: Rot127 <45763064+Rot127@users.noreply.github.com>

* Clarify M68K EA validation and detail checks

* Normalize M68K memory operand details

* Update docs/cs_v6_release_guide.md

---------

Co-authored-by: Rot127 <45763064+Rot127@users.noreply.github.com>
2026-05-22 15:04:35 +00:00
مصطفي محمود كمال الدين
b4c39410ab
Introduce a +noaliascompressed option to selectively enable none-aliasing for compressed instrcution only but leave aliasing for the rest of instructions (#2869)
* introduce a +noaliascompressed option to selectively enable none-aliasing for compressed instrcution only but leave aliasing for the rest of instructions

* add tests and documentation comments

* fix python bindings and formatting

* add docs
2026-03-04 12:43:39 +00:00
مصطفي محمود كمال الدين
ec6428f92d
Refactoring the RISCV architecture to Auto-Sync on LLVM (#2756)
- Updated to LLVM-18
- Operands have now read/write access information
- Previously only the basic extensions and the compressed ISA was supported, now every extension supported by LLVM-18 also available (e.g. vector, crypto, ...)
- Changed register names
  * FP Regs: Instead of `RISCV_REG_F<n>_32` and `RISCV_REG_F<n>_64`, they're named `RISCV_REG_F<n>_F`
  and `RISCV_REG_F<n>_D` for n in `0..31`
- Added register names
  * Vector registes and combinations thereof `RISCV_REG_V<n>[_V<n_i>]*`, examples
    * `RISCV_REG_V21`
    * `RISCV_REG_V9_V10`
    * `RISCV_REG_V3_V4_V5`
    * etc... up to 8-register combinations
  * Half-percision (16-bit) FP registers `RISCV_REG_F<n>_H` for n in `0..31`
- Changed instruction names
  * Instructions ending in `_AQ_RL` now end in `_AQRL`
- Added instruction names: massive amount, see `include/capstone/riscv.h`
- Added `dimm` and `csr` fields inside the union data of `cs_riscv_op`, with corresponding `riscv_op_type`
  * `dimm` is used for instructions with FP immediates
  * `csr` is used for instructions with CSR systrem registes
- Added ISA flags to turn ISA extensions on and off
2026-02-01 11:53:24 +00:00
Carsten Elton Sørensen
630f1ae92b
M68K: add displacement size fields to disassembler (#2842) 2026-01-11 13:37:45 +00:00
Carsten Elton Sørensen
1bc76ead22
M68K: fix displacement, register naming and suppressed registers in indexed addressing modes (#2839) 2026-01-04 15:16:25 +00:00
Giovanni
198cd49dd9
Fix imm to be 64bit wide (#2840) 2025-12-30 15:55:48 +00:00
Rot127
155a483672
Fix cstest_py and add negative tests. (#2807)
* Fix faulty _check().

* Add negative test case for cstest_py

* Enable full leak report and fix leaks.

* Add negative tests to cmake and CI.

* Fix typos
2025-10-29 10:18:21 +00:00
Tim Haines
8cdfe4ce71
Add instruction details to cstest logging (#2787)
* Update cstest.py logging

* Update cstest.c logging

* Change exception to log+return in TestExpected.compare

The prior change in TestCase.test converts the exception to
TestResult.FAILED which doesn't preserve the status here.

* Restore calling sequence in TestCase.test

The transformation didn't preserve error reporting. It also is
unnecessary now that TestExpected.compare returns a TestResult again.

* Convert exception to return for length check in TestExpected.compare

The callsite in TestCase.test no longer converts exceptions to a
TestResult.

* Rename local variable 'postfix' to 'prefix' in test_input_stringify

This better reflects what it actually is.
2025-10-04 19:23:44 +00:00
Tim Haines
ff04ff1aa0
Fix log message in cstest_py/compare.compare_bit_flags (#2783) 2025-09-01 15:10:17 +00:00
Rot127
2f85e932c1
Fix cstest missing size checks (#2775)
* Enable cstest/cstest_py to test for instruction size.

* Add missing operand->size check for x86 details.

* Use tbool instead of int for unity across code.

* Fix: operand->size is optional.
2025-08-17 13:02:27 +00:00
R3v0LT
52329bcca1
HPPA fix mem operands access and instruction printing (#2746)
* Remove base_access

* Add spaces into instrtuction mnemonics

* Fix hppa test

* Fix common details test

* Add hppa access tests
2025-07-06 11:21:22 +00:00
Rot127
a07baf83dd
Auto-Sync update Sparc LLVM-18 (#2704)
* Add Sparc inc fils, delete old files and update AS with Sparc config.

* AS: Refuse to run differ if an old file is missing.

* AS: Refer to the RefactorGuide.md

* Add first translated Sparc files.

* Fixup SparcMCTargetDesc.h

* Fixup SparcDisassembler.h

* Fixup instruction printer.

* Fixup SparcInstPrinter

* Basic functions of Capstone module

* Fix SP sparc namespace prefix.

* Fix build script and linking

* Fix disassembler not actually reading bytes.

* Match \!encoding in llvm-mc output (Sparc has this).

* Add Sparc LE and and make v9 a feature to enable.

* Update test files for Sparc

* Fix tests.

* Add assembly tests

* AS: Add settings to use assembly tests.

* Test fixes

* Fix typos

* Add reg and imm details.

* Add mem details and instruction formats.

* Handle condition codes.

* Formatting

* Add hints.

* Add membar and asi tags

* Update Python bindings

* Add asi and membar to cstest

* Restructure test file

* Capstone fix for llvm-project/#139284.

* Fix branch detail tests

* Handle faulty mem operand defintions.

* Add membar and asi tests

* Add one more branch instruction test.

* Add missing call alias

* Fix tests.

Updated after fixing branch disponents.
Issues with the generated assembly tests. The assembly tests don't check the feature flags enabled. And hence V9 tests are added to the none V9 test file.

* Fix alias lookup with , in the asm_text

* Fix common detail tests.

* Fix issue.yaml

* Add Sparc changelog

* Add changelog for Sparc to v6 guide

* Fix incorrect translated array size check.

* Reading the ISA and thinking would help...
This is not how alignment is calculated -.-

* Fix call targets

* Remove 'real' BA instruction (which is only an alias).

* Add missing property getters.

* Add missing format details

* Set correct detail struct

* Support access detail testing for Sparc.

* Add hard-coded special registers tbr, wim, psr

* Add alias tests for call and ba.

* Fix copy paste mistake.

* Add note about big/little endian into guide.

* Add implied flag for SparcV9

* Format

* Store CC field consistently in an extra field.

The CC field used was sometimes stored as register,
sometimes as not at all.
Now it is consistently stored in a separated field.

* Add an invalid ASI tag.

* Fix LDSTUB/A memory access and incorrect operand details.

* Handle condition codes more elegantly.

Also fixes bugs with wrong cc fields, or missing fields.

* Add separation ; character for assembly tests.

* Apply fix from llvm-project/#143232

* Use enum types for memory operands

* Update Pythyon constants
2025-06-24 12:45:34 +00:00
Rot127
87908ece5b
Add flag for the SoftFail case of the LLVM disassembler. (#2707) 2025-05-26 21:39:17 +08:00
Giovanni
1bea3fab15
Add checks for MIPS details on cstest_py (#2640) 2025-02-27 17:19:21 +08:00
Giovanni
ace8056ca8
Add aliases mapping for MIPS & test for id, alias_id (#2635) 2025-02-26 23:42:31 +08:00
Rot127
d7ef910bc6
Rebased #2570 (#2614)
* Add ARC files

* Added ARC files for successful compilation

* Refactor ARC files

* Add ARC c/cs tests

* Add ARC python test/bindings

* Add ARC to CI/CD

* Avoid omitting parameter names

* Update cs files

* Fix ARC bugs

* Update ARC python bindings

* Refactor and update ARC test files

* Add detail flag to arc test

* Fix ARC test problems

* Fix ARCMapping compile error

* Replace __CHAR_BIT__ to CHAR_BIT

* Add credits and ARC info

* Update ARC to match the latest next

* Python formatting

* Remove asserts on 'Unknown condition code passed'

* Add ARC to some more documentation

* Add ARC to Targets constants

* Add ARC support to llvm-tblgen

* Replace asserts & add Expr handling

* Check DecodeGPR32RegisterClass return value

* Fix fieldFromInstruction patch

* Refactor ARC

* Reformat python files

* Fix incorrect import

* Update inc files and insn names

* Update python files

* Disable AArch64 Linux wheel build due to https://github.com/capstone-engine/capstone/issues/2615.

---------

Co-authored-by: R33v0LT <sibirtsevdl@gmail.com>
2025-01-28 22:34:24 +08:00
Roee Toledano
812e654c85
Update BPF arch (#2568) 2024-12-15 20:46:45 +08:00
@Antelox
6ad2608dcb
Python package building rework (#2538)
* - Refactored setup.py to remove hacks regarding packaging of wheels for different platforms, improve and cleanup the code
- Updated README.txt
- Removed old Makefile and build_wheel.sh scripts
- Created a new workflow that takes care of building and testing python packages for different platforms/architectures/python versions

* Added SPDX headers to the setup.py

* - cstest_py: Fixed positional argument since it doesn't accept a `required` flag. It turns to have a mandatory tests folder path
- integration_tests.py: Use pathlib to determine the required path
- GitHub action: Simplified the tests execution command

* GitHub Actions: Run python 3.8 (lowest) and 3.13 (current highest) for native runners only during testings and the rest during tag release

* GitHub Action:
- Fixed the cibw_build matrix element
- Added a step to prepare artifact name

* GitHub Action: Added run_tests.py script to run all tests during CI workflow

* - Added SPDX headers to the run_tests.py script and to the build-wheels-publish.yml workflow file
- Minor fixes to the workflow as pointed out in the PR review
- Updated MANIFEST.in to reflect the actual libraries built during python wheel creation process
- Use subprocess.run in place of os.system in run_tests.py script

* GitHub Action:
- Run qemu step only if non-native Linux runner
- Added arch:universal2 matrix element for macos-latest runner

* Python bindings: Refreshed the list of files needed to be copied for sdist archive

* GitHub Action: Commented out arch:x86 matrix elements

* GitHub Action: Run qemu step only if non-native Linux runner

* GitHub Action: Minor fixes

* Python bindings: Added missing .in pattern when collecting src files for sdist archive
2024-11-18 19:10:27 +08:00
Rot127
09f35961cb
This time actually fix big endian issue. (#2530) 2024-10-29 12:02:37 +08:00
Rot127
1014864d3f
Rename CS_OPT_NO_BRANCH_OFFSET and corresponding flag to better name. (#2482) 2024-09-25 15:33:45 +08:00
Rot127
823bfd53e3
AArch64 issues (#2473)
* Fix Pn was printed as register, not predicate.

* Fix: is_alias must be an int to allow for -1 as false.

* Fix, shift immediate was casted to incorrect width.

* Store theexact float also in fp field for convenience.

* Fix: MRS has no implicit write of NCVZ

* Fix signs of Imm8 shifted operands.

* Fix another MRS test

* Fix: Src operand of CASAL had write flag set.

* Fix sysop access in Python data structures.
2024-09-24 12:32:10 +08:00
Rot127
af1ed2fb3d
SystemZ Auto-Sync refactor (#2462) 2024-09-14 16:57:54 +08:00
Giovanni
6a7fef60ea
Auto-Sync Mips (#2410) 2024-09-07 22:30:47 +08:00
Rot127
191db14531
Modern Testing (#2456) 2024-08-31 21:33:38 +08:00