276 Commits

Author SHA1 Message Date
Rot127
926cfebd6b Architecture updater (auto-sync) - Updating PPC (#2013) 2023-09-05 12:24:59 +08:00
peace-maker
0134df14c4 Fix running cstest in CI (#2126)
* Fail CI if a command fails

* Apply cs_options in MC tests

* Emit a space if the alias has one at position I.

* Fix pop instruction tests.

* Update reglist patch and fix it again in ARMGenCSMappingInsnOps.inc

* Fix VSCCLRM* patch and write attributes.

* Emit new system operand formatting in tests

* Set new syntax in issues.cs

* Fix correct setting of neon lane

* Fix cstest arm SYSM operand type output

* Add implicit reads and writes of SP to POP and PUSH.

* Fix issue tests with new syntax and group names.

---------

Co-authored-by: Rot127 <unisono@quyllur.org>
2023-08-06 18:28:52 +08:00
peace-maker
4a7a55f62a Fix ARM Python bindings (#2127) 2023-07-29 08:34:17 +08:00
Peace-Maker
a4699018fb Add Python bindings for SH 2023-07-24 05:44:48 +02:00
Rot127
b435499c2b Add Werror to compile options. (#2114) 2023-07-23 23:18:33 +08:00
Rot127
6511ca8b1f Use OS independent printf formatting. 2023-07-22 04:19:22 -05:00
Rot127
104f693c11 Architecture updater (auto-sync) - Updating ARM (#1949)
* Add auto-sync updater.

* Update Capstone core with auto-sync changes.

* Update ARM via auto-sync.

* Make changes to arch modules which are introduced by auto-sync.

* Update tests for ARM.

* Fix build warnings for make

* Remove meson.build

* Print shift amount in decimal

* Patch non LLVM register alias.

* Change type of immediate operand to unsiged (due to: #771)

* Replace all occurances of a register with its alias.

* Fix printing of signed imms

* Print rotate amount in decimal

* CHange imm type to int64_t to match LLVM imm type.

* Fix search for register names, by completing string first.

* Print ModImm operands always in decimal

* Use number format of previous capstone version.

* Correct implicit writes and update_flags according to SBit.

* Add missing test for RegImmShift

* Reverse incorrect comparision.

* Set shift information for move instructions.

* Set mem access for all memory operands

* Set subtracted flag if offset is negative.

* Add flag for post-index memory operands.

* Add detail op for BX_RET and MOVPCLR

* Use instruction post_index operand.

* Add VPOP and VPUSH as unique CS IDs.

* Add shifting info for MOVsr.

* Add TODOs.

* Add in LLVM hardcoded operands to detail.

* Move detail editing from InstPrinter to Mapping

* Formatting

* Add removed check.

* Add writeback register and constraints to RFEI instructions.

* Translate shift immediate

* Print negative immediates

* Remove duplicate invalid entry

* Add CS groups to instructions

* Fix write attriutes of stores.

* Add missing names of added instructions

* Fix LLVM bug

* Add more post_index flags

* http -> https

* Make generated functions static

* Remove tab prefix for alias instructions.

* Set ValidateMCOperand to NULL.

* Fix AddrMode3Operand operands

* Allow getting system and banked register name via API

* Add writeback to STC/LDC instructions.

* Fix (hopefully) last case where disp is negative and subtracted = true

* Remove accidentially introduced regressions
2023-07-19 17:56:27 +08:00
Anton Kochkov
be5a26c754 [SuperH]: fix IMM format specifier in test (#2080) 2023-07-19 00:03:30 +08:00
Mario Haustein
452d47bb84 Fix TriCore test 2023-06-17 22:33:54 +02:00
billow
6fc9643161 Add .clang-format and format 2023-05-30 11:09:37 +08:00
billow
9bb4f81961 Fix compile warnings under CMake -Wall 2023-05-30 11:08:32 +08:00
billow
114f1ad867 Upper all inc and fix 2023-05-01 22:52:47 +08:00
billow
2785d31399 Format all .(c|h) code 2023-04-20 21:55:37 +08:00
billow
c264240e48 fix tricore endian 2023-04-17 10:04:06 +08:00
billow
48f0317c73 feat: Refactor and improve triCore platform support 2023-04-14 00:35:47 +08:00
billow
33080bb326 update TriCore*.inc 2023-04-14 00:34:51 +08:00
billow
d1021f4a6b Fix build and test 2023-04-14 00:34:28 +08:00
Sidney Pontes Filho
81b1df7f91 Transfer modifications of TriDis/llvm-tricore on Feb, 04 2017 2023-04-14 00:34:25 +08:00
Sidney Pontes Filho
8ea8d69cc5 Fix TriCore Mapping 2023-04-14 00:34:23 +08:00
Sidney Pontes Filho
72cdfdab80 Adjustments in TriCore and add more instructions into tests/test_tricore.c 2023-04-14 00:34:22 +08:00
Sidney Pontes Filho
651aa5a1f1 Fix memory access printing and clean unused functions 2023-04-14 00:34:21 +08:00
Sidney Pontes Filho
4aace70036 Transfer modifications of TriDis/llvm-tricore on Oct 05, 2016 2023-04-14 00:34:20 +08:00
Sidney Pontes Filho
f855c92b46 Adjust printing of Registers and upgrade TriCore test 2023-04-14 00:34:18 +08:00
Sidney Pontes Filho
edbd73409c Remove all compiler warnings 2023-04-14 00:34:17 +08:00
Sidney Pontes Filho
dd4011297b Fix all compiler errors 2023-04-14 00:34:16 +08:00
Sidney Pontes Filho
f5687523e3 Modify Makefiles for TriCore architecture 2023-04-14 00:34:08 +08:00
Rot127
854153e7c9 [SH] Fix several unused variable warnings. 2023-03-06 21:35:22 -05:00
Wu ChenXu
fe63ddb108 Merge pull request #1927 from ysat0/superh 2023-01-27 14:58:24 +08:00
ζeh Matt
07dc1f2566 Add instructions with pre and post index to test_arm64 2022-11-22 22:10:31 +02:00
Yoshinori Sato
342a39a206 sh: testcase
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
2022-10-12 20:11:19 +09:00
Richard Patel
fa58bc1d62 Add PPC paired-singles ext 2022-07-23 08:50:26 +02:00
Carlo Marcelo Arenas Belón
ed7fb42d96 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
204d13a09e add CI Test support 2021-11-19 13:37:09 +08:00
Jesús A. Álvarez
06662e0d52 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
78762186d1 tests: fix typo in test_detail.c 2019-08-15 15:28:15 +08:00
Vemake
b78a640364 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
41e5f629ce 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
a893e37c9c tests: 2019 2019-05-30 20:49:10 +08:00
Nguyen Anh Quynh
e142a11566 cleanup tests/test_m680x.c 2019-04-29 18:04:15 +08:00
Nguyen Anh Quynh
4754471262 merge next-arm64 to next 2019-04-10 17:46:07 +08:00
Nguyen Anh Quynh
f407e94249 arm64: sync with LLVM 7.0.1 2019-04-10 14:17:08 +08:00
Wolfgang Schwotzer
23b3fba966 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
ed96912a46 cleanup tests/ 2019-03-09 08:51:30 +08:00
z
b8fcf27b22 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
31d0de4552 [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
6ba9f001b9 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
a28027bbe1 wasm: fix misordering (#1391) 2019-02-19 00:10:36 +08:00
david942j
9b3ead3ab8 fix conflicts 2019-02-18 20:04:30 +08:00
david942j
b227acc29c 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
7635e7f9ff 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