Commit Graph

5194 Commits

Author SHA1 Message Date
Rot127
6c7b54817f
Add a clang-tidy checks and warnings (#2312) 2024-04-26 15:11:46 +08:00
Shuyi Cheng
c4d0993071
Add eBPF bswap16/32/64 instruction (#2323) 2024-04-23 22:04:37 +08:00
Ced2911
e9284b6b36
check if decode[idx] is callable (#2322) 2024-04-23 21:58:40 +08:00
Florian Märkl
bf05d695dd
Fix cstool Makefile for non-C99-defaulting compilers (#2315) 2024-04-23 21:57:39 +08:00
careworry
16017d5f92
chore: remove repetitive words (#2326)
Signed-off-by: careworry <worrycare@outlook.com>

chore: remove repetitive words
2024-04-22 11:57:11 +08:00
Rot127
7746648f0b
[Auto-Sync] LLVM 18 update (#2296)
Refactor auto-sync updater

This refactors the auto-sync updater scripts, adds multiple tests and some other smaller things:

- Converts the updater in a proper Python package.
- Renaming was done to fit this new package structure.
- Format code with usort and black and enforce it with the CI.
- Add license information to auto-sync scripts.
- Update tree-sitter-cpp to v20.0.5
- Fix py-tree-sitter version to `< 0.22.0` due to https://github.com/tree-sitter/tree-sitter-cpp/issues/250
- Allow file/dir creation of non existing paths.
- Add CI tests for Patch, inc gen, translation and diff persistence testing.
- Implement editing of diffs with an editor.
- Fix: Add Namespace id also to anonymous enumeration members.
2024-04-22 11:55:44 +08:00
Rot127
24d99a907b
Weaken requirements to document functions. (#2324) 2024-04-18 23:51:49 +08:00
R3v0LT
a5cf15e556
HPPA dissassembler fix unitialized variables errors (#2309) 2024-04-10 13:49:43 +08:00
R3v0LT
cda40c6537
Fix invalid comparison with HPPA_OP_INVALID (#2300) 2024-03-29 16:46:00 +08:00
R3v0LT
9daa1ffbac
Add HPPA(PA-RISC) architecture (#2265)
* Refactor HPPA

* Add full HPPA 1.1 instructions support

* Add HPPA 1.1 cs tests

* Fix HPPA dissassembler

* Add HPPA 2.0 instructions

* Add HPPA tests

* Fix HPPA disasm & printer

* Update HPPA tests

* Remove unused code

* Add implicit register access info & Refactor HPPA main files

* Add python bindings/tests and cstests

* Fix HPPA disasm wrong decoding

* Rewrite invalid test cases

* Update HPPA python constants

* Make HPPA python test executable

* Change HPPA python tests sequence to match c tests

* Refactor HPPA main files

* Write target instead of offset in details

* Add HPPA detail function support in cstest

* Rewrite targets in branch tests

* Make correct string modifier addition

* Add hppa test calls

* Add zero operands check

* Remove MCOperand array

* Change immediate values printing

* Add HPPA 2.0 wide support

* Fix invalid break instruction decode

Remove unused code

* Add HPPA to fuzzing tests

* Add HPPA to options

* Add HPPA to docs

* Refactor HPPA

* Fix invalid branch insn decoding

* Add HPPA to labeler

* clang-format hppa files

* Document internal structures and minor refactoring

* Add missing default statements

* Fix invalid default statement
2024-03-26 13:58:56 +08:00
James Kang
0d12bcacd7
Remove repetitive words (#2297) 2024-03-23 19:42:19 +08:00
Yudi Zheng
5d9942d13f
Avoid random access values for operands in not-yet-specified instructions. (#2259) 2024-03-21 13:33:30 +08:00
Wu ChenXu
989dca2a28
Add telegram group link to README.md 2024-03-20 19:20:40 +08:00
Rot127
3ef564bcf4
Add issue and PR templates (#2294)
* Add PR template.

* Add issue templates.
2024-03-20 16:57:52 +08:00
Rot127
b4fde983de
[PPC] Expose instruction formats (#2276)
* Expose PPC formats in PPC details

* Add PPC format note in v6 release guide.

* Update python bindings
2024-02-23 13:20:46 +08:00
Rot127
122348ba47
[CMake] Architecture definition fix (#2272)
* Enble all archs only if CAPSTONE_USE_ARCH_REGISTRATION=false

* Add a test if cstool reaches each disassembler engine.

* Move cstool test to sh file.
2024-02-23 13:20:00 +08:00
Sevan Janiyan
1c238b6491
Makefile: Improve Apple detection (#2263)
* Makefile: Improve Apple detection

__APPLE__ is always defined & set to 1 on Darwin.

* HACK.TXT: wording
2024-02-23 13:18:53 +08:00
Rot127
215eae8e54
Fix incorrect alignment of labels. (#2277) 2024-02-22 11:01:05 +08:00
Rot127
34a1e012b7
Fix OOB read and wries (#2273)
* Fix OOB read due to wrong macro in use.

* Fix OOB write for regs_write and replace hardcoded values.
2024-02-18 13:03:05 +08:00
Rot127
336171c333
Fix #2233 (#2267) 2024-02-15 15:53:45 +08:00
Xeonacid
d63211e3ac
Drop distutils in python binding (#2271) 2024-02-15 15:53:25 +08:00
Rot127
330d81d5d0
Make helper functions static to prevent multiple defintions. (#2266) 2024-02-15 15:51:46 +08:00
Wu ChenXu
6a55ef3bda
Fix: cibuildwheel broken on windows build
Ref: https://github.com/pypa/cibuildwheel/issues/1748
2024-02-11 22:49:14 +08:00
Khairul Azhar Kasmiran
cb2b87974d
auto-sync BitCastStdArray.py: Transform to union instead (#2257)
* auto-sync BitCastStdArray.py: Transform to `union` instead

* Do `typeof` manually for MSVC
2024-01-24 11:08:25 +08:00
Ole André Vadla Ravnås
eaf6d7ab67
Fix compilation with CAPSTONE_X86_REDUCE (#2256)
Fixes #1955.
2024-01-24 11:07:03 +08:00
Ole André Vadla Ravnås
31ea133e64
Fix regressions in custom memory allocator support (#2251)
Where new code started using malloc()/calloc()/free() directly instead
of going through cs_mem_*().
2024-01-20 23:50:19 +08:00
Ole André Vadla Ravnås
28d0b20ffe
Fix crash on x86 when building with MSVC (#2253)
There is a compiler bug in latest MSVC, which at the time of writing is
19.36.32535: given `switch (x)`, where `x` is 64 bits wide, the compiler
generates code that computes an incorrect jump table index. E.g. if
`x` is zero, it ends up reading the table entry at index -1.
2024-01-20 23:46:58 +08:00
Ole André Vadla Ravnås
aaf6a53224
cstool: Fix ppc_br_hint comparison (#2254) 2024-01-20 23:44:05 +08:00
Khairul Azhar Kasmiran
61273ff88b
auto-sync: Fix some tree-sitter queries (#2255) 2024-01-20 23:43:06 +08:00
Ole André Vadla Ravnås
009ead2257
Add support for architecture registration (#2252)
To support building a static Capstone with many supported architectures
and only paying for the ones needed in each consumer. In this way they
won't have to build multiple copies of Capstone to minimize footprint.
2024-01-20 21:48:05 +08:00
Ole André Vadla Ravnås
fe35325538
Fix MSVC warning overrides when using non-MSVC toolchains (#2250)
The checks should detect MSVC instead of the OS type.
2024-01-20 21:45:21 +08:00
Ole André Vadla Ravnås
69d224167f
Fix warnings when building with CAPSTONE_DIET (#2249) 2024-01-20 21:28:32 +08:00
Ole André Vadla Ravnås
c8c80091f2
Fix compilation with DIET + X86_REDUCE (#2248) 2024-01-20 21:27:46 +08:00
Richard Henderson
25a69b55e3
Constify Alpha and TriCore (#2245) 2024-01-18 09:45:40 +08:00
Rot127
362857c163
Fix label assignment for LLVM generated files. (#2243) 2024-01-18 09:44:52 +08:00
Khairul Azhar Kasmiran
7653b69e54
Remove comment stating support for multiple clang-format versions (#2242) 2024-01-18 09:44:19 +08:00
Rot127
77710a8100
Fix #2234. (#2236)
- BL, BLR don't read SP.
- Add branch flags.
2024-01-14 13:28:11 +08:00
Khairul Azhar Kasmiran
f6ab2ab915
Use union in AArch64_AM_isSVEMaskOfIdenticalElements type punning fix (#2238) 2024-01-13 13:18:24 +08:00
Rick Mark
a554a1dfb8
By default compile as universal2 for macOS (#2221) 2024-01-12 10:05:45 +08:00
Anton Kochkov
b3c2ed1398
Add autolabeler GitHub Action (#2239) 2024-01-12 10:04:20 +08:00
Rot127
0d0edad81d
Update docs wit ASUpdater.py script (#2217) 2024-01-07 22:07:46 +09:00
Anton Kochkov
15d9337c64
Raise minimum requirement to VS2017 (#2228) 2024-01-07 19:10:59 +08:00
Khairul Azhar Kasmiran
71ab7cdd72
Fix type punning in AArch64_AM_isSVEMaskOfIdenticalElements (#2237) 2024-01-07 19:03:07 +08:00
Yasumasa Suenaga
b9c260e917
LIBDIRARCH does not propagate to Makefile (#2214) 2024-01-03 17:30:49 +09:00
Koby Kahane
0cd3f2cee9
Fix typos in COMPILE_CMAKE.TXT. (#2229) 2024-01-03 17:21:34 +09:00
R3v0LT
a21f7ce310
add Alpha big-endian (#2227) 2024-01-02 13:02:38 +09:00
Rick Mark
a128f31d20
Ignore JetBrains based IDE data for clean PRs (#2224) 2023-12-29 01:10:57 +09:00
R3v0LT
89fec6e8fd
Add Alpha architecture (#2071) 2023-12-28 11:10:38 +09:00
Thomas Huth
e3a2b4c418
Fix broken disassembly of floating point immediates on big endian hosts (#2222)
Disassembling single floating points with immediate values currently
gives wrong results on big endian hosts (like s390x), e.g.:

 ./cstool/cstool m68k40 'f2 3c 44 22 40 49 0e 56'
  0  f2 3c 44 22 40 49 0e 56  fadd.s     #0.000000, fp0

While it should be (like on x86):

 ./cstool/cstool m68k40 'f2 3c 44 22 40 49 0e 56'
  0  f2 3c 44 22 40 49 0e 56  fadd.s     #3.141500, fp0

The problem is that these single float values are supposed to be stored
in the 32-bit "simm" field of struct cs_m68k_op (see e.g. the printing
of M68K_FPU_SIZE_SINGLE in printAddressingMode() in M68KInstPrinter.c),
but currently the immediate is only written to the 64-bit "imm" field
of the union in cs_m68k_op. This works on little endian systems, since
the least significant bytes overlap in the union there. For example,
let's assume that the value 0x01020304 gets written to "imm":

 04 03 02 01 00 00 00 00    uint64_t imm
 xx xx xx xx xx xx xx xx    double dimm;
 xx xx xx xx .. .. .. ..    float simm;

But on big endian hosts, the important bytes do not overlap, so "simm"
is always zero there:

 00 00 00 00 01 02 03 04    uint64_t imm
 xx xx xx xx xx xx xx xx    double dimm;
 xx xx xx xx .. .. .. ..    float simm;

To fix the problem, let's always set "simm" explicitly, this works on
both, big endian and little endian hosts.

Thanks to Michal Schulz for his initial analysis of the problem
(in #1710) and to Travis Finkenauer for providing an easy example
to reproduce the issue (in #1931).

Closes: https://github.com/capstone-engine/capstone/issues/1710
2023-12-21 18:05:35 +08:00
Rot127
484c7e550b
Add CS_aarch64 macro without parameter. (#2218) 2023-12-18 08:36:37 +08:00