Commit graph

9 commits

Author SHA1 Message Date
مصطفي محمود كمال الدين
032f79993d
RISC-V: Add v5 compatibility behaviour for CS_MODE_RISCVC/RISCV_C (#2996)
Co-authored-by: Rot127 <45763064+Rot127@users.noreply.github.com>
2026-07-18 16:58:01 +00:00
مصطفي محمود كمال الدين
676893c1a8
RISC-V: add reg_access and test its usages in C and Python (#2895)
* RISC-V: add reg_access and test its usages in C and Python

reg_access is a convenience wrapper over the `operands` array that filters the register operands (including those used as memory base address) and returns them sorted into read
and written registers. It wasn't implemented for RISC-V, this PR implements it.

The following decisions were made for RISC-V:
1- System registers (CSRs) are not registers

This follows existing Capstone convention, where almost every archiceture that have system registers except x86 treats them as a seperate address space.

From a purely practical POV, the reg_access function API returns registers as an array of integers, and the address space of normal registers intersects with that of system registers
so there is nothing in the return value to distinguish them.

2- PC is not an implicit register

Whenever an instruction reads PC (e.g. all call-ish instructions JAL[R]?) this is NOT counted as an implicit read of the PC.

The reason is that the PC is somewhat "second class" in RISC-V, it's an archiectural register but has no actual index and can never be directly written to by any instruction in any
standard extension no matter the privliege.

Meanwhile, all instruction that read the PC have names that make it obvious they read the PC so adding that information to the implicit reads array would be redundant.
2026-04-17 17:40:16 +00:00
مصطفي محمود كمال الدين
1084d365b9
Fix sysreg registers in RISC-V and modify the header patcher to not crash if a header doesn't include all tags of a generated .inc file (#2894)
* fix sysreg registers in RISC-V and modify the header patcher to not crash if a header doesn't include all tags of a generated .inc file

* add tests
2026-04-15 09:25:46 +00:00
@Antelox
e1c899a15a
Python binding: (#2874)
- Remove xprint dependency from tests
2026-03-02 19:11:38 +00: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
peace-maker
89aee40003
Add arm64 and sysz compatibility layer to Python bindings (#2559)
* Add arm64.py and sysz_const.py compatibility layer to the Python bindings

When importing `capstone.arm64` before doing other capstone imports the ARM64 constants get monkey patched into the exports.
Same with `capstone.sysz_const` for the SYSZ constants.

* Add SPDX-License comments

* Access an instruction detail in compatibility test

* Fail python tests on error instead of just ERROR output

Include the test_iter.py in the test_all.py too.

* Improve python compatibility docs

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

* Test for ARM_CC_* constants presence

---------

Co-authored-by: Rot127 <45763064+Rot127@users.noreply.github.com>
2024-12-05 19:35:18 +08:00
Rot127
af1ed2fb3d
SystemZ Auto-Sync refactor (#2462) 2024-09-14 16:57:54 +08:00
Rot127
191db14531
Modern Testing (#2456) 2024-08-31 21:33:38 +08:00
Kevin Phoenix
add1659f32 Move python tests to test directory 2024-07-15 12:14:03 -07:00