Commit Graph

1505 Commits

Author SHA1 Message Date
Nguyen Anh Quynh
a1796341cb x86: recognize xacquire prefix. issue #1477 2019-05-13 22:27:05 +08:00
Nguyen Anh Quynh
90c0e6206b Merge branch 'next' of github.com:aquynh/capstone into next 2019-05-13 13:52:09 +08:00
Nguyen Anh Quynh
709aba4789 ppc: add JUMP group for some branch instructions 2019-05-11 11:52:43 +08:00
Nguyen Anh Quynh
287987a8a1 ppc: fix target address of bdnz. issue #1468 2019-05-11 10:18:36 +08:00
Nguyen Anh Quynh
946d55b781 synctools: fix genall-arch.sh for Arm & Arm64 2019-05-10 16:39:36 +08:00
Nguyen Anh Quynh
8f1021e117 ppc: cleanup 2019-05-10 14:43:01 +08:00
Nguyen Anh Quynh
bb6b2c137e ppc: fix target address for bdnzt 2019-05-10 14:38:51 +08:00
Nguyen Anh Quynh
71c59fce93 ppc: cleanup debug code 2019-05-10 01:06:47 +08:00
Nguyen Anh Quynh
ea538571e9 ppc: alias for Bcc instructions. issue #1468 2019-05-10 00:57:03 +08:00
Nguyen Anh Quynh
d7e9aa90c3 Merge branch 'next' of github.com:aquynh/capstone into next 2019-05-09 22:20:48 +08:00
Nguyen Anh Quynh
37dda9d4b7 ppc: proper map internal register ID to public register ID 2019-05-09 18:26:45 +08:00
Nguyen Anh Quynh
63c07ba724 ppc: fix some mappings in PPCMappingInsn.inc 2019-05-09 18:08:08 +08:00
Nguyen Anh Quynh
12c830172e ppc: indentation 2019-05-09 12:34:06 +08:00
Nguyen Anh Quynh
2a9e171e3c ppc: print condition register bits. issue #1469 2019-05-08 13:56:40 +08:00
Nguyen Anh Quynh
0ebcc815cf ppc: fix target address of B. issue #1468 2019-05-07 16:08:45 +08:00
Nguyen Anh Quynh
89251f3c61 x86: LOCK prefix for 16bit case of ADC/ADD/AND/OR/XOR/SUB in issue #1472 2019-05-06 17:39:44 +08:00
Nguyen Anh Quynh
d0f65d9756 x86: update tablegen to fix MOV CRx/DRx, TEST & LOCK prefix in #1456 & #1472 2019-05-06 17:28:37 +08:00
Nguyen Anh Quynh
f2f3829f27 x86: handle MOV CRx/DRx & LOCK prefix in issues #1456 & #1472 2019-05-06 16:18:45 +08:00
Nguyen Anh Quynh
055b02dbd9 x86: lock adc is valid. issue #1472 2019-05-06 12:44:09 +08:00
Nguyen Anh Quynh
8a32a553f0 ppc: fix mapping of CRXOR. issue #1469 2019-04-30 17:13:54 +08:00
Nguyen Anh Quynh
9ad613a2af ppc: add some new .inc files 2019-04-30 13:52:23 +08:00
Nguyen Anh Quynh
b543c345ca ppc: sync with llvm 7.0.1 2019-04-30 13:50:42 +08:00
Catena cyber
dc082bc374 Aarch64 set operand in printSVERegOp (#1462) 2019-04-28 22:22:46 +07:00
Nguyen Anh Quynh
663e5fcee9 x86: fix xmmword ptr issue in #1456 (TODO: better fix) 2019-04-17 20:39:21 +08:00
Nguyen Anh Quynh
788f3e5dc5 arm: fix printPKHASRShiftImm() - issue #1456 2019-04-17 00:48:12 +08:00
Nguyen Anh Quynh
79e30283ef arm: fix printAliasInstr() for wfe.w - issue #1456 2019-04-17 00:34:45 +08:00
Nguyen Anh Quynh
f9f22b2925 x86: improve EIZ check 2019-04-16 23:55:18 +08:00
Nguyen Anh Quynh
3acc6e9275 x86: do not print EIZ register - issue #1456 2019-04-16 23:36:40 +08: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
55b149f60a arm: alias LDR [sp], 4 to POP 2019-04-16 00:01:54 +08:00
Nguyen Anh Quynh
f099e00832 ppc: fix mapping of PPC_BCTRL8_LDinto_toc to PPC_INS_BCTRL 2019-04-15 20:45:04 +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
88d5c390eb arm: fix the missing third operand of LSR - issue #1456 2019-04-15 07:47:04 +08:00
Nguyen Anh Quynh
af867a3fe1 arm: fix wrong order of operand with shift - issue #1456 2019-04-15 00:04:40 +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
99d00fee14 x86: fix ATT syntax print immediate < 9 for MOV - issue #1456 2019-04-12 23:15:20 +08:00
Nguyen Anh Quynh
c976250b9b arm64: fix some ID mapping 2019-04-12 13:15:09 +08:00
Nguyen Anh Quynh
38d181d148 x86: quick fix for RCRm1 instruction - issue #1456 2019-04-12 00:38:23 +08:00
Nguyen Anh Quynh
3d50d2cffd arm: fix opcode of ASR/LSL/LSR/ROR/RRX - issue #1456 2019-04-12 00:08:04 +08:00
Nguyen Anh Quynh
e024477065 arm: fix some wrong insn mapping - issue #1456 2019-04-11 23:56:50 +08:00
Nguyen Anh Quynh
48cd47e4eb x86: fix BOUND instruction in issue #1456 2019-04-11 01:24:43 +08:00
Nguyen Anh Quynh
d5050f76ac arm: fix cstest 2019-04-11 00:46:12 +08:00
Nguyen Anh Quynh
a5b2d2a70a arm: fix mapping of ARM_SUBri (issue #1456) 2019-04-11 00:18:25 +08:00
Nguyen Anh Quynh
4754471262 merge next-arm64 to next 2019-04-10 17:46:07 +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
Travis Finkenauer
adff6c21e5 tms320c64x: remove extra indent (#1426) 2019-04-03 11:38:10 +08:00
Nguyen Anh Quynh
dea98fa870 x86: CMPXCHG read AL/AX/EAX/RAX registers (issue #1454) 2019-03-29 23:29:35 +08:00
Nguyen Anh Quynh
69bf4dda42 Merge branch 'next' of github.com:aquynh/capstone into next 2019-03-24 12:17:20 +08:00
Nguyen Anh Quynh
586bef3168 arm64: set operand 0 in cmeq to IMM type (issue #1443) 2019-03-24 12:17:03 +08:00
Wolfgang Schwotzer
4122b1a3c5 M680X: Remove warnings in msvc. (#1447)
- Also improved address range check.
- Added comments for maintainers.
2019-03-24 11:36:19 +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
223c5bce35 Merge branch 'next' of github.com:aquynh/capstone into next 2019-03-21 16:46:29 +08:00
Nguyen Anh Quynh
2d9ee88b39 arm64: delete arch/AArch64/ARMMappingInsnOp.inc 2019-03-21 16:46:07 +08:00
Wolfgang Schwotzer
8355bee630 nit: Also use lowercase 'pcr' (#1437)
- This occurs for M6809 PC relative indexed addressing.
  In this case the register is referenced as pcr (and not pc).
- This is a consequence of lowercase registers introduced in
  cc8da331d3
- Example: lda   $FD00,pcr (instead of lda   $FD00,pcR)
2019-03-21 15:06:48 +08:00
Wolfgang Schwotzer
656790752d Fix coverity bug #1166 (#1436)
- Avoid address increment by pass-by-pointer parameter.
- Code cleanup: single responsibility where and who
  calculates the instruction byte size.
2019-03-21 10:24:24 +08:00
z
0664b4b774 add riscv cmake support & using static array contain temp string for riscv (#1435)
* add TableGen patch whcih fix riscv asmwrter.inc memory leak

* add riscv for cmake suporrt and change asmwriter using static array container

* add missing .inc files for riscv cmake support
2019-03-20 23:19:26 +08:00
Wolfgang Schwotzer
77600b956c Fix #1412: test_m680x crashes on Windows (#1432)
- Bug exists since adding M680X
- To save binary memory space the instruction decoding tables
  are realized as struct bit-fields.
  On MSVC when using enum values as a bit-field in a struct they are
  interpreted as signed values => out-of-bounds array access.
- On gcc they are interpreted as unsigned values => no error.
- Fix: in the struct bit-field only use signed int and bool.
  This conforms to C99.
2019-03-20 09:51:19 +08:00
Nguyen Anh Quynh
d17d8754ba arm: brkdiv0 is invalid code. TODO: this is just a quick fix, later fix thisn in tablegen 2019-03-19 00:17:35 +08:00
Philippe Antoine
0b23157074 Adds info for ARM brkdiv0 2019-03-18 09:19:49 +01: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
hal-jones
72be24262f 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:40:29 +08:00
Nguyen Anh Quynh
0113195d49 arm: delete unused ARMRegisterName.inc 2019-03-16 18:05:30 +08:00
Nguyen Anh Quynh
ad3264e9c2 arm: use ARMMappingInsnName.inc for instruction names 2019-03-16 18:03:11 +08:00
Nguyen Anh Quynh
58750a1b71 arm: fix more MSVC warnings 2019-03-16 15:40:38 +08:00
Nguyen Anh Quynh
41f24e31af arm: fix more MSVC warnings 2019-03-16 15:32:14 +08:00
Nguyen Anh Quynh
b540ece988 arm: fix warnings reported by MSVC 2019-03-16 15:29:25 +08:00
Nguyen Anh Quynh
eb4dcfb214 arm: sync with llvm 7.0.1 2019-03-16 15:22:15 +08:00
Catena cyber
cb2940ccf6 Fix memory leak in RISC V (#1424) 2019-03-15 12:31:17 +08:00
ceeac
b5964c1bfc Fix #1420: Capstone 4 fails to build when targeting UWP (#1421) 2019-03-14 23:27:55 +08:00
Nguyen Anh Quynh
34d92258e0 riscv: coding style cleanup 2019-03-09 08:47:11 +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
Nguyen Anh Quynh
0f4300cf11 arm: cleanup ARMGenInstrInfo.inc 2019-03-07 18:13:39 +08:00
Nguyen Anh Quynh
165a964bb5 x86: operand size of BNDxxx is 16 2019-03-07 09:09:35 +08:00
Catena cyber
c5180bffd3 Fixes uninitialized memory for X86 BND instructions (#1415) 2019-03-07 09:06:45 +08:00
Catena cyber
2e13b39af5 Avoids type confusion in cpu12 for M680X (#1417) 2019-03-05 10:19:42 +08:00
Nguyen Anh Quynh
8c7cbaf415 x86: operand access for BND instructions 2019-03-04 16:12:56 +08:00
Nguyen Anh Quynh
f2233b7f44 x86: new files X86GenRegisterName.inc & X86GenRegisterName1.inc 2019-03-04 00:56:07 +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
Nguyen Anh Quynh
7e1efae487 x86: remove PRINT_ALIAS_INSTR 2019-03-02 15:32:07 +08:00
Nguyen Anh Quynh
cb2b1bda53 x86: add BND registers to regsize_map_32 & regsize_map_64 2019-03-02 15:16:48 +08:00
Nguyen Anh Quynh
3dd39b0bc5 x86: add BND registers. this fixes OSS-fuzz issue 13467 2019-03-02 14:58:29 +08:00
Daniel Collin
9f53e3b0d4 Made instruction table static (#1408) 2019-03-02 10:53:30 +08:00
z
6eaf37cf87 fix SystemZRegDesc&SystemZMCRegisterClasses number of SystemZ InitMCRegisterInfo (#1405) 2019-03-01 09:55:11 +08:00
Nguyen Anh Quynh
b7ed33a1a0 Merge branch 'next' of github.com:aquynh/capstone into next 2019-03-01 01:12:50 +08:00
Nguyen Anh Quynh
2dc77357e1 x86: update ISA & mapping tables 2019-03-01 01:05:52 +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
Nguyen Anh Quynh
357ef8e535 x86: X86_insn_name checks array boundary with ARR_SIZE 2019-02-27 00:19:43 +08:00
Nguyen Anh Quynh
49d46e6a52 x86: optimize X86MappingInsnName.inc to have only instruction names 2019-02-26 23:47:05 +08:00
Nguyen Anh Quynh
9836779db9 x64: fix binary searching functions in arch/X86/X86Mapping.c 2019-02-26 22:59:52 +08:00