Commit Graph

248 Commits

Author SHA1 Message Date
Wu ChenXu
85759d8722 Merge pull request #1804 from bSr43/next
Fixes a few issues
2021-12-10 21:26:41 +08:00
pancake
a5259aab30 Dont format sstreams when there's nothing to format 2021-12-10 10:59:16 +01:00
Vincent Bénony
77606769ff Wrong register mapping 2021-12-09 15:06:53 +01:00
Vincent Bénony
fa9310e63f Missing writeback information on ldraa / ldrab 2021-12-09 15:06:26 +01:00
Vincent Bénony
593c2c5c86 Missing vector arrangement specifiers 2021-12-09 15:05:11 +01:00
cyanpencil
b99a991a9b Fix cmp register access on aarch64 2020-07-01 16:04:06 +02: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
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
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
29c7012025 fix some compilation issues when DIET mode is on 2019-06-24 12:52:38 +08:00
Nguyen Anh Quynh
94aa224272 arm64: LDR operands[1] is memory operand. fix issue #1481 2019-05-16 21:29:51 +08:00
Nguyen Anh Quynh
fe2e7eb00f arm64: fix a segfault. issue #1480 2019-05-15 21:04:13 +08:00
Catena cyber
dc082bc374 Aarch64 set operand in printSVERegOp (#1462) 2019-04-28 22:22:46 +07:00
Nguyen Anh Quynh
e8ec9863d2 arm64: fix imm value of MOV - issue #1456 2019-04-16 20:28:53 +08:00
Nguyen Anh Quynh
0a2fd07f67 arm64: fix more mapping instructions in AArch64MappingInsn.inc 2019-04-16 13:12:00 +08:00
Nguyen Anh Quynh
d6cbfa6f34 arm64: fix more mapping instructions in AArch64MappingInsn.inc 2019-04-16 13:04:20 +08:00
Nguyen Anh Quynh
67cc59c8d1 arm64: fix more mapping instructions in AArch64MappingInsn.inc 2019-04-16 13:01:59 +08:00
Nguyen Anh Quynh
f2787286e2 arm64: fix more instruction ID for ORR, BFI & BFXIL - issue #1456 2019-04-16 09:59:26 +08:00
Nguyen Anh Quynh
59324a71ea arm64: fix some wrong mapping instruction ID - issue #1456 2019-04-15 20:44:37 +08:00
Nguyen Anh Quynh
dde6867f06 arm64: fix lookupExactFPImmByEnum() leading to a crash (reported by OSS Fuzz) 2019-04-13 00:22:22 +08:00
Nguyen Anh Quynh
f18c6a5bf8 arm64: more fix for imm of MOV instruction. issue #1456 2019-04-12 23:49:42 +08:00
Nguyen Anh Quynh
8cbf967f67 arm64: fix imm of MOV instruction. issue 1456 2019-04-12 23:33:49 +08:00
Nguyen Anh Quynh
c976250b9b arm64: fix some ID mapping 2019-04-12 13:15:09 +08:00
Nguyen Anh Quynh
f0a5df2504 arm64 & arm: fix some warnings 2019-04-10 17:33:41 +08:00
Nguyen Anh Quynh
e0f960e3e7 arm64: some bug fixes 2019-04-10 17:24:56 +08:00
Nguyen Anh Quynh
afeda44c90 arm64: fix crashes on some alias instructions 2019-04-10 16:07:40 +08:00
Nguyen Anh Quynh
7c07225170 arm64: cleanup 2019-04-10 14:22:23 +08:00
Nguyen Anh Quynh
f407e94249 arm64: sync with LLVM 7.0.1 2019-04-10 14:17:08 +08:00
blacktop
42731072b3 Update AARCH64 to ARMv8.1-4 (minus tablegen stuff) (#1425)
* updates for armv8.1-4

* Update AArch64Disassembler.c

* adding clang-format

* fix tabs

* fix indents

* fix tabs

* Update AArch64Disassembler.c

* Update AArch64Disassembler.c

* Update AArch64Disassembler.c

* Update AArch64Disassembler.c

* fix tables

* revert disass

* Update AArch64Disassembler.c

* Update AArch64Disassembler.c

* add AArch64InstPrinter new func stubs

* Update AArch64Mapping.c

* add baseinfo

* fix dates

* add AddressingModes.h

* Update AArch64Disassembler.c

* Update AArch64InstPrinter.c
2019-03-18 13:29:45 +08:00
hal-jones
ee6c6ee678 AArch64: Fix register access flags for memory instructions (#1423)
* AArch64: fixes register access flags for loads

* AArch64: fixes register access flags for ORR

* AArch64: fixes register access flags for stores
2019-03-17 00:41:06 +08:00
Nguyen Anh Quynh
de420ec49a trimming MCRegisterClass 2019-02-21 22:33:15 +08:00
Nguyen Anh Quynh
f38aec3d72 arm64: fix CS_OPT_UNSIGNED option on memory operand offset 2019-02-13 22:12:00 +08:00
Nguyen Anh Quynh
4ee7d45078 arm64: support CS_OPT_UNSIGNED 2019-02-12 23:27:29 +08:00
Marius Melzer
c6612a3059 Fix missing-prototypes warnings (#1348) 2019-01-22 07:39:44 +07:00
Riccardo Schirone
c316ef189d arch/M68k: do not return reg_name if beyond limits (#1219)
* arch/M68k: do not return reg_name if beyond limits

(patch coming from radare2)

* arch: checks index when returning reg names
2018-07-24 16:25:47 +08:00
Francesco Tamagni
f6e0fa42f2 Fix testAndBranch sign extend to 64 bit (#1213) 2018-07-20 14:50:41 +08:00
Nguyen Anh Quynh
76c1c3c4e9 merge next to master 2018-07-20 12:36:50 +08:00
clslgrnc
91601ac1fd Init cs_detail (#1205)
* Update init of cs_detail for AArch64

as @aquynh requested in #1125

* Update init of cs_detail for ARM

as @aquynh requested in #1125

* Update init of cs_detail for EVM

as @aquynh requested in #1125

* Update init of cs_detail for M680X

as @aquynh requested in #1125

* Update init of cs_detail for M68K

as @aquynh requested in #1125

* Update init of cs_detail for Mips

as @aquynh requested in #1125

* Update init of cs_detail for PowerPC

as @aquynh requested in #1125

* Update init of cs_detail for Sparc

as @aquynh requested in #1125

* Update init of cs_detail for SystemZ

as @aquynh requested in #1125

* Update init of cs_detail for TMS320C64x

as @aquynh requested in #1125

* Update init of cs_detail for XCore

as @aquynh requested in #1125

* Comment on init of cs_detail

* wrap long lines
2018-07-12 11:01:34 +07:00
Travis Finkenauer
292116bd0d Declare global arch arrays with contents (next branch) (#1186)
* Declare global arch arrays with contents (#1171)

This eliminates the need for archs_enable() and eliminates the racey
initialization.

This makes the architecture-specific init and option functions
non-static so that they may be called from a different file.

Cherry-picked 853a2870

* Add cs_arch_disallowed_mode_mask global

Cherry-pick 94bce437:
mips: CS_MODE_MIPS32R6 implies CS_MODE_32

Cherry-pick 8998a3a1:
ppc: fix endian check (#1029)
Fixes bug where endianness could not be set for ppc.

Remove `big_endian` field of `cs_struct`.
Added a helper macro `MODE_IS_BIG_ENDIAN()` to check if
`CS_MODE_BIG_ENDIAN` is set.

Refactored `cs_open()` check for valid mode out of arch-specific code
into arch-independent code. Also added a valid mode check to
`cs_option()`.  The checks use a new global array
`cs_arch_disallowed_mode_mask[]`.

* Make global arrays static

Make all_arch uint32_t to guarantee a certain number of bits (with
adequate room for growth).
2018-06-24 21:05:04 +08:00
Nguyen Anh Quynh
7566f79879 cleanup 2018-06-22 01:03:26 +08:00
Travis Finkenauer
ce597d5296 Declare global arch arrays with contents (#1171)
This eliminates the need for archs_enable() and eliminates the racey
initialization.

This makes the architecture-specific init, option, and destroy functions
non-static so that they may be called from a different file.
2018-06-21 14:52:35 +08:00
Catena cyber
aad3aca3e7 Use printint functions from SStream (#1165)
in perticular, not to overflow -INT_MIN
2018-06-06 06:31:53 +08:00
Catena cyber
8f7c495e05 Fix undefined shifts (#1158) 2018-06-03 22:29:58 +08:00
Catena cyber
17076b66d2 Fix undefined negative value shift (#1161)
Use multiply instead
2018-06-03 22:19:07 +08:00
Catena cyber
fbb90bcb35 Fix undefined shifts (#1158)
Use multiply instead
Found by oss-fuzz
2018-06-02 16:52:52 +08:00
Catena cyber
65c0be823c Fix undefined shifts (#1156)
* Fix undefined shifts

Found by oss-fuzz
uint8_t gets promoted to integer
and integers shift cannot overflow on sign bit

* Fix undefined shifts

shifting 31 bits the sign bit
2018-06-02 16:51:40 +08:00
Catena cyber
bf97c62001 Undefined shifts (#1154)
* Fix undefined shifts

uint8 gets promoted to signed integer

in ARM, MIPS, Sparc
in AArch64, PPC and Xcore

* fix undefined shift in powerpc

* Fix undefined shift in Mips

use mulitply instead
2018-06-02 16:49:36 +08:00
Alberto Garcia Illera
3c8e828b14 prefix cs_ to global variables to avoid link problems (#1108)
* prefix cs_ to global variables to avoid link problems

* force Capstone to be build using MT

* fix identation
2018-03-29 22:17:37 +08:00