Commit graph

272 commits

Author SHA1 Message Date
Rot127
6ac231ff04
Add CS_aarch64 macro without parameter. (#2219) 2023-12-18 08:36:54 +08:00
Rot127
ee75e4b9a4
[v5] Add meta-programming macros for ARM64/AArch64 name change to capstone.h (#2199)
* Add meta-programming macros for ARM64/AArch64 name change to capstone.h

* Add tests for rename macros. (#2202)
2023-11-24 11:57:23 +08:00
Wu ChenXu
53eaeac809
Cherry-pick from next for v5.0.1 (#2141)
* Add Python bindings for WASM

* Update Python bindings for m68k

* Update Python bindings for mos65xx

* Update Python bindings for x86

* Add Python bindings for SH

* Update CS_* constants in Python bindings

* Update constants from ARM auto-sync patch

* Fixing TriCore disasm instructions (#2088)

* allow absolute CMAKE_INSTALL_*DIR (#2134)

This patch fixes Capstone 5 build on NixOS.

NixOS's build infrastructure sets CMAKE_INSTALL_{LIB,INCLUDE}DIR to
absolute paths. If you append it to ${prefix}, you get the wrong path.
NixOS automatically detects it and links this issue:
https://github.com/NixOS/nixpkgs/issues/144170

---------

Co-authored-by: Peace-Maker <peace-maker@wcfan.de>
Co-authored-by: Bastian Koppelmann <bkoppelmann@users.noreply.github.com>
Co-authored-by: chayleaf <chayleaf@protonmail.com>
2023-08-21 13:34:18 +08:00
Anton Kochkov
542e5d8e02 [SuperH]: fix IMM format specifier in test (#2080) 2023-07-19 01:04:36 +08:00
Mario Haustein
ba4df3acee
Fix TriCore test 2023-06-17 22:33:54 +02:00
billow
9d6c489c57
Add .clang-format and format 2023-05-30 11:09:37 +08:00
billow
f40f097444
Fix compile warnings under CMake -Wall 2023-05-30 11:08:32 +08:00
billow
985b6fcb07
Upper all inc and fix 2023-05-01 22:52:47 +08:00
billow
58bce36a55
Format all .(c|h) code 2023-04-20 21:55:37 +08:00
billow
d9f13fe772
fix tricore endian 2023-04-17 10:04:06 +08:00
billow
98c1a24aad
feat: Refactor and improve triCore platform support 2023-04-14 00:35:47 +08:00
billow
abf826a2a4
update TriCore*.inc 2023-04-14 00:34:51 +08:00
billow
c6138aca25
Fix build and test 2023-04-14 00:34:28 +08:00
Sidney Pontes Filho
dfd368f691
Transfer modifications of TriDis/llvm-tricore on Feb, 04 2017 2023-04-14 00:34:25 +08:00
Sidney Pontes Filho
83980f66f9
Fix TriCore Mapping 2023-04-14 00:34:23 +08:00
Sidney Pontes Filho
1a5d594a4e
Adjustments in TriCore and add more instructions into tests/test_tricore.c 2023-04-14 00:34:22 +08:00
Sidney Pontes Filho
6fdc21bfab
Fix memory access printing and clean unused functions 2023-04-14 00:34:21 +08:00
Sidney Pontes Filho
87f935dae7
Transfer modifications of TriDis/llvm-tricore on Oct 05, 2016 2023-04-14 00:34:20 +08:00
Sidney Pontes Filho
d026a802a5
Adjust printing of Registers and upgrade TriCore test 2023-04-14 00:34:18 +08:00
Sidney Pontes Filho
82fcf25a5c
Remove all compiler warnings 2023-04-14 00:34:17 +08:00
Sidney Pontes Filho
c1c16347b3
Fix all compiler errors 2023-04-14 00:34:16 +08:00
Sidney Pontes Filho
6374a774d4
Modify Makefiles for TriCore architecture 2023-04-14 00:34:08 +08:00
Rot127
2e15189632
[SH] Fix several unused variable warnings. 2023-03-06 21:35:22 -05:00
Wu ChenXu
6eb1db9c04
Merge pull request #1927 from ysat0/superh 2023-01-27 14:58:24 +08:00
ζeh Matt
f6bfc9fbe4
Add instructions with pre and post index to test_arm64 2022-11-22 22:10:31 +02:00
Yoshinori Sato
fb25d7fcbf sh: testcase
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
2022-10-12 20:11:19 +09:00
Richard Patel
1a2dad1fae Add PPC paired-singles ext 2022-07-23 08:50:26 +02:00
Carlo Marcelo Arenas Belón
80287ac96b test_customized_mnem: avoid abort() if x86 not supported
if the library is built without X86, then cs_open() should fail
but that shouldn't be treated as an error, so return instead after
checking.
2022-01-08 00:25:26 -08:00
kabeor
43b0a34a3f add CI Test support 2021-11-19 13:37:09 +08:00
Jesús A. Álvarez
baa1f94cfd
mos65xx: use address on mem operands for relative addressing (#1702)
* mos65xx: use imm field for immediate operand value

using the wrong field works on little-endian hosts, but on big-endian the wrong value would be read

* mos65xx: set operand mem field to address also in relative modes

previously the last operand would have an offset, which doesn't match the printed operand

* mos65xx: add bpl instruction to test

this demonstrates an address operand with relative addressing
2021-03-10 08:21:31 +08:00
naq
5f200f7bae tests: fix typo in test_detail.c 2019-08-15 15:28:15 +08:00
Vemake
eb357143a2 Fixed 47 missing dependencies and 51 excessive dependencies in Makefile (#1522)
* Fix Excessive and Missing Dependencies found by Vemake

* Remove extra spaces at the end of Makefile

* Remove used macro df

* Change "-rf" to "-f" in tests/Makefile

* Change "-rf" to "-f" in suite/fuzz/Makefile

* Remove 'r' from the removal command.

* Remove an extra blank line.
2019-07-29 14:15:05 +08:00
ksherlock
05b3fbf2d7 updated 6502 support. (#1498)
* updated 6502 support. some improvements to the base 6502 support but also adds support for 65c02, w65c02, and 65816.

* add CS_OPT_SYNTAX_MOTOROLA.

This will use "$" as a hex prefix instead of "0x"

* remove excess blank lines
2019-06-03 23:20:51 +08:00
Nguyen Anh Quynh
19e088393f tests: 2019 2019-05-30 20:49:10 +08:00
Nguyen Anh Quynh
0efbe867e7 cleanup tests/test_m680x.c 2019-04-29 18:04:15 +08:00
Nguyen Anh Quynh
25b6704978 merge next-arm64 to next 2019-04-10 17:46:07 +08:00
Nguyen Anh Quynh
9d292268a9 arm64: sync with LLVM 7.0.1 2019-04-10 14:17:08 +08:00
Wolfgang Schwotzer
5607c03df9 M680X: Use same output style as other archs (#1439)
- Lowercase hex numbers.
- Use comma + space between instruction parameters.
2019-03-22 11:07:15 +08:00
Nguyen Anh Quynh
de1f713500 cleanup tests/ 2019-03-09 08:51:30 +08:00
z
a012f75754 RISCV support ISRV32/ISRV64 (#1401)
* Added RISCV dir to contain the RISCV architecture engine code. Adding the TableGen files generated from llvm-tblgen. Add Disassembler.h

* Started working on RISCVDisassembler.c - RISCV_init(), RISCVDisassembler_getInstruction, and RISCV_getInstruction

* Added all functions to RISCVDisassembler.c and needed modifications to RISCVGenDisassemblerTables.inc. Add and modified RISCVGenSubtargetInfo.inc. Start creation of RISCVInstPrinter.h

* Finished RISCVGenAsmWriter.inc. Finished RISCVGenRegisterInfo.inc. Minor fixes to RISCVDisassembler.c. Working on RISCVInstPrinter

* Finished RISCVInstPrinter, RISCVMapping, RISCVBaseInfo, RISCVGenInstrInfo.inc, RISCVModule.c. Working on riscv.h

* Backport it from: 0db412ce3b

* All RISCV files added. Compiled correctly and initial test for ADD, ADDI, AND works properly.

* Add refactored cs.c for RISCV

* Testing all I instructions in test_riscv.c

* Modify the orignal backport for RISCVGenRegisterInfo.inc, capstone.h and test_iter to work w/ the current code strcuture

* Fix issue with RISCVGenRegisterInfo.inc - RISCVRegDesc[] (Excess elements in struct initializer). Added RISCV tests to test_iter.c

* fixed bug related to incorrect initialization of memory after malloc

* fix compile bug

* Fix compile errors.

* move riscv.h to include/capstone

* fix indentation issues

* fix coding style issues

* Fix indentation issues

* fix coding style

* Move variable declaration to the top of the block

* Fix coding indentation

* Move some stuff into RISCVMappingInsn.inc

* Fix code sytle

* remove cs_mode support for RISCV

* update asmwriter-inc to LLVM upstream

* update the .inc files to riscv upstream

* update riscv disassembler function for suport 16bit instructions

* update printer & tablegen inc files which have fixed arguments mismatch

* update headers and mapping source

* add riscv architecture specific test code

* fix all RISCV tons of compiler errors

* pass final tests

* add riscv tablegen patchs

* merge with upstream/next

* fix cstool missing riscv file

* fix root Makefile

* add new TableGen patchs for riscv

* fix cmakefile.txt of missing one riscv file

* fix declaration conflict

* fix incompatible declaration type

* change riscvc from arch to mode

* fix test_riscv warnning

* fix code style and add riscv part of test_basic

* add RISCV64 mode

* add suite for riscv

* crack fuzz test

* fix getfeaturebits test add riscvc

* fix test missing const qualifier warnning

* fix testcase type mismatch

* fix return value missing

* change getfeaturebits test

* add test cs files

* using a winder type contain the decode string

* fix a copy typo

* remove useless mode for riscv

* change cs file blank type

* add repo for update_riscv & fix cstool missing riscv mode

* fix typo

* add riscv for cstool useage

* add TableGen patch for riscv asmwriter

* clean ctags file

* remove black comment line

* fix fuzz related something

* fix missing RISCV string of fuzz

* update readme, etc..

* add riscv *.s.cs file

* add riscv *.s.cs file & clear ctags

* clear useless array declarations at capstone_test

* update to 5e4069f

* update readme change name more formal

* change position of riscv after bpf and modify copyright more uniform

* clear useless ctags file

* change blank with tab in riscv.h

* add riscv python bindings

* add riscv in __init__.py

* fix riscv define value for python binding

* fix test_riscv.py typo

* add missing riscvc in __init__.py of python bindings

* fix alias-insn printer bug, remove useless newline

* change inst print delimter from tab to bankspace for travis

* add riscv tablegen patch

* fix inst output more consistency

* add TableGen patch which fix inst output formal

* crack the effective address output for detail and change register print function

* fix not detail crash bug

* change item declaration position at cs_riscv

* update riscv.py

* change function name more meaningfull

* update python binding makefile

* fix register enum sequence according to riscvgenreginfo.inc

* test function name

* add enum s0/fp in riscv.h & update riscv_const.py

* add register name enum
2019-03-09 08:41:12 +08:00
Travis Finkenauer
8ce800c06f [M68K] store correct register value in op.reg_pair (#1411)
* m68k: store correct m68k_reg value in op.reg_pair

Originally, value - M68K_REG_D0 was stored and the print logic added
M68K_REG_D0.

* m68k: fix license typo
2019-03-02 17:40:29 +08:00
Sebastian Macke
fa4353d7db MOS65XX: Fix instruction length for indirect addressing modes (#1402)
Signed-off-by: Sebastian Macke <sebastian@macke.de>
2019-02-28 07:39:59 +08:00
david942j
e3fcd94371 wasm: fix misordering (#1391) 2019-02-19 00:10:36 +08:00
david942j
29e9b61ae2 fix conflicts 2019-02-18 20:04:30 +08:00
david942j
cac94ccee5 New architecture: BPF (#1388)
* Basic changes of new arch - BPF

* Define some constants

* defined some API methods

* Able to print MISC instruction

* Follow Linux coding style

* Ability to show ALU insn names

* decode return

* Add suite/MC/BPF

* decode jump

* decode store

* decode load

* print instruction done

* try to implement BPF_reg_access

* Implements explicit accessed registers and fix some tiny bugs

* Fix unhandled ja case

* Added BPF_REG_OFF do fix wrong display in jump class

* Great I'm able to decode cBPF with eyes

* Fix: misunderstood the 16-byte instruction's imm

* Add ldxdw

* Add extended-all.cs

* Implements cstest/bpf_getdetail.c

* Fix memory leak

* Add BPF to fuzz

* Implemented regs_read and regs_write

* Fix missing write-access on ALU's dst

* Updated cstool/, test_basic.c, test_detail.c, and test_iter.c

* Updated docs

* Fix type of cs_bpf#operands

* Implements python bindings

* Fix some bugs found by self code review

* Remove dummy tests

* remove typeof

* Address comments

* Fix MSVC's warnings and add test_bpf.py to bindings/python/Makefile

* Fix: call is not offset
2019-02-18 17:39:51 +08:00
Scott Knight
66a2efb7da Print EFLAGS and FPU_FLAGS correctly in test_x86 (#1365)
* Print EFLAGS and FPU_FLAGS correctly in test_x86

Since the eflags and fpu_flags are union the instruction group needs
to be checked for FPU to see if the flag is an FPU flag. cstool_x86
was already doing this but test_x86 was not. The result was the fadd
instruction from the x86  16bit test was showing in the test_x86
output as having eflags. Since fadd is an fpu instruction the FPU_FLAGS
should be shown instead.

* Remove extra newline in instruction output

All of the other test_<arch>.c functions print a single newline after
the dissassembly. x86 had two newlines. This makes test_x86
consistent with all the other test output.
2019-02-05 09:44:06 +08:00
Scott Knight
c84b95b4b2 Fix CAPSTONE_HAS_PPC flags (#1361)
The actual conditional PPC flag used is CAPSTONE_HAS_POWERPC. It
appears as if some of the test suite files was using the incorrect flag. Because
of this test_basic, test_detail and test_iter were all failing to output PPC
code in the default configuration.
2019-02-03 09:34:59 +08:00
Nguyen Anh Quynh
dbd1d46287 wasm: cs_arch_init[] setup WASM in the wrong slot 2019-02-02 23:27:54 +08:00
Nguyen Anh Quynh
0171e6be4a wasm: silence some compilation warnings 2019-02-02 00:13:52 +08:00
Spike
4ae8645b43 Add webassembly arch (#1359)
* add wasm arch

* fix bug

* delete todo & add wasm into readme
2019-02-01 23:03:47 +08:00