Commit Graph

4384 Commits

Author SHA1 Message Date
Anton Kochkov
6a8406aff6 M680X - remove unused s_cpu_type (#1695) 2020-10-29 12:29:49 +08:00
Keegan Saunders
dcd4869033 Option to generate install target (#1700)
Co-authored-by: meme <meme@users.noreply.github.com>
2020-10-28 23:34:48 +08:00
Tobias Faller
20e3ebd372 Added export for Python CS_MODE_RISCVC binding (#1691) 2020-09-18 22:34:35 +08:00
StalkR
c88a7b37ef MCInst: fix uninitialized value in operand value (#1685)
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14912

Same as https://github.com/aquynh/capstone/pull/1684 for next branch
2020-09-16 17:06:27 +08:00
Richard Henderson
e34cd5475b Two RISC-V fixes (#1682)
* RISCV: Check CS_MODE_RISCVC in getFeatureBits

Enable compressed instruction extension with RISCVC.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

* RISCV: Fix skipdata_size for CS_MODE_RISCVC

RISC-V compressed instructions are 2 bytes, not 1.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2020-09-16 17:04:18 +08:00
Carlo Marcelo Arenas Belón
74282e18a2 systemz: pad instruction width up to 6 bytes (#1679)
instructions could be 2, 4 or 6 bytes so pad accordingly as it
was done on the other CISC architecture.
2020-09-16 17:03:34 +08:00
Carlo Marcelo Arenas Belón
a39b6175e3 include: avoid UB with signed overflow/shift (#1675)
if integer is 32-bit, and numeric literals default to int type,
the following applies (from The C Standard, 6.5.7, paragraph 4
[ISO/IEC 9899:2011]):

If E1 has a signed type and nonnegative value, and E1 × 2^E2 is
representable in the result type, then that is the resulting value;
otherwise, the behavior is undefined.

which means that the only way to safely shift is unsigned, so
use 1U to indicate the shifted bit is unsigned.
2020-09-16 17:03:28 +08:00
junchao-loongson
da7ba93a13 fix CS_ mips_ OP structure comment error (#1674) 2020-08-06 09:37:19 +08:00
Sergei Trofimovich
6e89663fd6 capstone.pc.in: use CMAKE_INSTALL_LIBDIR for libdir (#1659)
On x86_64-linux gentoo system capstone was installing
it's files to 'lib64' libdir, but was referring 'lib' libdir:

```
$ cat /usr/lib64/pkgconfig/capstone.pc
...
libdir=${prefix}/lib
...
```

On radare2 built it means injecting -L/usr/lib into a 64-build
and pulling in 32-bit libraries. 'ld.lld' is not able to resolve
the ambiguity.

It happens because @LIBSUFFIX@ is not present in cmake-3.17.3.

Let's fix the paths by using @CMAKE_INSTALL_LIBDIR@.
This variable is already used in capstone's build system,
thus should be safe to rely on.

Reported-by: Agostino Sarubbo
Bug: https://bugs.gentoo.org/730722
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2020-07-19 17:08:47 +08:00
Maxim Poliakovski
46e4a405da M68K: fix MOVEC operand transfer direction. (#1663) 2020-07-19 17:06:08 +08:00
Mahesh Madhav
0473959db9 Change include path to fix error with embedded cmake builds (#1649)
Co-authored-by: Mahesh Madhav <mahesh@amperecomputing.com>
2020-06-25 09:22:47 +08:00
Daniel Collin
83d817339e Fixed incorrect read of 32-bit imm for bsr (#1644) 2020-06-12 23:00:47 +08:00
Matthias C. M. Troffaes
3814ea95ee Add cmake config and export targets. (#1637)
These additions simplify using capstone in cmake projects:

find_package(capstone CONFIG REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main PRIVATE capstone::capstone-static)
2020-06-02 20:58:33 +08:00
Nikita
db20180560 Allow to override PYTHON[23] in Makefiles (#1639)
$(PYTHON2) and/or $(PYTHON3) might differ from python and/or python3,
accordingly. Allow to override these variables by user choice.
2020-05-30 10:51:54 +08:00
Antonio Flores Montoya
78a897ee12 fix bug in displacement offset (#1600) 2020-05-11 02:20:13 +08:00
Eric Kilmer
c0d5f4e280 Add more cases for LD1 instruction immediate fixups (#1632) 2020-05-10 10:03:52 +08:00
el poto rico
b818c6bdd0 ARM64: Populate implicitly used/modified registers and map ARM64_GRP_CALL to BL* (#1610)
This commit adds some registers to the list of implicit used registers and
implicit modified registers for several AArch64 instructions.

This commit also maps the `ARM64_GRP_CALL` group to the BL* instruction family.
It should fix issue #1606.
2020-05-10 01:46:55 +08:00
Nguyen Anh Quynh
73bbf84432 arm64: some POST instructions miss IMM operand. this fixes issue #1627 2020-05-10 01:39:57 +08:00
Nguyen Anh Quynh
b471e50c74 x86: fix testcase of MOVSD 2020-05-07 21:51:54 +08:00
Disconnect3d
95f25c5325 Add __repr__ for capstone.CsInsn (#1625)
* Add __repr__ for capstone.CsInsn

Currently, a `print(instruction)` displays a not very useful string like `<capstone.CsInsn object at 0x7f3759d88128>`.

This PR enhances adds a `__repr__` magic method to the `capstone.CsInsn` class so it displays as follows:
```
<cs.CsInsn: address=0x5555555545fa, size=1, mnemonic=push, op_str=rbp>
```

* Update __init__.py
2020-05-05 01:54:28 +08:00
Summus
7ba43baec0 Fix Makefile CAPSTONE_BUILD_CORE_ONLY (#1617)
Co-authored-by: Romain Lesteven <romain.lesteven@armaturetech.com>
2020-05-05 01:12:21 +08:00
elp0t0r1c0
0e759ed68e Add ARM64_GRP_PAC group for Pointer Authentication (#1607)
* Add ARM64_GRP_PAC group for Pointer Authentication

* Lowercase the group's name
2020-03-30 08:37:11 +08:00
NancyLi1013
9a08235987 Add vcpkg installation instructions (#1602) 2020-03-24 16:29:17 +08:00
Nguyen Anh Quynh
cf59ad7de7 Merge branch 'next' of github.com:aquynh/capstone into next 2020-03-23 09:15:21 +08:00
Eric Schulte
d4670aa138 Add Common Lisp bindings (#1605) 2020-03-23 09:15:00 +08:00
Morten Kristensen
c63399df12 Fixed anon type in anon union error in m68k.h (#1597)
Apple Clang 11.0.0 error:
```
capstone/include/capstone/m68k.h:160:3: error: anonymous types declared in an anonymous union are an extension [-Werror,-Wnested-anon-types]
                struct {                    ///< register pair in one operand
                ^
```
2020-03-19 09:20:44 +08:00
david942j
1c85fcd0a9 Add Ruby binding by david942j (#1599) 2020-03-10 20:17:04 +08:00
Leo Neat
95cc05530a CIFuzz action (#1590) 2020-02-24 10:21:08 +08:00
Nicolas Derumigny
d9b9900250 Bug solved: SSE variant of MOVSD incorrectly decoded as REPNE MOVSD (#1540) 2020-02-21 09:58:32 +08:00
DarkaMaul
0e90045ddc fix: Remove wrong write in ARM_t2STMDB_UPD instruction (#1588) 2020-02-21 09:56:35 +08:00
Mateusz Piotrowski
3aa0ae8931 Fix installation path on FreeBSD and DragonFly (#1589) 2020-02-19 12:35:09 +08:00
Nguyen Anh Quynh
4e13196da8 python: classifier Python3 for setup.py 2020-01-26 13:26:58 +08:00
c0rejump
fc3e093763 Update top-level COMPILE.TXT file (#1578)
Update section 2:

    - add missing mos65xx.h header
    - force alphabetical order (LANG=C) of core files

Update section 4:

    - remove trailing space
2020-01-01 09:53:16 +08:00
Richard Henderson
936dca0e2d Constify backends (#1549)
* Constify registerinfo.py output

Remove two conditionals separating identical bits of code.
Add "const" markup to MCRegisterDesc and MCRegisterClass.

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify instrinfo-arch.py output

In this case, do not actively strip const.

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the AArch64 backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the EVM backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify M680X backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify M68K backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the Mips backend

The Mips backend has not been regenerated from LLVM recently,
and there are more fixups required than I'd like.  Just apply
the fixes to the tables by hand for now.

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the Sparc backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the TMS320C64x backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the X86 backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the XCore backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify systemregister.py output

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the ARM backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the PowerPC backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the MOS65XX backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the SystemZ backend

The mapping of system register to indexes is easy to
generate read-only.  Since we know the indexes are
between 0 and 31, use uint8_t instead of unsigned.

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the WASM backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify cs.c

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the BPF backend

Signed-off-by: Richard Henderson <rth@twiddle.net>
2019-12-23 20:30:57 +08:00
Nguyen Anh Quynh
d3c521e0a5 MOS65XX: C90 compatibility 2019-12-16 00:41:34 +08:00
Schrijvers Luc
be41ef5203 Use GNUInstallDirs for the headers too (#1570) 2019-12-16 00:37:22 +08:00
Jiayi Zhao
b29dca2cf7 systemz: fix base/index printing (#1561)
- In cases where base is 0 but index is not, Capstone doesn't print anything
2019-11-05 11:48:06 +08:00
Jiayi Zhao
d3b96a627a build: add xlc and AIX support (#1559) 2019-10-31 04:02:31 +08:00
naq
4294ca7570 bindings: update after the last header fix 2019-10-08 10:42:47 +08:00
keenk
5548fdbd91 Remove binding breaking statements (#1543)
* Fix a few registry access mode mappings

* Fix rollback of operand access changes

Re-fix operand access of three mov instructions

* Remove binding breaking #if 0

The python script for generating constants in the bindings does not know how to handle the #if 0 statements included in these files.
2019-10-08 10:41:35 +08:00
Tom Kelly
2dc088534f Fix for x86_op record for ocaml bindings (#1539) 2019-09-26 16:46:21 +08:00
Wu ChenXu
67d43e98f7 Update README (#1534) 2019-08-30 23:39:52 +08:00
Scott Knight
f871781c53 Update Go binding information (#1532) 2019-08-28 15:30:09 +08:00
naq
78762186d1 tests: fix typo in test_detail.c 2019-08-15 15:28:15 +08:00
Cen Zhang
e5f0539626 resolve merge conflicts 2019-07-29 17:44:04 +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
Cen Zhang
f931eef39f fix for make.sh for android (#1523)
* fix for make.sh for android

* remove commented line
2019-07-29 10:32:03 +08:00
Catena cyber
ba97425584 Fuzzit integration (#1520) 2019-07-25 09:06:52 +08:00
mquigley
85dffaeb09 #1246 - Fix Java bindings to use pointers instead of longs (#1516)
Previously, a long was used instead of a pointer in the JNA binding library.
This would work until the allocated pointers exceeded 32-bits. On modern JVMs,
allocations may produce pointers in excess of 32-bits which would result in
invalid memory access errors.

This also updates the binding version to 5.0.
2019-07-11 17:35:27 +08:00
Nguyen Anh Quynh
606532834a handle mnemonic customization better. issue #1514 2019-07-10 23:54:15 +08:00