Commit Graph

1454 Commits

Author SHA1 Message Date
Riccardo Schirone
702ac842e1 WIP: arch/TMS320C64x: fix underflow (#1220)
* arch/TMS320C64x: fix underflow

(patch coming from radare2)

* arch/TMS320C64x: fix spaces between if/for/while and parenthesis

* arch/TMS320C64x: switch back to ==
2018-07-30 21:48:26 +08:00
Riccardo Schirone
71b32ce5e7 WIP: arch/TMS320C64x: fix underflow (#1220)
* arch/TMS320C64x: fix underflow

(patch coming from radare2)

* arch/TMS320C64x: fix spaces between if/for/while and parenthesis

* arch/TMS320C64x: switch back to ==
2018-07-30 15:17:43 +08:00
Nguyen Anh Quynh
757310df51 evm: fix EVMMappingInsn.inc 2018-07-29 02:38:38 +08:00
Nguyen Anh Quynh
e0bce87ef1 evm: fix EVMMappingInsn.inc 2018-07-29 02:38:10 +08: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
Nguyen Anh Quynh
af286d4914 sparc: fix issue #1221 on double printing imm operand 2018-07-24 14:53:00 +08:00
Riccardo Schirone
b512f388cf 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 13:40:02 +08:00
Francesco Tamagni
f6e0fa42f2 Fix testAndBranch sign extend to 64 bit (#1213) 2018-07-20 14:50:41 +08:00
Francesco Tamagni
baa10210fc Fix testAndBranch sign extend to 64 bit (#1213) 2018-07-20 14:50:01 +08:00
Nguyen Anh Quynh
76c1c3c4e9 merge next to master 2018-07-20 12:36:50 +08:00
Nguyen Anh Quynh
9783ea8585 mips: compilable for MSVC 2013 2018-07-18 23:47:07 +08:00
Nguyen Anh Quynh
d64cfab1d8 mips: compilable for MSVC 2013 2018-07-18 23:46:36 +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
Nguyen Anh Quynh
8171df5568 x86: fix imm operand of RETF. see #1204 2018-07-11 23:20:00 +08:00
Martin
ec81ee223b readDisplacement fix (#1200) 2018-07-11 23:19:45 +08:00
Martin
bd89989f5d readDisplacement fix (#1200) 2018-07-11 22:18:38 +07:00
Nguyen Anh Quynh
7e93de0714 x86: fix imm operand of RETF. see #1204 2018-07-11 23:12:18 +08:00
Nguyen Anh Quynh
940cbdcfea Merge branch 'next' of github.com:aquynh/capstone into next 2018-07-05 11:34:32 +08:00
Nguyen Anh Quynh
68d4e771eb evm: default case for switch 2018-07-05 11:33:39 +08:00
Nguyen Anh Quynh
5c173ca0cd evm: cleanup group_name_maps[] 2018-07-05 11:32:42 +08:00
Nguyen Anh Quynh
ec57c1b4ec evm: fix bug introduced in some recent fixes 2018-07-05 11:32:19 +08:00
Nguyen Anh Quynh
76a86e5354 evm: cleanup 2018-07-05 11:32:05 +08:00
Nguyen Anh Quynh
6c4ece4472 evm: simplify EVM_get_insn_id() 2018-07-05 11:31:53 +08:00
Nguyen Anh Quynh
3a3cff2e91 evm: correct comments on evm_insn_find() 2018-07-05 11:31:39 +08:00
Nguyen Anh Quynh
dfb75a21a0 evm: fix header guard in EVMModule.c 2018-07-05 01:16:24 +08:00
Nguyen Anh Quynh
97f34c87c7 x86: X86_immediate_size() returns uint8 2018-07-04 23:02:22 +08:00
Nguyen Anh Quynh
795ffa39e7 coding style 2018-07-04 22:54:14 +08:00
Stephen Eckels
e9861a1192 Merges encoding to next (#1194)
* merge encoding branch into next branch

* added python bindings and updated test to support encoding

* fix python import

* fix py binding fields

* fix disp size printing

* fixed py binding, again

* Update CREDITS.TXT

* fixed formatting and a cast

* Changed param from int to uint8_t, fixed warnings
2018-07-04 22:47:55 +08:00
Nguyen Anh Quynh
1036de09bf Revert "Merges encoding branch (#1187)"
This reverts commit a1ed8fc6f6.
2018-07-03 11:55:29 +08:00
Catena cyber
e14b4c4b11 Initializes to 0 X86 immediateOffset (#1192) 2018-06-29 17:00:51 +08:00
Catena cyber
b1f2f1a394 Initializes to 0 X86 immediateOffset (#1192) 2018-06-29 16:59:30 +08:00
Stephen Eckels
699611072b Merges encoding branch (#1187)
* Added encoding field to instructions, as per encoding branch

The encoding branch appears to have added some useful fields
accessible from the public API, including the size and offsets
of displacements and immediates in instructions.  I needed access
to these fields, but the encoding branch is months behind the
active branches, so I took the minimum code from the old encoding
branch and put them into a more recent version of master.

It does seem that the most recent version does not have an offset
for the modRM byte in the InternalInstruction struct, so I did
not keep this field when bringing it to the more recent version.

I also added some of the changes made by user jellever, who added
support for accessing these new fields from the python bindings.

(cherry picked from commit d358c4b987cc77af90e24da15937e021c42f682f)

* Fixed bug with python bindings from adding encoding field

I had forgotten an import that resulted in failure when trying
to obtain instruction details.

(cherry picked from commit 44a15e378900efb624e7cdb952d32558ba0de684)

* promoted displacement to 64 bits

* Added modrm offset

* formatting from review fixed

* updated 32 bit C tests

* Added 64 and 16 bit C tests

* Updated python tests

* fixed formatting and size in py bindings

* Delete Solution.VC.db-shm

* Delete Solution.VC.db-wal

* Update test_x86.c

* fixed formatting and conditional prints

* fixed formatting
2018-06-28 21:37:34 +08:00
Catena cyber
950476606b Initialize X86 necessaryPrefixLocation (#1179)
* Initialize X86 necessaryPrefixLocation

* necessaryPrefixLocation initialization to -1

* Revert "necessaryPrefixLocation initialization to -1"

This reverts commit 04fc4b6702.
2018-06-25 19:46:58 +08:00
Catena cyber
27a169e305 Initialize X86 necessaryPrefixLocation (#1179)
* Initialize X86 necessaryPrefixLocation

* necessaryPrefixLocation initialization to -1

* Revert "necessaryPrefixLocation initialization to -1"

This reverts commit 04fc4b6702.
2018-06-25 19:46:04 +08: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
9ecaeea75a SystemZ MIN_INT right print (#1182) 2018-06-16 23:09:25 +01:00
Catena cyber
204be7951d EVM fuzz fixes (#1181)
Sets id to instruction
Completes missing set and enforces number of instructions
2018-06-16 22:35:02 +01:00
Catena cyber
63ff398094 EVM initialize regs_read and regs_write (#1180) 2018-06-15 23:15:12 +01:00
vit9696
c2514aab00 Add Availability.h include to fix macOS SDK instrinsics 2018-06-15 22:14:48 +08:00
vit9696
f52aa1f39c Add Availability.h include to fix macOS SDK instrinsics (#1175) 2018-06-14 22:12:26 +01:00
vit9696
a31ffb343f Refactor confusing if for xacquire/xrelease (#1173)
Sync with https://github.com/llvm-mirror/llvm/blob/7cdce81/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp#L362
2018-06-13 23:04:20 +01:00
vit9696
f8eae0ac15 Refactor confusing if for xacquire/xrelease (#1173)
Sync with https://github.com/llvm-mirror/llvm/blob/7cdce81/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp#L362
2018-06-13 22:14:53 +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
a33567db49 Fix ARM operand subtracted field (#1163) 2018-06-06 06:17:25 +08:00
Catena cyber
9217582b9f Fixes shift for ARM memory operand (#1162)
Shift is for same operand as index register
2018-06-06 06:09:53 +08:00
Catena cyber
62f1d9fe14 Fix ARM operand subtracted field (#1163) 2018-06-05 22:20:02 +08:00
Catena cyber
d15e310112 Fix integer overflow on systemz (#1164)
using fixed function from SStream.c
2018-06-05 14:03:55 +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
Catena cyber
6c796d996b We can read more registers from M68K (#1151) 2018-06-02 01:08:54 +08:00
Nguyen Anh Quynh
aeb4128cab x86: support new instructions endbr64 & endbr32 2018-06-01 22:57:53 +08:00
Nguyen Anh Quynh
e1494cf1f4 cleanup 2018-06-01 22:05:50 +08:00
clslgrnc
c3527b72e1 Improve init of cs_detail for x86 (#1125) 2018-06-01 22:03:55 +08:00
Catena cyber
f1f5fca1b5 M68K increment index after having written register (#1147) 2018-06-01 20:53:01 +08:00
Catena cyber
d937c94cac Fix buffer overflow in M68K (#1146) 2018-06-01 20:52:37 +08:00
Catena cyber
7c668dac9d Do not shift signed values in Mips disassembling (#1148)
* Do not shift signed values in Mips disassembling

* Do not shift signed values in Mips disassembling

Multiply instead
2018-06-01 20:51:46 +08:00
Nguyen Anh Quynh
538b7bfbd1 arm: BX & BLX write to PC. see #1126 2018-05-28 20:30:15 +08:00
Daniel Collin
d3080c4d0c Fixed incorrect size of code check (#1130)
Also added a sanity check that the code is at least 2 bytes before trying to disassemble.

Also removed some unused code while at it
2018-05-10 15:06:46 +08:00
clslgrnc
10adccccd3 Prevent buffer overflow in cs_regs_access on ud0 (#1122)
By setting instr->Opcode, ud0 is correctly found in insns, and insn->detail is correctly initialized by X86_get_insn_id.
2018-05-07 09:42:01 +08:00
Nguyen Anh Quynh
39480af183 indentation 2018-04-03 22:48:28 +08:00
Nguyen Anh Quynh
e5101ab48a indentation 2018-04-03 22:36:26 +08:00
Nguyen Anh Quynh
1da2ae94de EVM: add missing files 2018-03-31 17:32:22 +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
Google AutoFuzz Team
c72e6d1a36 Fixing #1062
Adding a fix to commit 5b55115c42
2018-03-22 18:18:22 -07:00
Google AutoFuzz Team
4c8b187aee Fixing #1061
Updating the fix provided in commit 5b55115c42
2018-03-22 17:30:00 -07:00
Alberto Garcia Illera
d0525ca346 prefix cs_ to global variables to avoid link problems (#1102) 2018-03-19 22:23:09 +08:00
l0stb1t
04b461a76d Fixed #1060 #1061 #1062 (#1079) 2018-03-12 22:23:48 +07:00
Nguyen Anh Quynh
8cc43a72a3 m680x: compile on MSVC 2010 2018-02-14 14:57:34 +08:00
Jason Shirk
40040d47e2 Fix MSVC build (#1080) 2018-01-23 11:12:41 +08:00
Nguyen Anh Quynh
1b166ebdf4 m68k: update bindings after #1068 2018-01-06 20:16:58 +08:00
Kalmalyzer
9944bfde76 M68K: Branch targets are a separate addressing mode; PC relative displacements printed as target addresses (#1068)
* Branch targets are a separate addressing mode

Branch targets are relative displacements that identify code locations. These are neither .w nor .l nor immediates. This change removes the immediate #s before branch target addresses in disassembly, and represents the actual branch instructions more accurately in the cs_m68k_op datastructure.

M68K Python bindings have also been updated.

* m68k_inst.pc handles better; print target for PC relative offsets

Previous changes to branch operations relied on m68k_inst.pc pointing to (start of instruction + 2). This was not the case - it pointed to the end of the current instruction. This change makes it so that m68k_inst.pc points to (start of instruction), which is simple to work with.

It also changes printing of PC relative offsets to print the absolute target address, which is consistent with how most 68000 assemblers & disassemblers behave.
2018-01-06 20:13:41 +08:00
Nguyen Anh Quynh
cbdea7ce19 sparc: fix relative branch target for Sparc64 2017-12-27 14:24:18 +08:00
bezita
1790ccdb1e Fix EFLAGS for the stosb/stosd/stosq/stosw instructions (#1065) 2017-12-22 00:05:47 +08:00
Nguyen Anh Quynh
6c1c82bdd7 sparc: fix #1061 2017-12-15 10:12:54 +08:00
Nguyen Anh Quynh
030b52458a systemz: fix #1062 2017-12-15 10:11:40 +08:00
Nguyen Anh Quynh
d75eedd8bc arm: fix #1060 2017-12-15 10:10:04 +08:00
Jean-David Gadina
0efc9b9c5a Added an explicit cast to silence a compiler warning casting a parameter to an enum type (). (#1052) 2017-11-21 10:19:29 +03:00
Nguyen Anh Quynh
811d8ceee6 x86: fix att syntax when imm operand is 0 (#1046) 2017-11-17 10:27:35 +03:00
Nguyen Anh Quynh
a45e860114 x86: fix att syntax when imm operand is 0 (#1046) 2017-11-17 10:26:26 +03:00
Nguyen Anh Quynh
4c96c85a2b x86: fix immediate operand for AND instruction in ATT mode (issue #1047) 2017-11-11 03:00:05 +08:00
Richard Henderson
5423b215bf Constify backend data (#1040)
* Constify string literals

Use -Wwrite-strings to force string literals to be of
type "const char[]", then fix up all warning fallout.

* Constify common infrastructure

Step one in allowing backend data to be readonly.
Minimal changes to backends for now; just set all pointers
in common structs that aren't modified to const.

* Constify AArch64 backend

Section size changes within libcapstone.so are

-.rodata               602587
-.data.rel.ro          228416
-.data                1003746
+.rodata               769051
+.data.rel.ro          241120
+.data                 824578

* Constify ARM backend

Section size changes within libcapstone.so are

-.rodata               769051
-.data.rel.ro          241120
-.data                 824578
+.rodata               959835
+.data.rel.ro          245120
+.data                 629506

* Constify Mips backend

Section size changes within libcapstone.so are

-.rodata               959835
-.data.rel.ro          245120
-.data                 629506
+.rodata              1069851
+.data.rel.ro          256416
+.data                 508194

* Constify PowerPC backend

Section size changes within libcapstone.so are

-.rodata              1069851
-.data.rel.ro          256416
-.data                 508194
+.rodata              1142715
+.data.rel.ro          272224
+.data                 419490

* Constify Sparc backend

Section size changes within libcapstone.so are

-.rodata              1142715
-.data.rel.ro          272224
-.data                 419490
+.rodata              1175227
+.data.rel.ro          277536
+.data                 381666

* Constify SystemZ backend

Section size changes within libcapstone.so are

-.rodata              1175227
-.data.rel.ro          277536
-.data                 381666
+.rodata              1221883
+.data.rel.ro          278016
+.data                 334498

* Constify X86 backend

Section size changes within libcapstone.so are

-.rodata              1221883
-.data.rel.ro          278016
-.data                 334498
+.rodata              1533531
+.data.rel.ro          281184
+.data                  19714

* Constify XCore backend

Section size changes within libcapstone.so are

-.rodata              1533531
-.data.rel.ro          281184
-.data                  19714
+.rodata              1553026
+.data.rel.ro          281280
+.data                     40
2017-10-22 08:45:40 +08:00
Wolfgang Schwotzer
e8d1f1d4d2 M680X: Target ready for pull request (#1034)
* Added new M680X target. Supports M6800/1/2/3/9, HD6301

* M680X: Reformat for coding guide lines. Set alphabetical order in HACK.TXT

* M680X: Prepare for python binding. Move cs_m680x, m680x_insn to m680x_info. Chec
> k cpu type, no default.

* M680X: Add python bindings. Added python tests.

* M680X: Added cpu types to usage message.

* cstool: Avoid segfault for invalid <arch+mode>.

* Make test_m680x.c/test_m680x.py output comparable (diff params: -bu). Keep xprint.py untouched.

* M680X: Update CMake/make for m680x support. Update .gitignore.

* M680X: Reduce compiler warnings.

* M680X: Reduce compiler warnings.

* M680X: Reduce compiler warnings.

* M680X: Make test_m680x.c/test_m680x.py output comparable (diff params: -bu).

* M680X: Add ocaml bindings and tests.

* M680X: Add java bindings and tests.

* M680X: Added tests for all indexed addressing modes. C/Python/Ocaml

* M680X: Naming, use page1 for PAGE1 instructions (without prefix).

* M680X: Naming, use page1 for PAGE1 instructions (without prefix).

* M680X: Used M680X_FIRST_OP_IN_MNEM in tests C/python/java/ocaml.

* M680X: Added access property to cs_m680x_op.

* M680X: Added operand size.

* M680X: Remove compiler warnings.

* M680X: Added READ/WRITE access property per operator.

* M680X: Make reg_inherent_hdlr independent of CPU type.

* M680X: Add HD6309 support + bug fixes

* M680X: Remove errors and warning.

* M680X: Add Bcc/LBcc to group BRAREL (relative branch).

* M680X: Add group JUMP to BVS/BVC/LBVS/LBVC. Remove BRAREL from BRN/LBRN.

* M680X: Remove LBRN from group BRAREL.

* M680X: Refactored cpu_type initialization for better readability.

* M680X: Add two operands for insn having two reg. in mnemonic. e.g. ABX.

* M680X: Remove typo in cstool.c

* M680X: Some format improvements in changed_regs.

* M680X: Remove insn id string list from tests (C/python/java/ocaml).

* M680X: SEXW, set access of reg. D to WRITE.

* M680X: Sort changed_regs in increasing m680x_insn order.

* M680X: Add M68HC11 support + Reduced from two to one INDEXED operand.

* M680X: cstool, also write '(in mnemonic)' for second reg. operand.

* M680X: Add BRN/LBRN to group JUMP and BRAREL.

* M680X: For Bcc/LBcc/BRSET/BRCLR set reg. CC to read access.

* M680X: Correctly print negative immediate values with option CS_OPT_UNSIGNED.

* M680X: Rename some instruction handlers.

* M680X: Add M68HC05 support.

* M680X: Dont print prefix '<' for direct addr. mode.

* M680X: Add M68HC08 support + resorted tables + bug fixes.

* M680X: Add Freescale HCS08 support.

* M680X: Changed group names, avoid spaces.

* M680X: Refactoring, rename addessing mode handlers.

* M680X: indexed addr. mode, changed pre/post inc-/decrement representation.

* M680X: Rename some M6809/HD6309 specific functions.

* M680X: Add CPU12 (68HC12/HCS12) support.

* M680X: Correctly display illegal instruction as FCB .

* M680X: bugfix: BRA/BRN/BSR/LBRA/LBRN/LBSR does not read CC reg.

* M680X: bugfix: Correctly check for sufficient code size for M6809 indexed addressing.

* M680X: Better support for changing insn id within handler for addessing mode.

* M680X: Remove warnings.

* M680X: In set_changed_regs_read_write_counts use own access_mode.

* M680X: Split cpu specific tables into separate *.inc files.

* M680X: Remove warnings.

* M680X: Removed address_mode. Addressing mode is available in operand.type

* M680X: Bugfix: BSET/BCLR/BRSET/BRCLR correct read/modify CC reg.

* M680X: Remove register TMP1. It is first visible in CPU12X.

* M680X: Performance improvement + bug fixes.

* M680X: Performance improvement, make cpu_tables const static.

* M680X: Simplify operand decoding by using two handlers.

* M680X: Replace M680X_OP_INDEX by M680X_OP_CONSTANT + bugfix in java/python/ocaml bindings.

* M680X: Format with astyle.

* M680X: Update documentation.

* M680X: Corrected author for m680x specific files.

* M680X: Make max. number of architectures single source.
2017-10-21 21:44:36 +08:00
Travis Finkenauer
de99147c73 ppc: fix endian check (#1029)
* 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
`arch_disallowed_mode_mask[]`, which is initialized in the arch-specific
`*_enable()` functions.

Fixes bug where endianness could not be set for ppc.

* Fix Mac OS brew for Travis CI
2017-10-20 23:33:24 +08:00
Daniel Collin
3b43ddb92c [M68K] Fixed invalid base reg (#1028)
This is one of those “how did this ever work?” changes. Problem was that as m68k_op was aliased with the imm value so when changing that to something big it would trash the values in the mem struct which would make things go really bad.

Now m68k_op_mem has been moved out of the union so this will not happen again. Also fixed instruction printing bug related to this (just happend to “work” due to the old union layout)
2017-10-13 09:06:01 +08:00
Nguyen Anh Quynh
ee33de3f29 Mips64: fix the last cherry-pick on selecting getInstruction() 2017-10-09 09:26:41 +08:00
Travis Finkenauer
69f9fabefa Mips: Fix selection of disasm handler (#1022) 2017-10-09 08:52:53 +08:00
Travis Finkenauer
2f4bc38eec Fix selection of mips disasm handler (#1022)
* Fix selection of mips disasm handler

handle->disasm was incorrectly set to Mips64_getInstruction if CS_MODE_MIPS32R6
was set but CS_MODE_32 was not set. Now, CS_MODE_32 is set automatically if
CS_MODE_MIPS32R6 is set.

* Align with current style
2017-10-09 08:44:01 +08:00
Richard Henderson
edb0cc57ac Fix pp field in readPrefix for VEX3 and EVEX (#1015) (#1016) 2017-09-19 08:46:59 +08:00
Richard Henderson
72cd9ee99e Fix pp field in readPrefix for VEX3 and EVEX (#1015) (#1016) 2017-09-19 07:46:00 +07:00
Matt Suiche
0441af5ce7 Resolve some casting issues with Visual Studio. 2017-09-05 22:20:57 +07:00
Matt Suiche
4e7f49228b - Resolve some casting issues with Visual Studio. (#1007) 2017-09-05 22:15:13 +07:00
Nguyen Anh Quynh
e87caa789a x86: fix an warning on unintialized vars 2017-08-16 09:01:58 +08:00
Andrew Calvano
166feea41c Bug fix for incorrect operand type in certain load/store instructions on AArch64. (#952) 2017-08-03 23:01:47 +07:00
Andrew Calvano
0c5ee0e4aa Bug fix for incorrect operand type in certain load/store instructions on AArch64. (#952) 2017-08-03 23:00:53 +08:00
Alfredo Beaumont
5fc444c073 Add name to relative branch group in supported architectures. (#982) 2017-08-01 16:49:43 +08:00
Fotis Loukos
104832daed Fixed bug in memory operand decoding. (#981)
Fixed bug #979. Decoding a memory operand with a register offset from
the B file would return an incorrect register.
2017-07-31 20:56:29 +08:00
Nguyen Anh Quynh
374a8525d8 Merge branch 'master' of https://github.com/aquynh/capstone 2017-07-31 01:06:24 +07:00
Nguyen Anh Quynh
f72bb9cfe2 arm: UADD8 updates flags. fix #980 2017-07-31 01:06:17 +07:00
Nguyen Anh Quynh
6cd9313c70 arm: UADD8 updates flags. fix #980 2017-07-31 01:05:28 +07:00
Alfredo Beaumont
f82395b959 Relative branch group (#964)
* Add a new group for relative branching instructions

* x86: Add relative branch group to appropiate instructions

* Rename RELATIVE_BRANCH to BRANCH_RELATIVE

* aarch64: Add relative branch group to appropiate instructions

* arm: Add relative branch group to appropiate instructions

* m68k: Add relative branch group to appropiate instructions

* mips: Add relative branch group to appropiate instructions
2017-07-30 19:05:03 +08:00
semihalf-oleksy-michalina
de6666c531 arm64: handling of system registers added in ARMv8.1/2 (#960)
* arm64: handling of system registers added in ARMv8.2

This commit adds handling of system registers added in ARMv8.2.
Those registers are accessed by mrs and msr instructions.
Changes based on https://static.docs.arm.com/ddi0487/b/DDI0487B_a_armv8_arm.pdf, chapters D7.2-5.

List of added registers:
id_mmfr4_el1
id_aa64mmfr2_el1
sctlr_el12
cpacr_el12
ttbr0_el12
ttbr1_el12
ttbr1_el2
tcr_el12
spsr_el12
elr_el12
afsr0_el12
afsr1_el12
esr_el12
far_el12
mair_el12
amair_el12
vbar_el12
cntkctl_el12
cnthv_ctl_el2
cnthv_cval_el2
cnthv_tval_el2
cntp_tval_el02
cntp_cval_el02
cntv_ctl_el02
ntv_cval_el02
cntv_tval_el02
lorid_el1
lorc_el1
lorea_el1
lorn_el1
lorsa_el1
contextidr_el12

sign-of: Michalina Oleksy (https://github.com/layika)

* arm64: handling of system registers added in ARMv8.1/2

v8.1:
PAN (https://static.docs.arm.com/ddi0487/b/DDI0487B_a_armv8_arm.pdf, page 358)
PAN (as pstate field)
contextdir_el2

v8.2:
UAO (https://static.docs.arm.com/ddi0487/b/DDI0487B_a_armv8_arm.pdf, page 403)
UAO (as pstate field)

* arm64: handling of system registers for statistical profiling

Added handling of system registers for statistical profiling extension based on https://static.docs.arm.com/ddi0586/a/DDI0586A_Statistical_Profiling_Extension.pdf

* Update AArch64BaseInfo.h

* arm64: An attempt to fix indentation
2017-07-29 18:27:32 +08:00
Nguyen Anh Quynh
490db4e5dd x86: MOV AL, [mem] has 2 operands. fix #959 2017-07-08 13:58:36 +07:00
Snarpix
a2948cca80 Fixes DATA REX_W CALL_PC_REL IMM32 issue (decoded as IMM16) (#883) 2017-06-28 07:07:26 +08:00
Francesco Tamagni
b8342f9b90 Add CS_MODE_MIPS2 to opt-in for COP3 instructions (#939)
* Add CS_MODE_MIPS2 to opt-in for COP3 instructions

* Fix indentation

* Get rid of `+`
2017-06-27 20:56:54 +08:00
Nguyen Anh Quynh
3bc180e3eb x86: wrong number of operands. fix #950 2017-06-23 00:54:09 +08:00
radare
7a4567612c Honor CS_OPT_UNSIGNED on x86 and add cstool -u (#945) 2017-06-16 02:13:28 +08:00
echotyh
572d864b2f Next (#918)
* Add FPUFLAGS information.

* Change the structure insn_op: from uint64_t eflags to union{ uint64_t eflags, uint64_t fpuflags; }.

* Adjust the  modified structure insn_op.

* Add missing flags.

* Change flags information acorrding to xed files and instruction manual.

* Rename fpuflags to fpu_flags.

* Updating flags information accoring to manual and xed files.

* Changing the name eflags to flags.

* Printing the FPU_FLAGS information when it belongs to group X86_GRP_FPU.

* Defining new flags.

* Updating flags information according to manual and xed files.

* Adding X86_GRP_FPU to all the instructions which have modified fpu_flags.

* Solving the conflict problem when do git commit.

* Rectify the annotation within the structure insn_op.

* Supplement fpu flags information for floating-point instructions which missed fpu flags before.

* Print fpu group information when an instructure belongs to X86_GRP_FPU.

* Add two new groups ARM64_GRP_BASE(base instructions) and ARM64_GRP_FPSIMD(SIMD&FP instructions).

* Revert "Add two new groups ARM64_GRP_BASE(base instructions) and ARM64_GRP_FPSIMD(SIMD&FP instructions)."

This reverts commit 8ab50e80a3.

* X86 clean up.

* Clean up arch/X86/X86MappingInsn.inc.

* Double check.

* Delete files.

* Clean up x86.

* Clean up reduce file

* Fix btr

* fix x86
2017-05-29 22:43:47 +08:00
vit9696
158646b843 Added qsort implementation for OS X kernel mode (#934)
* Added qsort implementation for OS X kernel mode

* Added qsort source reference
2017-05-26 09:27:01 +08:00
vit9696
1c0f3d887c Merge #929 with some changes to get things compile (#930) 2017-05-25 16:01:48 +08:00
vit9696
62cf15d334 Several changes for size reduction (#929)
* Support CAPSTONE_STATIC with __GNUC__ compilers

* Allow custom export rules

* Make CAPSTONE_SHARED the default visibility option with GNUC (avoids behaviour changes)

* Reduce capstone static build size (mainly for kernel usage)

* Allow basic cs_detail support in diet mode

* Fixed valid_bnd unused function warning

* Do not disable cs_detail generation in CAPSTONE_DIET, use CAPSTONE_NO_DETAIL for that.

* Reverted CAPSTONE_NO_DETAIL at least until capstone supports more flexible configuration

* Added a missing endif

* Disallow custom export rules
2017-05-24 13:07:11 +08:00
Nguyen Anh Quynh
b7bd162539 x86: indentation 2017-05-22 21:36:48 +08:00
Nguyen Anh Quynh
82a2665896 x86: indentation 2017-05-22 21:36:04 +08:00
Nguyen Anh Quynh
d1a71d4974 x86: attempt to fix uninitialized memory, probably by introduction of UD0 2017-05-09 20:22:48 +08:00
Nguyen Anh Quynh
7a2d7deb78 x86: LDS is invalid in x64. see #904 2017-05-08 10:49:55 +08:00
Nguyen Anh Quynh
ebc012f54f x86: LDS is invalid in x64. see #904 2017-05-08 10:49:16 +08:00
Nguyen Anh Quynh
31a2855012 Merge branch 'master' of https://github.com/aquynh/capstone 2017-05-07 14:32:52 +08:00
Nguyen Anh Quynh
36fb9a2fff x86: handle f2/f3 prefix for 16bit. see issue #452 2017-05-07 14:32:39 +08:00
Nguyen Anh Quynh
b7f9e75c3b x86: handle f2/f3 prefix for 16bit. see issue #452 2017-05-07 14:30:06 +08:00
Nguyen Anh Quynh
fcaf7d9a6f x86: add UD0 instruction 2017-05-07 11:17:23 +08:00
Nguyen Anh Quynh
093ebf0646 x86: LES is invalid in x64. see #904 2017-05-06 14:29:40 +08:00
Nguyen Anh Quynh
1e28d29bb9 x86: LES is invalid in x64. see #904 2017-05-06 14:29:11 +08:00
Nguyen Anh Quynh
79e1a1821e x86: AT&T syntax bug with zero offset segment register. see #884 2017-05-06 10:38:08 +08:00
Nguyen Anh Quynh
f958e5fca4 x86: AT&T syntax bug with zero offset segment register. see #884 2017-05-06 10:37:44 +08:00
Nguyen Anh Quynh
663b210cb7 arm: another fix for #913 2017-05-05 09:53:29 +08:00
Nguyen Anh Quynh
5b92f8c1da arm: POP {reg} read/write SP register. this fixes #913 2017-05-04 17:21:41 +08:00
Nguyen Anh Quynh
a71f763b09 arm: POP {reg} read/write SP register. this fixes #913 2017-05-04 17:20:01 +08:00
Nguyen Anh Quynh
05d9a34efa x86: lock nop is a valid instruction. #915 2017-05-03 20:06:39 +08:00
Nguyen Anh Quynh
27eb3b2c3a x86: lock nop is a valid instruction. #915 2017-05-03 20:06:15 +08:00
noword
22d762085c fix compiling error in MS VS2015 (#869)
for issue #868
2017-04-26 09:10:44 +08:00
noword
8d5436b4e3 fix compiling error in MS VS2015 (#869)
for issue #868
2017-04-26 05:52:28 +08:00
Simorfo
ec28cd5e8f Bugfix : setting all fields to insns cache (#899)
* Bugfix : setting all fields to insns cache

* Bugfix
Fixing root cause, not setting opcode to 0 in default case

* Not resetting opcode to 0 in this case as well

* Finalizing bugfix
2017-04-21 21:21:20 +08:00
Simorfo
f88ef5fe37 Bugfix : setting all fields to insns cache (#899)
* Bugfix : setting all fields to insns cache

* Bugfix
Fixing root cause, not setting opcode to 0 in default case

* Not resetting opcode to 0 in this case as well

* Finalizing bugfix
2017-04-21 21:20:17 +08:00
radare
e7a441a7f6 Fix undefined behaviour produced by disassembling 6662dcbc615a (#898) 2017-04-20 23:04:52 +08:00
radare
42c865862f Fix assigned value with undefined (#893) 2017-04-18 06:45:03 +08:00
Nguyen Anh Quynh
1745553d50 Merge branch 'next2' into next 2017-04-17 21:27:26 +08:00
Nguyen Anh Quynh
282ce28126 Merge branch 'next' of https://github.com/fotisl/capstone into fotisl-next 2017-04-17 21:19:10 +08:00
Fotis Loukos
e3723f206d Fixed group name getting function 2017-04-17 11:57:16 +03:00
el2ro
0951668a46 fix merged conflicts 2017-04-15 10:39:06 +08:00
szt
20643d4d34 replace if-s in AArch64_AM_decodeAdvSIMDModImmType10 with lookup table (#552)
* replace if-s in AArch64_AM_decodeAdvSIMDModImmType10 with lookup table

Lookup table is much faster than bunch of if-s. If you don't like lookup tables, I have another proposal. See http://goo.gl/RjW1lr and compare generated machine code

* Smaller lookup table and shifting and bit mask used

* Update AArch64AddressingModes.h
2017-04-15 10:36:43 +08:00
el2ro
8084cd96d9 Fix for incorrect operand size in 64bit CALL / JMP when x66 prefix in use (#777) 2017-04-15 10:34:50 +08:00
Nguyen Anh Quynh
58546aa2fd Merge branch 'next' of https://github.com/fotisl/capstone into fotisl-next 2017-04-15 09:53:05 +08:00
szt
468b4b0b54 replace if-s in AArch64_AM_decodeAdvSIMDModImmType10 with lookup table (#552)
* replace if-s in AArch64_AM_decodeAdvSIMDModImmType10 with lookup table

Lookup table is much faster than bunch of if-s. If you don't like lookup tables, I have another proposal. See http://goo.gl/RjW1lr and compare generated machine code

* Smaller lookup table and shifting and bit mask used

* Update AArch64AddressingModes.h
2017-04-15 09:50:06 +08:00
Fotis Loukos
357828b858 Corrected a bug
Corrected a bug that would cause capstone to crash under certain invalid
instructions.
2017-04-14 22:39:40 +03:00
radare
a9075dee71 Fix UB when accessing un-initialized array (#890) 2017-04-14 23:21:56 +08:00
Fotis Loukos
4d6b830deb Fixed myinttypes.h 2017-04-14 17:40:53 +03:00
Fotis Loukos
ae6f2d1411 Added support for the TMS320C64x architecture. 2017-04-14 17:00:40 +03:00
Nguyen Anh Quynh
d7948dd2e5 x86: support BND prefix. issue #872 2017-03-18 00:08:10 +08:00
Nguyen Anh Quynh
33bacd7b85 x86: support BND prefix. issue #872 2017-03-17 23:44:34 +08:00
Nguyen Anh Quynh
f91b2c2470 arm64: fix immediate number in detail mode. see #860 2017-02-26 18:17:39 +08:00
Nguyen Anh Quynh
f76c4dc090 x86: consistent register names ST0-ST7 with the asm output 2017-02-22 15:54:37 +08:00
Nguyen Anh Quynh
6c4762ac91 x86: consistent register names ST0-ST7 with the asm output 2017-02-22 15:54:11 +08:00
Nguyen Anh Quynh
695e60be9d arm: add IMM operand for printPostIdxImm8s4Operand(). issue #861 2017-02-22 09:27:16 +08:00
Nguyen Anh Quynh
fd1599e279 arm: add IMM operand for printPostIdxImm8s4Operand(). issue #861 2017-02-22 09:26:54 +08:00
Nguyen Anh Quynh
eebd47d78a ppc: print 0 offset for memory operand. see issue #856 2017-02-19 21:28:05 +08:00
Nguyen Anh Quynh
fd15f64ceb Merge branch 'master' of https://github.com/aquynh/capstone 2017-02-19 21:27:30 +08:00
Nguyen Anh Quynh
14283f1556 ppc: print 0 offset for memory operand. see issue #856 2017-02-19 21:27:17 +08:00
Nguyen Anh Quynh
7b4535f746 x86: fix EAX operand for X86_MOV32ao32. fix issue #852 2017-02-09 16:29:13 +08:00
Nguyen Anh Quynh
76b94cba23 switch endian mode with cs_option() for Arm/Arm64/Mips/Sparc. fix issue #849 2017-02-01 11:19:00 +08:00
Nguyen Anh Quynh
c4b0030b3b switch endian mode with cs_option() for Arm/Arm64/Mips/Sparc. fix issue #849 2017-02-01 11:17:13 +08:00
Vincent Bénony
ad1d38b582 Fixes truncated immediate value in operand details
The instruction encoded « 00 00 19 B2 » was correctly disassembled « orr x0, x0, #0x8000000080 », but the reported immediate value, in the detail structure, was truncated to 0x80 due to the cast.
2017-01-26 17:10:16 +01:00
Daniel Collin
1510c4f26f Fixed incorrect 8-bit displacement
8-bit displacement was treated as unsigned while it should actually be signed.
2017-01-23 20:11:53 +01:00
Nguyen Anh Quynh
25a6bab761 arm: groups for Thumb SETEND instruction. ported from #843 2017-01-19 09:13:49 +08:00
JustEnuff2BDangerous
6d2c587536 Patch for issue #842
The SETEND instruction is a 16 bit Thumb instruction which is included
in T variants of ARMv6 and above, but is not available in M-Class cores
(see ARM Compiler toolchain Assembler Reference Ver 5.0).

To be consistent with other similar instructions its group flags have
been updated to be:

{ARM_GRP_THUMB, ARM_GRP_V6, ARM_GRP_NOTMCLASS,0}
2017-01-18 17:35:42 +00:00
Nguyen Anh Quynh
c2b8488b66 x86: Fix the operand encoding in the test instruction for reduce set, issue #702 2017-01-03 01:33:21 +08:00
Nguyen Anh Quynh
c1f19ef166 x86: Fix the operand encoding in the test instruction for reduce set, issue #702 2017-01-03 01:30:34 +08:00
Nguyen Anh Quynh
9de18b3397 x86: Fix the operand encoding in the test instruction, issue #702 2017-01-03 01:09:15 +08:00
Nguyen Anh Quynh
e985c455d2 Merge branch 'next' of https://github.com/aquynh/capstone into next 2017-01-03 01:06:06 +08:00
Nguyen Anh Quynh
daabe1004d x86: Fix the operand encoding in the test instruction, issue #702 2017-01-03 01:05:52 +08:00
BartmanAbyss
6830660783 (M68k) make displacements signed (#836)
* (M68k) make displacements signed

* (M68k) revert group changes

* (m68k) signed displacement in python bindings
2017-01-01 01:11:48 +08:00
Nguyen Anh Quynh
6e247def0b arm: fix operand access info for Bcc & BL. see issue #826 2016-12-13 18:20:01 +07:00
Nguyen Anh Quynh
e22c6c6100 arm: fix access info for RET. see issue #825 2016-12-13 18:02:51 +07:00
Nguyen Anh Quynh
06a4c383aa arm: fix decoding Thumb big-endian instructions. ported from PR #813 2016-11-14 21:37:23 +09:00
Mitchell Johnson
9971a0ad26 Use the correct mapping for 32-bit Thumb Big-Endian insns 2016-11-13 23:18:13 -05:00
Nguyen Anh Quynh
030e9be4eb x86: fix instruction MOVAPS & MOVAPD. see issue #809 2016-11-11 11:27:34 +09:00
Nguyen Anh Quynh
980cfa8f7d x86: fix (AT&T) instruction SLDT for issue #807 2016-11-08 11:46:56 +08:00
Nguyen Anh Quynh
e25accac25 x86: fix (AT&T) instruction SLDT for issue #807 2016-11-08 11:46:21 +08:00
Nguyen Anh Quynh
e6ca012983 x86: fix (AT&T) instruction lgs for issue #805 2016-11-08 11:39:40 +08:00
Nguyen Anh Quynh
24794deded x86: fix (AT&T) instruction lgs for issue #805 2016-11-08 11:39:10 +08:00
Nguyen Anh Quynh
d2574a2214 x86: fix (AT&T) ROL instruction in issue #804 2016-11-08 11:28:43 +08:00
Nguyen Anh Quynh
5701c6b295 x86: fix (AT&T) ROL instruction in issue #804 2016-11-08 11:28:09 +08:00
Nguyen Anh Quynh
9ed7f53376 x86: fix movw instruction in #789 2016-11-08 10:56:42 +08:00
Nguyen Anh Quynh
10bafd3bab x86: fix movw instruction in #789 2016-11-08 10:56:18 +08:00
Nguyen Anh Quynh
bda181a6b5 x86: fix sysexit in #806 2016-11-08 10:29:07 +08:00
Nguyen Anh Quynh
c4137655e4 x86: fix sysexit in #806 2016-11-08 10:28:40 +08:00
Samuel Chevet
8060ecbc0d Add X86_REG_EFLAGS to X86_CLC, X86_CLD, X86_CMC (#801)
* add X86_REG_EFLAGS for X86_STC

* remove wrong X86_GRP_PRIVILEGE for X86_STC ; add X86_REG_EFLAGS for X86_STD

* Add X86_REG_EFLAGS to X86_CLC, X86_CLD, X86_CMC

* add X86_REG_EFLAGS to X86_CLC, X86_CLD, X86_CMC for reduced instructions too
2016-10-28 21:49:41 +08:00
Samuel Chevet
53fb2ea844 Add X86_REG_EFLAGS for X86_STC and X86_STD for full x86 instructions … (#800)
* Add X86_REG_EFLAGS for X86_STC and X86_STD for full x86 instructions ; Add X86_REG_EFLAGS for X86_CLD, X86_CMC for reduce and full x86 instructions

* Add trailing zero for regs write in X86_CLC ; X86_CLD ; X86_CMC
2016-10-28 21:38:34 +08:00
Samuel CHEVET
d4e5ebb1b8 Add X86_REG_EFLAGS for X86_STC and X86_STD 2016-10-27 15:31:22 -04:00
Samuel Chevet
57c3481e31 add X86_REG_EFLAGS for X86_STC (#797)
* add X86_REG_EFLAGS for X86_STC

* remove wrong X86_GRP_PRIVILEGE for X86_STC ; add X86_REG_EFLAGS for X86_STD
2016-10-28 03:23:50 +08:00
Andrew Dutcher
081e7dc978 Fix two missing register operands in X86 AT&T syntax (#791)
* Bug fix: missing register operand in AT&T emitter for `movb %ax, imm`

* Bug fix: missing register operand in AT&T emitter for `movb %al, imm`
2016-10-14 13:26:27 +08:00
Nguyen Anh Quynh
3ab94f7d9c x86: RET read/write stack register. this fixes issue #790 2016-10-13 20:44:42 +08:00
Satoshi Tanda
cda8f0eb78 add explanation comment for use of CAPSTONE_API
Signed-off-by: Satoshi Tanda <tanda.sat@gmail.com>
2016-09-28 17:22:36 -07:00
Satoshi Tanda
02609c367c fix compile error with capstone_static_winkernel
The MSVC project capstone_static_winkernel uses __stdcall as a
default calling convention to fit with environment for Windows driver
development. This leads to a compile error in a use of qsort() with
regs_cmp() since it is compiled as a __stdcall function while qsort()
expects a __cdelc function.

This fix adds explicit calling convention to regs_cmp() for MSVC.

Signed-off-by: Satoshi Tanda <tanda.sat@gmail.com>
2016-09-28 08:00:22 -07:00
Satoshi Tanda
c6592d5c7e suppress MSVC code analysis (PREfast) warnings for m68k
Signed-off-by: Satoshi Tanda <tanda.sat@gmail.com>
2016-09-28 07:59:25 -07:00
Satoshi Tanda
c7b00b3756 suppress MSVC code analysis (PREfast) warnings
Signed-off-by: Satoshi Tanda <tanda.sat@gmail.com>
2016-09-28 07:33:39 -07:00
Satoshi Tanda
d7e38cd903 suppress MSVC code analysis (PREfast) warnings
Signed-off-by: Satoshi Tanda <tanda.sat@gmail.com>
2016-09-27 08:08:58 -07:00
Ole André Vadla Ravnås
de995b0edd Fix use of uninitialized value for some instructions
Caught by Valgrind:

    Conditional jump or move depends on uninitialised value(s)
       at 0xD5BB6F: readModRM (X86DisassemblerDecoder.c:1528)
       by 0xD5BF02: getIDWithAttrMask (X86DisassemblerDecoder.c:1101)
       by 0xD5CC5E: getID (X86DisassemblerDecoder.c:1249)
       by 0xD5CC5E: decodeInstruction (X86DisassemblerDecoder.c:2335)
       by 0xD52009: X86_getInstruction (X86Disassembler.c:822)
       by 0xD51781: cs_disasm (cs.c:503)
2016-09-27 08:51:16 +08:00
Ole André Vadla Ravnås
e0276cdb64 Fix use of uninitialized value for some instructions
Caught by Valgrind:

    Conditional jump or move depends on uninitialised value(s)
       at 0xD5BB6F: readModRM (X86DisassemblerDecoder.c:1528)
       by 0xD5BF02: getIDWithAttrMask (X86DisassemblerDecoder.c:1101)
       by 0xD5CC5E: getID (X86DisassemblerDecoder.c:1249)
       by 0xD5CC5E: decodeInstruction (X86DisassemblerDecoder.c:2335)
       by 0xD52009: X86_getInstruction (X86Disassembler.c:822)
       by 0xD51781: cs_disasm (cs.c:503)
2016-09-26 15:01:18 +02:00
Nguyen Anh Quynh
a5418178b2 arm: update imm in printOperand() to fix error reported by @trufae in PR #764 2016-09-22 22:25:09 +08:00
Nguyen Anh Quynh
53a4473c92 arm: update imm in printOperand() to fix error reported by @trufae in PR #764 2016-09-22 22:22:36 +08:00
Simorfo
a7fce04074 AArch64 set good extender 2016-09-09 21:03:38 +08:00
Simorfo
90adc35a8e AArch64 set good extender 2016-09-09 13:15:32 +02:00
Nguyen Anh Quynh
399dd9da81 Merge pull request #764 from akihikodaki/next
arm: treat ARM address as unsigned
2016-09-07 09:51:04 +08:00
Nguyen Anh Quynh
fe8572d80f arm: fix issue #767 2016-09-05 23:05:03 +08:00
Akihiko Odaki
e7e4e1dfda arm: treat ARM address as unsigned
It should be unsigned because:
* It does arithmetic operations
* Format strings have "%u" instead of "%d"

# Conflicts:
#	arch/ARM/ARMInstPrinter.c
#	bindings/python/test_arm.py
#	tests/test_arm.c
2016-09-04 00:13:50 +09:00
Akihiko Odaki
2876044815 arm: treat ARM address as unsigned
It should be unsigned because:
* It does arithmetic operations
* Format strings have "%u" instead of "%d"
2016-09-03 14:28:46 +09:00
Nguyen Anh Quynh
24179e1b15 Merge branch 'fcompi' of https://github.com/mrexodia/capstone into mrexodia-fcompi 2016-09-03 00:34:27 +08:00
Nguyen Anh Quynh
c6ddb2b553 arm: fix issue #760 2016-09-02 01:05:57 +08:00
mrexodia
e7bc93c8de final change for fcomip and fucomip 2016-08-30 23:34:11 +02:00
mrexodia
fb2c843f66 changed fcompi to fcomip and fucompi to fucomip 2016-08-30 23:10:04 +02:00
Nguyen Anh Quynh
fc24d6d602 x86: fast path checking for X86_insn_reg_intel() 2016-08-27 20:54:37 +08:00
Nguyen Anh Quynh
c3ef3df13c x86: fix issue #756 2016-08-27 13:06:59 +08:00
Nguyen Anh Quynh
e93290962c arm64: add NEGS & NGCS alias instructions. this fixes issue #752 2016-08-23 14:01:17 +08:00
Nguyen Anh Quynh
65eec12d33 arm: fix issue #750 2016-08-17 16:23:40 +08:00
Nguyen Anh Quynh
383adcf41f cleanup 2016-08-17 16:20:52 +08:00
Nguyen Anh Quynh
452c4e934f arm: fix issue #747 2016-08-17 16:19:21 +08:00
Nguyen Anh Quynh
34ecce8b72 arm: fix issue #746 2016-08-15 20:00:40 +08:00
Nguyen Anh Quynh
08fd47e040 arm: fix issue #744 2016-08-13 13:25:52 +08:00
Nguyen Anh Quynh
dc7568a926 arm: fix issue #740 2016-08-11 17:01:48 +08:00
Nguyen Anh Quynh
a4634b45dc Merge pull request #696 from emoon/m68k-reg-read-write
[M68K] Implemented regs read/write lists
2016-08-11 11:22:48 +08:00
Daniel Collin
147083be67 [M68K] Implemented regs read/write lists 2016-08-09 17:29:36 +02:00
Nguyen Anh Quynh
c7df4c0920 arm: fix issue #740 2016-08-09 23:19:04 +08:00
Yuping Li
8637c3b5b6 Fix BL, BLR group information 2016-07-19 22:59:14 -07:00
David Carne
8fb6b89113 x86: initialize eaDisplacement in 16-bit mode. Fixes #656 2016-07-18 23:28:04 +08:00
Nguyen Anh Quynh
63c195d218 Merge pull request #657 from davidcarne/fix-uninit
x86: initialize eaDisplacement in 16-bit mode.  Fixes #656
2016-07-18 23:26:25 +08:00
Nguyen Anh Quynh
fae35cedac x86: properly handle SSE/AVX instructions 2016-07-15 20:37:19 +08:00
lucasg
0800d09912 Fix mov *ax, addr register access for CAPSTONE_REDUCE files 2016-07-10 08:28:42 +02:00
lucasg
3664d4ea76 Fix register access for 16-bit mov instructions 2016-07-09 13:59:57 +02:00
lucasg
588a69a1ab [X86] Fix *ax dst register access on some MOV instructions 2016-07-09 13:50:09 +02:00
Jeffrey Crowell
90d7c825d7 Update X86Mapping.c 2016-06-29 11:26:13 -04:00
Jeffrey Crowell
cf5a14d1d8 fixup qsort 2016-06-28 20:06:33 +00:00
Jeffrey Crowell
bb436aeee9 use stdlib's qsort 2016-06-28 19:16:21 +00:00
Jeffrey Crowell
d5bba1133b add an auxilary array for x86 reg to greatly speedup X86_insn_reg_intel 2016-06-28 17:04:06 +00:00
Nguyen Anh Quynh
e7e9670819 x86: fix similar bugs with issue #711 for MOV with *AX registers 2016-06-26 01:22:09 +08:00
Nguyen Anh Quynh
f29c3b9e6e x86: fix issue #711 2016-06-26 01:14:37 +08:00
Nguyen Anh Quynh
eda2090a71 Merge branch 'next' of https://github.com/aquynh/capstone into next 2016-06-26 01:04:11 +08:00
Nguyen Anh Quynh
3b461fb4dd x86: fix issue #717 2016-06-26 01:03:26 +08:00
Nguyen Anh Quynh
030d8eef0a x86: fix issue #717 2016-06-26 01:03:11 +08:00
fvrmatteo
93b8008f6b Fixed X86_INS_BTC/X86_INS_BTR/X86_INS_BTS 2016-06-20 17:03:37 +02:00
fvrmatteo
f1959bbed3 Fixed EFLAGS of BT/BTC/BTR/BTS 2016-06-20 12:51:43 +02:00
fvrmatteo
dc48e50724 Fixed EFLAGS of BT/BTC/BTR/BTS 2016-06-20 12:46:07 +02:00
fvrmatteo
074502daa2 Changed X86_INS_POP flags 2016-06-18 13:02:57 +02:00
Niels Boehm
06cc17d41c Fix typo in m68k constant for immediate operand. 2016-06-15 08:25:59 +02:00
pancake
1614338ead Append LL for all > 32bit numeric immediates 2016-06-06 17:38:09 +02:00
Nguyen Anh Quynh
f6d1ad6136 x86: fix access right memory operand of of MOVSS. see issue #693 2016-06-03 21:25:37 +08:00
tandasat
9a6a5ca74e Merge remote-tracking branch 'upstream/next' into next 2016-05-16 20:36:48 -07:00