Commit Graph

1260 Commits

Author SHA1 Message Date
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
tandasat
7b2f93068d port #684 to the next branch 2016-05-16 20:32:36 -07:00
tandasat
0368aa7c42 fix #681 2016-05-16 08:32:58 -07:00
Nguyen Anh Quynh
820d7d02c7 Merge pull request #669 from zachriggle/next-mips
Add MIPS_GRP_INT and MIPS_GRP_CALL
2016-05-14 09:36:49 +08:00
tandasat
6e79b1ac32 Merge remote-tracking branch 'upstream/next' into next 2016-05-13 07:38:42 -07:00
Zach Riggle
fcc30cfcd2 Add missing MIPS groups 2016-05-12 10:11:00 -07:00
tandasat
e36384e224 Merge remote-tracking branch 'upstream/next' into next 2016-05-11 22:52:34 -07:00
tandasat
d4ef430b33 port Windows driver support 2016-05-11 21:48:32 -07:00
Inokentiy Babushkin
bd139c663a Added enum tag setting to FPU handling code for m68k 2016-05-09 23:09:27 +02:00
Inokentiy Babushkin
c7dae68dec Adjusted operand printing 2016-05-09 21:47:10 +02:00
Inokentiy Babushkin
46e10afb24 Changed register pair handling in M68K header
* instead of using bit operations, we now leverage the size of the
  enclosing union to avoid running code and provide a more convenient
  interface to the library user.
2016-05-08 23:19:47 +02:00
tandasat
8d377f3b7b address warnings with capstone_static_winkernel 2016-05-04 05:54:28 -07:00
Zach Riggle
0dc5fea8a9 Annotate MIPS insructions JALR and SYSCALL
Add the appropriate MIPS_GRP_XXX groups to those instructions.
2016-05-03 07:37:09 -07:00
Zach Riggle
1b3f07ad12 Add MIPS_GRP_XXX aliases for generic types. 2016-05-03 07:30:31 -07:00
David Carne
7be7f63216 x86: initialize eaDisplacement in 16-bit mode. Fixes #656 2016-04-28 20:05:55 -07:00
Nguyen Anh Quynh
977e893bc2 sparc: fix target address of CALL instruction. issue #653 2016-04-27 11:15:23 +08:00
Nguyen Anh Quynh
3f461adae3 remove myinttypes.h 2016-04-26 09:47:30 +08:00
Nguyen Anh Quynh
6472fa9929 x86: do not print LJMP/LCALL with ptr. this fixes issue #429 2016-04-25 10:28:13 +08:00
Nguyen Anh Quynh
2f3070b0d2 x86: do not print 'ptr' for fxsave & fxrstor instructions. this fixes issue #492 2016-04-24 10:02:56 +08:00
tandasat
152c1baf9f skip stdint.h for windows driver configuration 2016-04-23 15:58:31 -07:00
Nguyen Anh Quynh
896d69f4ad x86: handle some AVX & segment-related instructions properly. this fixes a segfault reported by @revskills 2016-04-19 15:41:16 +08:00
jmechnich
4906bf1de9 m68k: fixed d68000_move_to_sr
* instruction is available for all processors, not 68010+ (see e.g.
   https://www.nxp.com/files/archives/doc/ref_manual/M68000PRM.pdf, p. 6-19)
 * operand size is WORD not BYTE
2016-04-16 23:07:00 +02:00
Nguyen Anh Quynh
d5277c10f0 Merge branch 'next' of https://github.com/koutheir/capstone into koutheir-next 2016-04-12 23:05:37 +07:00
Daniel Collin
0bcb2e546c Various fixes
* Fixed a break indentation
* Fixed incorrect enum value for M68K_GRP_IRET
* Fixed so groups_count is set to 0 at init
* Added group_count printing in python example
2016-04-10 16:16:28 +02:00
Daniel Collin
d994c74b02 [M68K] Added basic groups
Added support for basic groups in the M68K backend. Also did some minor cleanups/whitespace fixes while at it.

Relates to this issue https://github.com/aquynh/capstone/issues/494
2016-04-10 10:55:21 +02:00
Nguyen Anh Quynh
27a59de4e7 x86: fix memory operand size of fnstenv/fldenv (issue #613) 2016-04-09 09:59:26 +08:00
Koutheir Attouchi
9f2070748c Added support for building binaries for Windows CE 7 on ARMv7 (a.k.a., Windows Embedded Compact 7) and for Windows CE 8 on ARMv7 (a.k.a., Windows Embedded Compact 2013).
Added support for building binaries for Windows CE 7 on ARMv7 (a.k.a., Windows Embedded Compact 7) and for Windows CE 8 on ARMv7 (a.k.a., Windows Embedded Compact 2013).

Added support for building binaries for Windows CE 7 on ARMv7 (a.k.a., Windows Embedded Compact 7) and for Windows CE 8 on ARMv7 (a.k.a., Windows Embedded Compact 2013).

Replaced header inclusions of "stdint.h" and "intrin.h" by selective inclusions to support platforms that do not provide those headers. The header "platform.h" handles the platform test.
Updated the build script for Windows CE 7 on ARMv7.
2016-04-07 17:05:00 +02:00
Nguyen Anh Quynh
a95ee1da44 Merge pull request #617 from jmechnich/next-m68k-am-pci-index-8-bit-disp-size-missing-fix
M68KInstPrinter.c: print size after register in M68K_AM_PCI_INDEX_8_B…
2016-04-05 12:39:32 +07:00
jmechnich
1f38441efd M68KInstPrinter.c: removed space between register name and size indicator 2016-04-03 20:37:17 +02:00
jmechnich
14df65f933 M68KInstPrinter.c: print size after register in M68K_AM_PCI_INDEX_8_BIT_DISP 2016-04-03 19:36:46 +02:00
jmechnich
29ad5e671d M68KDisassembler.c: fixed typo in d68000_roxr_ea 2016-04-03 13:50:28 +02:00
tandasat
cb2b4e6263 Replaced snprintf with cs_snprintf 2016-03-31 18:07:53 -07:00
Nguyen Anh Quynh
1337999317 Merge branch 'jmechnich-next-m68k-movem-fix' into next 2016-03-30 09:40:47 +08:00
Nguyen Anh Quynh
92807007ac m68k: indentation 2016-03-30 09:39:24 +08:00
jmechnich
1f9d2ace95 bugfix: use proper order for operands in M68K movem 2016-03-25 22:04:04 +01:00
Per Mildner
d7e5b2e1be Do not truncate branch target address to 32 bit 2016-03-25 17:07:39 +01:00
unknown
527aea59da fixed MOVABS flags 2016-03-23 21:54:43 +01:00
Nguyen Anh Quynh
a215661a8b Revert "rename appveyor.yml to .appveyor.yml"
This reverts commit 3abf305528.
2016-03-15 00:00:39 +08:00
Nguyen Anh Quynh
cd59b8f5dc rename appveyor.yml to .appveyor.yml 2016-03-15 00:00:13 +08:00
Nguyen Anh Quynh
a23f9d37ed add CS_OPT_UNSIGNED option to print immediate in unsigned form. only ARM is supported for now (issue #585) 2016-03-14 13:52:23 +08:00
Nguyen Anh Quynh
141804ab9a x86: more indentation 2016-03-14 11:16:33 +08:00
Nguyen Anh Quynh
c19b10098e x86: indentation 2016-03-14 11:14:57 +08:00
Nguyen Anh Quynh
7ef188f446 Merge branch 'next' of https://github.com/bSr43/capstone into bSr43-next 2016-03-14 11:10:32 +08:00
Nguyen Anh Quynh
017267e0ea fix some MSVC warnings 2016-03-08 11:08:20 +08:00
Nguyen Anh Quynh
1a4253b88f arm64: another attempt to fix MSVC warning 2016-03-08 01:07:36 +08:00
Nguyen Anh Quynh
15768eafb0 fix some compilation warnings reported by MSVC 2016-03-08 00:49:15 +08:00
Álvaro Felipe Melchor
58e8a93755 fix oob write in arch/AArch64/AArch64InstPrinter.c 2016-03-07 00:01:52 +01:00
fvrmatteo
4d1f51e68b x86: Fix access flags for SHR/SHL/SAL/SAR 2016-03-06 14:45:22 +01:00
fvrmatteo
33c216e8de x86: Fix access flags for SHR/SHL/SAL/SAR 2016-03-06 13:55:58 +01:00
fvrmatteo
e58f8783a2 x86: Fix access flags for SHR/SHL/SAL/SAR 2016-03-06 13:55:07 +01:00
fvrmatteo
7772716375 x86: Fix access flags for SHR/SHL/SAL/SAR 2016-03-06 13:10:14 +01:00
fvrmatteo
fe10f59de2 x86: Fix access flags for SHR/SHL/SAL/SAR 2016-03-06 13:09:18 +01:00
Nguyen Anh Quynh
885e488a2e arm64: LDR does not write to second operand 2016-03-01 12:40:11 +08:00
Nguyen Anh Quynh
0c2e8a2d60 arm64: LDR instructions do not read target register 2016-03-01 12:13:38 +08:00
Nguyen Anh Quynh
13ecd5f000 Merge branch 'next' of https://github.com/aquynh/capstone into next 2016-03-01 11:09:41 +08:00
Nguyen Anh Quynh
4b5dc21fa9 arm64: TBX & TBL have up to 4 registers in vector list 2016-03-01 11:05:55 +08:00
Nguyen Anh Quynh
aab7f63b02 arm64: fix some compilation warnings & indentation 2016-01-22 22:25:49 +08:00
Nguyen Anh Quynh
6de6425072 Merge branch 'arm64_reg_access' of https://github.com/pranith/capstone into pranith-arm64_reg_access 2016-01-19 17:22:04 +08:00
reyalpchdk
8b12b71cf5 Align thumb BLX immediate by discarding low bits 2016-01-16 21:32:09 -08:00
Nguyen Anh Quynh
2936bec1ff x86: fix issue #544 for AT&T syntax 2016-01-11 14:07:30 +08:00
Nguyen Anh Quynh
0b0d62ab0a x86: fix memory operand size of fbstp/fbld (issue #544) 2016-01-11 14:04:30 +08:00
Pranith Kumar
653827bf5a Add register access info for ARM64
Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
2016-01-06 15:54:10 -05:00
Ammar Ben Khadra
739505a945 Fix classification of ARM jump instructions
All jump instructions have been classified based on the direct
and indirect_branch flags.
2015-12-17 14:41:40 +01:00
Ammar Ben Khadra
db0a00f2c0 Fix classification of ARM jump instructions
All jump instructions have been classified based on the direct
and indirect_branch flags instead of explicitly stating ARM_GRP_JUMP.
2015-12-17 12:36:48 +01:00
Wesley M
133f6b3c89 Refactoring conditional directives for incomplete if conditions. 2015-12-07 21:28:30 -03:00
unknown
369a9cf955 Hope to have done it right. 2015-12-02 16:07:22 +01:00
Nguyen Anh Quynh
7fc5bc3b4b x86: print immediate of IN/OUT instructions in positive form. this fixes issue #554 2015-11-27 21:28:05 +07:00
Vincent Bénony
0e66373608 Fix access mode for variants of MOV instruction 2015-11-17 13:38:51 +01:00
Vincent Bénony
749b3405f7 Fix issues introduced by pull request #316. 2015-11-17 13:37:47 +01:00
Nguyen Anh Quynh
ed88b001f8 x86: XCHG instructions should read|write to both operands. this fixes issue #545 2015-11-16 19:50:26 +08:00
Nguyen Anh Quynh
59e301333b x86: print immediate operand of MOVABS in positive form. this fixes issue #541 2015-11-14 10:54:01 +08:00
Nguyen Anh Quynh
9d8e39e786 Revert "corrected x86 immediate sizes"
This reverts commit df9a2c3ce1, as discussed in https://github.com/aquynh/capstone/pull/527
2015-11-07 17:36:44 +08:00
Ben Vanik
722aec7800 Fixing a warning of size_t->int in VC++. 2015-11-05 18:42:08 -08:00
obs
df9a2c3ce1 corrected x86 immediate sizes 2015-11-04 13:50:09 +01:00
kokole
6d9573c56f LOOP* branch fix for full x64 instructions
Sorry, since the file is very big I didn't realize there was a 2nd list.
2015-10-18 19:42:31 +02:00
kokole
5a0e31ffd5 LOOP* instructions are conditional branches
LOOP, LOOPE and LOOPNE are basically conditional branches http://x86.renejeschke.de/html/file_module_x86_id_161.html
2015-10-18 15:13:25 +02:00
Nicolas PLANEL
626510c5e5 [M68K] avoid mixed declarations and code
Avoid mixed declarations and code reported by the gcc warning flag :
-Wdeclaration-after-statement.
Introduce new m68k_read_safe_16/32/64() method.
2015-10-12 21:31:16 +11:00
Nicolas PLANEL
97aca80830 [M68K] add const helper
Add some const aim to help inlining.

Signed-off-by: Nicolas PLANEL <nplanel@gmail.com>
2015-10-10 22:47:48 +11:00
Nicolas PLANEL
91f3cdb475 [M68K] move peek/read macros to real functions
Some compilers don't like statements in macro.
Anyway modern compiler should optimized (read inline)
2015-10-10 19:53:50 +11:00
Daniel Collin
997112d3d2 Removed a big chunk of unused stuff
* Cleaned up M68KDisassembler.h with legacy stuff from Musashi which isn't used at all.
* Removed M68KConf.h which isn't needed anymore.
* Made some functions static as they are now only local to the current file.
2015-10-10 19:30:04 +11:00
Nguyen Anh Quynh
cc1e14431c x86: print -0x8000000000000000 as 0x8000000000000000. this fixes issue #499 2015-10-09 14:38:06 +08:00
Nguyen Anh Quynh
5712440c53 Merge pull request #507 from nplanel/radare
fixup for Radare
2015-10-08 23:32:59 +08:00
Nicolas PLANEL
5f9257cfaa [M68K] use M68K line A for memory data poisoning
In case of out of bound access return a poison value to force to point to
d68000_invalid() opcode. This will force instruction_is_valid() to return
false and capstone will do skipdata.
Line A are more M68K standard invalid lines than 0x0808.
2015-10-08 22:27:59 +11:00
Nicolas PLANEL
af1d39d336 cleanup peek/read macros
Remove unused m68k_read_disassembler_8(), rework peek/read macros.

Signed-off-by: Nicolas PLANEL <nplanel@gmail.com>
2015-10-08 22:22:39 +11:00
Nguyen Anh Quynh
475e04da00 x86: fix the leftover prefixPresent[] 2015-10-08 15:58:52 +08:00
Nguyen Anh Quynh
29ff43fd6b x86: coding style 2015-10-08 15:53:44 +08:00
bughoho
8a39d79e10 fix comment 2015-10-08 15:53:34 +08:00
bughoho
7138044052 x86: add dedicated variables such as prefix2e, prefix36, prefix66, prefix67, etc 2015-10-08 15:53:17 +08:00
Nguyen Anh Quynh
da470f35b2 x86: coding style 2015-10-08 15:49:12 +08:00
Nicolas PLANEL
8daac3a164 Add boundary checker
Avoid reading bytes outside of the code section.
Trick by returning bad data (illegal instruction) to force capstone to skip data.

Signed-off-by: Nicolas PLANEL <nplanel@gmail.com>
2015-10-08 16:41:03 +11:00
Nicolas PLANEL
d1b5c3f384 cleanup : move the initialization of m68k_info
Simplify the code by moving the initialization of printer_info (m68k_info)
at the right place, in the module.init() function.

Signed-off-by: Nicolas PLANEL <nplanel@gmail.com>
2015-10-08 16:40:56 +11:00
Nicolas PLANEL
b9f66d63c9 [M68K] fixup increment pc only if the instruction_is_valid()
m68k_disassemble() should return the number of decoded bytes, aim to help
M68K_getInstruction() to return if it was a good instruction or not.

Signed-off-by: Nicolas PLANEL <nplanel@gmail.com>
2015-10-08 16:39:02 +11:00
Nicolas PLANEL
ee33bcf967 [M68K] fixup read/peak() address_line_mask
The correct implementation : addr = (address - base) & address_line_mask
2015-10-08 15:21:24 +11:00
bughoho
afdedac368 fix comment 2015-10-08 08:49:00 +08:00
Nicolas PLANEL
e661bd0cfc [M68K] Coverity fixup : remove old/dead code.
if(info) should be removed as it's an old part of the code that has been forgotten before merging.

Didn't cause any Bug as info is always true.
Related to issue #494

Signed-off-by: Nicolas PLANEL <nplanel@gmail.com>
2015-10-07 18:10:43 +11:00
bughoho
55cd95e497 add dedicated variables such as prefix2e, prefix36, prefix66, prefix67, etc 2015-10-07 14:47:24 +08:00
Nguyen Anh Quynh
3e1ecc2368 Merge branch 'm68k' into next 2015-10-06 21:54:43 +08:00
Nicolas PLANEL
7086018410 [M68K] set detail structure fields to default values
Avoid undefined behavior as we didn't define yet registers rd/wr/gr.
2015-10-06 15:02:30 +11:00
bughoho
5f600fcb30 fix:prefix 0x67 missed. 2015-10-06 11:49:11 +08:00
bughoho
915f5bb879 fix:prefix 0x67 missed. 2015-10-06 11:42:32 +08:00
Daniel Collin
25d2ea6ac6 Fixed MSVC warnings 2015-10-05 16:31:06 +02:00
Nguyen Anh Quynh
9d28a6b04e m68k: fix some compiler warnings 2015-10-05 21:54:36 +08:00
Nguyen Anh Quynh
9331ffc517 Merge branch 'print_info' of https://github.com/nplanel/capstone into nplanel-print_info 2015-10-05 21:50:54 +08:00
Nicolas PLANEL
e996c4a3bb [M68K] we don't need anymore cleaning printer_info is case of error
Will not change the behavior, cs_close() we cleanup printer_info for us.
2015-10-05 22:19:28 +11:00
Nicolas PLANEL
78b0722b1d [M68K] handle->printer_info need to be check
handle->printer_info need to be check, not instruction_info.
2015-10-05 22:03:20 +11:00
Nicolas PLANEL
44cc3d0c1e [M68K] printer_info need to be allocated only once
printer_info need to be allocated only once. cs_close() will cleanup for us.

Signed-off-by: Nicolas PLANEL <nplanel@gmail.com>
2015-10-05 21:57:01 +11:00
Nicolas PLANEL
d529ea0db7 [M68K] Use printer_info to share private info between disassembler and printer
Implementation is done by adding cs_m68k extension field in m68k_info.
The private m68k_info structure is allocated in M68K_getInstruction() (disassembly)
and free (if no error) by M68K_printInst() (printer).

Signed-off-by: Nicolas PLANEL <nplanel@gmail.com>
2015-10-05 20:19:45 +11:00
Nicolas PLANEL
ee75626661 [M68K] remove global dependency aim to have reentrant code
Remove the last global bytes :
static uint8_t* s_disassemblyBuffer;
static uint32_t s_baseAddress;

Introduce private struct m68k_info on the heap for future use.

Signed-off-by: Nicolas PLANEL <nplanel@gmail.com>
2015-10-05 19:26:37 +11:00
Nguyen Anh Quynh
58fe7cd068 m68k: more coding style 2015-10-05 16:05:17 +08:00
Nguyen Anh Quynh
8deb6d9eed m68k: rename M68Kconf.h to M68KConf.h for consistency 2015-10-04 21:59:03 +08:00
Nguyen Anh Quynh
0c49966482 m68k: code style for M68KInstPrinter.c 2015-10-04 21:51:09 +08:00
Nguyen Anh Quynh
812c3f1b32 Merge branch 'm68k' of https://github.com/emoon/capstone into emoon-m68k 2015-10-04 21:46:20 +08:00
Nguyen Anh Quynh
7d5badd641 m68k: more cleanup & fix code style 2015-10-04 21:45:50 +08:00
Daniel Collin
fb01d6d9b1 Print mnemonic even if detail info is disabled 2015-10-04 15:08:29 +02:00
Daniel Collin
e8a4e98181 Fixed missing includes + changed CMakeLists.txt
Changes due to renaming and moving of files
2015-10-04 14:22:58 +02:00
Daniel Collin
df5ff38758 Renamed incorrect named files 2015-10-04 14:14:07 +02:00
Daniel Collin
fc63aca84a Moved code from InstPrinter -> Disassembler 2015-10-04 14:12:59 +02:00
Daniel Collin
bc9bdf5a54 Renamed files
Renamed M68Kdasm -> M68KDisassembler
Renamed M68KDisassembler -> M68KInstPrinter
2015-10-04 14:05:21 +02:00
Nguyen Anh Quynh
481570462c m68k: code style 2015-10-04 17:40:46 +08:00
Nicolas PLANEL
3a64e583b6 [M68K] Multi instance support, reentrance support
Implement reentrance support by using an internal private structure
m68k_info.
Only g_instruction_table is still global as it's read only, and
will be initialized once, by the first instance.
Related to issue #494

typedef struct m68k_info {
	MCInst *inst;
	uint pc;        /* program counter */
	uint ir;        /* instruction register */
	uint type;
	unsigned int address_mask; /* Address mask to simulate address lines */
} m68k_info;

Signed-off-by: Nicolas PLANEL <nplanel@gmail.com>
2015-10-04 20:10:00 +11:00
Nguyen Anh Quynh
ac63d5b995 m68k: cleanup & code style 2015-10-04 14:34:51 +08:00
Nguyen Anh Quynh
f5cc222d2e fix bugs introduced by the last PR of @radare 2015-10-04 14:00:34 +08:00
Nguyen Anh Quynh
9af0bcfb7f Merge pull request #493 from radare/patch-3
Indentation fixes
2015-10-04 13:56:44 +08:00
Nguyen Anh Quynh
da731dfb1c Merge pull request #491 from nplanel/m68k-fixup
M68k fixup
2015-10-04 10:24:54 +08:00
radare
a776b54672 Indentation fixes
Remove spaces at the end of lines, remove unnecessary brackets and avoid declaring variables after the begining of the stackframe.
2015-10-03 20:01:14 +02:00
Nicolas PLANEL
858b8cb372 [M68K] CPUSH CINV should return INVALID opcode is case of error.
CPUSH CINV mnemonic should return INVALID is case of error.

Signed-off-by: Nicolas PLANEL <nplanel@gmail.com>
2015-10-03 21:39:42 +10:00
Daniel Collin
9bff8e2023 Fixed typo 2015-10-03 10:00:34 +02:00
Daniel Collin
09e4c3c9a8 Updated author 2015-10-03 10:00:00 +02:00
Daniel Collin
d40cba00e2 Added author 2015-10-03 08:45:56 +02:00
Daniel Collin
8680aa47fa Use NULL instead of 0 2015-10-03 08:44:46 +02:00
Daniel Collin
2ee675c10a This adds M68K support to Capstone 2015-10-02 20:47:00 +02:00
bughoho
edd7659756 https://github.com/aquynh/capstone/issues/483 2015-09-30 11:09:52 +08:00
bughoho
ec31ea84ee https://github.com/aquynh/capstone/issues/483 2015-09-28 15:08:25 +08:00
Nguyen Anh Quynh
7b714c64dc x86: fix operand sizes of LGDT/LIDT/SGDT/SIDT in 16bit mode 2015-09-08 22:36:09 +08:00
Nguyen Anh Quynh
4337a77064 x86: fix issue #470 & #471 reported by Ruslan Kabatsayev 2015-09-08 22:14:35 +08:00
Nguyen Anh Quynh
ebf0041e6a arm: another fix for #446. bug reported by @uxmal 2015-08-19 22:36:37 +08:00
Nguyen Anh Quynh
ddf5488d36 arm: another fix for #446. bug reported by @uxmal 2015-08-19 22:36:09 +08:00
Nguyen Anh Quynh
64a1e31519 x86: fix the operand size of CALLpcrel16/JMP_2. bug reported by Ruslan Kabatsayev 2015-08-19 17:07:29 +08:00
Nguyen Anh Quynh
94874ed436 x86: fix #456 for AT&T syntax 2015-08-19 09:37:24 +08:00
Nguyen Anh Quynh
609e342fef x86: another attempt to fix #456 2015-08-19 09:34:56 +08:00
Nguyen Anh Quynh
e5a67f5a04 x86: handle some tricky 16bit code in issue #456 2015-08-19 01:31:58 +08:00
Nguyen Anh Quynh
0dde6707b9 x86: another attempt for #456 2015-08-16 18:43:49 +08:00
Nguyen Anh Quynh
0e45cd2904 x86: more AT&T fixes for #458 reported by Ruslan Kabatsayev 2015-08-15 23:51:36 +08:00
Nguyen Anh Quynh
e075bb5f7f x86: more fix for #458 2015-08-15 17:03:48 +08:00
Nguyen Anh Quynh
c3871eaa5a x86: fix issue #458 reported by Ruslan Kabatsayev 2015-08-15 15:05:27 +08:00
Nguyen Anh Quynh
4243d21a68 x86: fix issue #456 reported by Ruslan Kabatsayev 2015-08-15 14:46:51 +08:00
Nguyen Anh Quynh
ed43e241c5 arm: fix issue #459 reported by Ahmed Garhy 2015-08-15 14:20:23 +08:00
Nguyen Anh Quynh
2202a0d40d arm: fix issue #459 reported by Ahmed Garhy 2015-08-15 14:16:39 +08:00
Nguyen Anh Quynh
9899510e01 x86: fix target addresses of CALL/JMP rel16. bug reported by Ruslan Kabatsayev 2015-08-15 13:25:13 +08:00
Nguyen Anh Quynh
2a3635d59b x86: fix target addresses of CALL/JMP rel16. bug reported by Ruslan Kabatsayev 2015-08-15 13:20:04 +08:00
Nguyen Anh Quynh
fe05cb316f x86: REPNE prefix is valid for LODSD. this fixes the bug reported by Ruslan Kabatsayev 2015-08-14 22:09:07 +08:00
Nguyen Anh Quynh
96ba58fd34 x86: REPNE prefix is valid for LODSD. this fixes the bug reported by Ruslan Kabatsayev 2015-08-14 22:08:41 +08:00
Nguyen Anh Quynh
b4c4d4506f x86: some AT&T instructions wrongly add one more operand in front (index 0). this fixes the issue reported by Ruslan Kabatsayev 2015-08-14 22:05:05 +08:00
Nguyen Anh Quynh
bbc33d6d63 x86: repne prefix can come with INS/OUTS/LODS instructions. bug reported by Ruslan Kabatsayev 2015-08-14 21:34:26 +08:00
Nguyen Anh Quynh
b0b5fb8db1 x86: repne prefix can come with INS/OUTS/LODS instructions. bug reported by Ruslan Kabatsayev 2015-08-14 21:34:09 +08:00
Nguyen Anh Quynh
12bd773d5e x86: rep* prefix read/write *CX register. bug reported by Ruslan Kabatsayev 2015-08-14 16:59:07 +08:00
Nguyen Anh Quynh
c0f3fad4a5 x86: fix operand size of farjmp/farcall. bug reported by Ruslan Kabatsayev 2015-08-14 10:46:55 +08:00
Nguyen Anh Quynh
1c6309cdb8 x86: fix operand size of farjmp/farcall. bug reported by Ruslan Kabatsayev 2015-08-14 10:46:42 +08:00
Nguyen Anh Quynh
d57786260a x86: loope/loopne read EFLAGS. bug reported by Ruslan Kabatsayev 2015-08-14 08:57:58 +08:00
Nguyen Anh Quynh
6482ca156a x86: loope/loopne read EFLAGS. bug reported by Ruslan Kabatsayev 2015-08-14 08:57:34 +08:00
Nguyen Anh Quynh
d4ce57bfda sparc: fix POPC instruction. bug reported by @zonkzonk & @pancake 2015-08-14 00:27:07 +08:00
Nguyen Anh Quynh
751f84f086 x86: LOOP* instructions should read/write *CX registers. bug reported by Ruslan Kabatsayev 2015-08-14 00:16:26 +08:00
Nguyen Anh Quynh
5e318f6bab x86: LOOP* instructions should read/write *CX registers. bug reported by Ruslan Kabatsayev 2015-08-14 00:05:12 +08:00
Nguyen Anh Quynh
7279f319fa x86: fix operand size for farjmp/farcall instructions. bug reported by Ruslan Kabatsayev 2015-08-13 23:47:00 +08:00
Nguyen Anh Quynh
c0bf5feac9 x86: fix selector part of farjmp/farcall instructions. bug reported by Ruslan Kabatsayev 2015-08-13 23:38:01 +08:00
Nguyen Anh Quynh
9b381dc307 x86: print ptr16 part of farjmp/farcall in positive form. issue reported by Ruslan Kabatsayev 2015-08-13 21:36:27 +08:00
Nguyen Anh Quynh
0088d2a318 sparc: fix POPC instruction. issue reported by @zonkzonk & @pancake 2015-08-13 19:13:40 +08:00
Nguyen Anh Quynh
8047fccb49 x86: fix need_zero_prefix() for MASM syntax 2015-08-10 00:03:21 -07:00
Nguyen Anh Quynh
62918abb60 support new syntax CS_OPT_SYNTAX_MASM for X86 2015-08-09 10:34:19 -07:00
Zach Riggle
1e882cf542 Add ARM64_GRP_INT to AArch64 for SVC instruction 2015-07-27 12:42:06 -04:00
Nguyen Anh Quynh
1757603fb1 x86: truncat immediate for non-64bit. this fixes the disassembly of the code e9e9eeeeee in 32bit mode 2015-07-11 10:01:24 +08:00
Nguyen Anh Quynh
a05d82a55f x86: truncat immediate for non-64bit. this fixes the disassembly of the code e9e9eeeeee in 32bit mode 2015-07-11 10:00:29 +08:00
Nguyen Anh Quynh
fec23ae531 fix autogen_x86imm.py to handle some special instructions. this fixed issue #411 reported by @pancake 2015-06-30 20:49:55 +08:00
Nguyen Anh Quynh
de6fa911b5 skip _LOCK_ instructions for augoten_x86.imm.py 2015-06-28 13:14:36 +08:00
Nguyen Anh Quynh
de8dd26780 x86: handle operand size properly for immediate operands 2015-06-28 12:18:13 +08:00
Nguyen Anh Quynh
1304fc225a mips: remove alias_insns[] 2015-06-22 15:48:45 +08:00
Nguyen Anh Quynh
517a0fe68e mips: remove alias_insns map 2015-06-22 15:30:25 +08:00
Nguyen Anh Quynh
a25e41b76c mips: delete the alias map SUBU to NEGU. bug reported by @joelpx 2015-06-22 11:21:49 +08:00
Nguyen Anh Quynh
2ad9eb2a43 mips: delete the alias map SUBU to NEGU. bug reported by @joelpx 2015-06-22 11:21:14 +08:00
Nguyen Anh Quynh
459556c769 x86: fix immediate operand of AND/OR/XOR instructions. bug reported by @yegord 2015-06-20 10:56:54 +08:00
w4kfu
e3303c1d8c add CS_AC_READ for X86_CALL16r, X86_CALL32r, X86_CALL64r, X86_JMP16r, X86_JMP32r, X86_JMP64r 2015-06-19 17:19:27 +02:00
Nguyen Anh Quynh
3dcbc07e04 mips: remove dead code reported by Coverity 2015-06-17 14:05:46 +08:00
Nguyen Anh Quynh
2f6ea60772 mips: return Fail on assert failure in MipsDisassembler.c 2015-06-16 14:09:25 +08:00
Nguyen Anh Quynh
4a273b7e92 mips: return Fail on assert() that we ignored before 2015-06-16 14:06:34 +08:00
Nguyen Anh Quynh
3a46e85ad2 ppc: return failure when Base>=32 in decodeMemRIOperands() 2015-06-16 14:03:22 +08:00
Nguyen Anh Quynh
761c9c84a4 ppc: return failure when Base>=32 in decodeMemRIOperands() 2015-06-16 14:03:07 +08:00
Nguyen Anh Quynh
011bf8bf84 ppc: handle invalid CR bits with more than 8 zeros in decodeCRBitMOperand(). bug reported by @felixgr 2015-06-16 13:59:36 +08:00
Nguyen Anh Quynh
7ae9c9d9d3 ppc: handle invalid CR bits with more than 8 zeros in decodeCRBitMOperand(). bug reported by @felixgr 2015-06-16 13:59:10 +08:00
Nguyen Anh Quynh
c009dc6dbf mips: fix OOB issue in DecodeRegListOperand() reported by @felixgr 2015-06-16 12:29:33 +08:00
Nguyen Anh Quynh
e5aa75131b x86: treat prefix-only sequences of bytes as invalid code. this fixes a NDP reported by @felixgr 2015-06-16 11:57:45 +08:00
Nguyen Anh Quynh
0e9da8736a x86: treat prefix-only sequences of bytes as invalid code. this fixes a NDP reported by @felixgr 2015-06-16 11:57:22 +08:00
Nguyen Anh Quynh
53a059b581 fix warnings on some unused functions when CAPTONE_DIET mode is turn on 2015-06-08 21:51:19 +08:00
Nguyen Anh Quynh
fb18a93f73 ppc: avoid potential memleak issue when alias mnemonic is empty in PPC_printInst() 2015-06-06 19:11:25 +08:00
Nguyen Anh Quynh
6183e381f9 ppc: avoid potential memleak issue when alias mnemonic is empty in PPC_printInst() 2015-06-06 18:06:38 +08:00
Nguyen Anh Quynh
5cb356061e ppc: make sure alias mnememonic is not empty in PPC_printInst() 2015-06-06 16:10:07 +08:00