Nguyen Anh Quynh
9786566aaa
msvc: fix some Nmake warnings
2014-05-28 14:33:32 +08:00
Nguyen Anh Quynh
c80d840ffc
add XCore architecture
2014-05-26 23:02:48 +08:00
Nguyen Anh Quynh
6456481508
x86: add immediate operand (1) for SHL/SHR/ROR/ROL/SAR/SAL in detail mode & Intel syntax
2014-05-19 16:46:31 +08:00
Nguyen Anh Quynh
8c2e2db84e
fix an warning on unused local variable in fill-insn() when CAPSTONE_DIET is defined
2014-05-14 07:32:56 +08:00
Nguyen Anh Quynh
bb0744df5d
do not initialize some local vars unnecessarily. this problem was introduced when we fixed C89 issues for MSVC
2014-05-12 13:41:49 +08:00
Axel 0vercl0k Souchet
84fecf2f99
added the debug configuration + correct the macro name for consistency
2014-05-10 09:49:29 +01:00
Axel 0vercl0k Souchet
605faf1db9
moved the hardcoded macros in the vcproj & just disable the warning for the crt
2014-05-09 20:40:00 +01:00
Nguyen Anh Quynh
42706a39e2
indentation with tab
2014-05-09 07:33:35 +08:00
Axel 0vercl0k Souchet
779d4c75d9
first changes to get a successfully compiled version of capstone on VS2012
2014-05-08 23:44:49 +01:00
Giovanni Condello
95657e0ca9
cs.c : Conform to original indentation rules
2014-05-07 17:31:27 +02:00
Giovanni Condello
a715df17a9
Do not access instructions details if the instruction is marked as SKIPDATA or if the details are NULL
...
Fixes issues #105
2014-05-07 17:25:38 +02:00
Nguyen Anh Quynh
1dbc9593aa
x86: use strncpy() to update instruction mnemonic
2014-05-07 14:14:07 +08:00
Nguyen Anh Quynh
a5ffdc3a80
x86: properly handle LOCK/REP in the core, so remove buch of hacks
2014-05-07 08:25:24 +08:00
Nguyen Anh Quynh
6023ef7843
Disassembler -> Disassembly
2014-04-29 11:21:04 +08:00
Nguyen Anh Quynh
2cff6f61fc
x86: handle instructions with LOCK/REP/REPNE prefix after other prefixes. bear with this until we have a better approach
2014-04-28 11:19:44 +08:00
Nguyen Anh Quynh
a88c1164bf
move the macro MIN to utils.h
2014-04-27 13:38:04 +08:00
Nguyen Anh Quynh
42288ac4e3
SKIPDATA: add 1 more argument to callback function pointing to the input buffer of cs_disasm_ex()
2014-04-14 14:53:13 +08:00
Nguyen Anh Quynh
11ec8817dc
core: add CS_ERR_SKIPDATA error code to report when code access irrelevant info in SKIPDATA mode
2014-04-10 17:20:01 +08:00
Nguyen Anh Quynh
07ffd64c38
SKIPDATA: @offset of callback function should indicate the position of examining byte in input buffer
2014-04-10 14:36:08 +08:00
Nguyen Anh Quynh
a89383e81f
number of bytes skipped by SKIPDATA option depends on arch
2014-04-10 11:53:46 +08:00
Nguyen Anh Quynh
c75a909371
rename SKIPDATA_MNEM to .byte to make it different from normal instructions
2014-04-10 10:26:49 +08:00
Nguyen Anh Quynh
d3ffe37c47
API: support SKIPDATA option (off by default)
2014-04-09 23:49:30 +08:00
Nguyen Anh Quynh
59b5489d8e
x86: rename X86_COMPACT to X86_REDUCE. suggested by Pancake
2014-03-27 10:54:44 +08:00
Nguyen Anh Quynh
9518148e6f
add X86_COMPACT option. also add CS_SUPPORT_X86_COMPACT. made Python support this change
2014-03-25 23:20:41 +08:00
Nguyen Anh Quynh
48a14ca4ce
add SystemZ arch
2014-03-23 08:35:45 +08:00
Nguyen Anh Quynh
05e27138ae
core: add Sparc arch
2014-03-10 11:58:57 +08:00
Nguyen Anh Quynh
5ee2b45518
core: reduce insn_cache's size when USE_SYS_DYN_MEM, not on CAPSTONE_DIET
2014-03-07 08:40:35 +08:00
Nguyen Anh Quynh
034a7487c0
core: C99 fix for cs_disasm_ex()
2014-03-06 22:40:08 +08:00
Nguyen Anh Quynh
472a4a4121
core: reduce default INSN_CACHE_SIZE to 32 to reduce stack memory variable size @insn_cache
2014-03-06 09:13:04 +08:00
Nguyen Anh Quynh
a836b75d30
core: reduce INSN_CACHE_SIZE for diet engine to reduce stack variable size. this might fix a crash for OSX kernel. issue reported by Enzo Matsumiya
2014-03-06 03:36:03 +08:00
Nguyen Anh Quynh
c46c35d3c7
core try to initialize archs as soon as we can by calling archs_enable() everywhere possible
2014-03-05 00:21:53 +08:00
Nguyen Anh Quynh
c8e0785cb6
add some more comments regarding invalidating @handle of cs_close()
2014-02-28 09:38:11 +08:00
Nguyen Anh Quynh
fbe10a55c0
simplify cs_close() when freeing @printer_info, making it future proof for future arch
2014-02-27 23:59:08 +08:00
Nguyen Anh Quynh
ef3d04d75b
fix a bug in cs_close(): improper check on handle value
2014-02-27 23:42:49 +08:00
Nguyen Anh Quynh
226d7dca64
change API cs_close() to take pointer to handle as argument. this lets us invalidate the closed handle
2014-02-27 22:20:39 +08:00
Nguyen Anh Quynh
48d583281c
cs_support(): typecast query to uint before comparing with CS_ARCH_ALL. this is to avoid potential problems in future when we add more query types
2014-02-27 13:56:01 +08:00
Nguyen Anh Quynh
5848aaafb2
Revert "cs_disasm_ex() should verify handle->disasm() to catch the issue that this API is still called after cs_close(). bug reported by Gul"
...
This reverts commit 2edef8f27c
.
2014-02-27 11:10:41 +08:00
Nguyen Anh Quynh
2edef8f27c
cs_disasm_ex() should verify handle->disasm() to catch the issue that this API is still called after cs_close(). bug reported by Gul
2014-02-27 09:54:16 +08:00
Nguyen Anh Quynh
f7cdbdf501
add CS_ERR_DIET error code to report information irrelevant in diet engine
2014-02-24 16:47:36 +08:00
Nguyen Anh Quynh
b2870e4c4c
API: extend cs_support() to allow query on diet mode. add CS_SUPPORT_DIET at the same time
2014-02-22 23:41:16 +08:00
Nguyen Anh Quynh
fc83a439e5
add diet compile option (CAPSTONE_DIET option in config.mk). This reduces binary size by around 40%
2014-02-22 23:26:27 +08:00
Nguyen Anh Quynh
a86a1279ff
Merge branch 'msvc0' into next1
2014-02-17 23:11:58 +08:00
Nguyen Anh Quynh
4f220287d1
add CS_ERR_VERSION to report error when binding version is different from core's API version
2014-02-09 00:19:15 +08:00
Nguyen Anh Quynh
8ce50e4b49
x86: fix the returned value of cs_disasm_ex() when we have 2 consecutive prefixed instructions. also fix a mem leak bug
2014-01-27 18:15:28 +08:00
Nguyen Anh Quynh
94020d8478
x86: fix the issue with prefix instruction declared in 2.0's RELEASE_NOTES
2014-01-25 14:22:15 +08:00
Nguyen Anh Quynh
743ead0442
fix a bug in cs.c introduced in the last port between branches
2014-01-23 23:47:15 +08:00
Nguyen Anh Quynh
a82a0890a6
more more fixes on C coding style
2014-01-23 23:42:40 +08:00
Alex Ionescu
46018db884
Initial set of changes to support building with MSVC 2013. Right now there's a bunch fo assumptions in the .vcxproj file and some things are not as clean as they should be, but it does build a full build and works (at least the x86 side). The point of this initial checkpoint is to make sure that nothing breaks on the GCC side, that everyone is ok with the changes to the source (or if better fixes/typing can be done).
2014-01-22 09:45:00 -08:00
Nguyen Anh Quynh
11b05193ec
reset prev_prefix at the entry of cs_disasm_ex(). this fixes a nasty segfault bug
2014-01-22 11:06:34 +08:00
Nguyen Anh Quynh
fd2814b71a
reset prev_prefix at the entry of cs_disasm_ex(). this fixes a nasty segfault bug
2014-01-22 11:04:25 +08:00
Nguyen Anh Quynh
c34959b588
x86: proper calculation for the trailing instruction in total cache. issue reported by Pancake
2014-01-22 09:47:46 +08:00
Nguyen Anh Quynh
c36ce95d4a
x86: proper calculation for the trailing instruction in total cache. issue reported by Pancake
2014-01-22 09:46:42 +08:00
Nguyen Anh Quynh
06b3c05e20
cs_open() should return error on invalid mode
2014-01-21 15:27:19 +08:00
Nguyen Anh Quynh
53fc5c103a
cs_open() should return error on invalid mode
2014-01-21 15:26:02 +08:00
Nguyen Anh Quynh
7772d859af
x86: fix known issue with prefix by combining with previous prefix instruction. this is not perfect, but good enough for now
2014-01-21 11:49:25 +08:00
Nguyen Anh Quynh
c272e9d000
do not use constructor to enable archs, so code is more portable. suggested by Alex Ionescu
2014-01-19 12:03:22 +08:00
Nguyen Anh Quynh
24e122778c
cs_op_count() & cs_op_index() report CS_ERR_DETAIL when detail = OFF
2014-01-15 21:27:23 +08:00
Nguyen Anh Quynh
edeeb04a1a
make vsnprintf() user-defined function pointer, which is passed in via the same CS_OPT_MEM option like malloc/calloc etc
2014-01-15 20:44:03 +08:00
Nguyen Anh Quynh
a8eb7a5ca5
rename memory function pointer types to have cs_ prefix. also rename internal function pointers my_* to have cs_mem_ prefix - suggested by Pancake
2014-01-11 12:55:31 +08:00
Nguyen Anh Quynh
d159a03f23
tests: proper extensions for newly added static executables
2014-01-09 15:49:44 +08:00
Nguyen Anh Quynh
625b5bcfee
comment for the trick to enable constructors in static lib & fix coding style
2014-01-09 14:33:56 +08:00
danghvu
b33bd2cb13
Update static fix: no need to call dummy function
2014-01-09 12:22:56 +07:00
danghvu
ad44e8178e
Minor bug
2014-01-09 11:17:20 +07:00
danghvu
701b850af9
Fix: bug that static link does not know constructor
2014-01-09 11:14:40 +07:00
Nguyen Anh Quynh
39b812d9e9
switch detail to be CS_OPT_OFF by default
2014-01-07 23:36:26 +08:00
Nguyen Anh Quynh
9fac512efc
no longer need to free insn_cache for each arch: simply do it from cs_close()
2014-01-07 10:56:04 +08:00
Nguyen Anh Quynh
1acfd0b883
move insn_cache into cs_struct to gurantee thread-safe
2014-01-06 10:56:59 +08:00
Nguyen Anh Quynh
8f7ab4981d
fix a potential memleak in cs_open() - happened when arch is invalid/unsupported
2014-01-06 09:52:57 +08:00
Nguyen Anh Quynh
c52352d6d9
add new error code CS_ERR_MEMSETUP to report error when user-defined dynamic mem management is uninitialized
2014-01-06 09:06:30 +08:00
Nguyen Anh Quynh
59492c2688
enable system's my_malloc/calloc/realloc/free via compile time option
2014-01-05 23:41:31 +08:00
Nguyen Anh Quynh
c7404075ff
move internal memory management declarations from utils.h to cs_priv.h
2014-01-05 11:35:47 +08:00
Nguyen Anh Quynh
24bf0d9079
add new option CS_OPT_MEM for cs_option(): this enable user-defined dynamic memory management. idea proposed by Pancake
2014-01-05 11:19:04 +08:00
Nguyen Anh Quynh
34f96389a9
add new API: cs_strerror() return a string describing a given error code. this should be used together with cs_errno()
2014-01-03 22:49:07 +08:00
Nguyen Anh Quynh
ee143c8c6c
fix a crashed bug in cs_close(): call destroy function before freeing handle's memory
2014-01-03 21:51:59 +08:00
Nguyen Anh Quynh
b265406960
cache insns for fast lookup in mapping.c. based on the idea of Dang Hoang Vu
2014-01-03 17:08:58 +08:00
Nguyen Anh Quynh
42c6b1acc7
initial support for PPC
2013-12-30 00:15:25 +08:00
Nguyen Anh Quynh
b90cb993ed
API cs_version_ex(): since we already broke API compatibility, we are not afraid to break cs_version() too. this replaces cs_version() with cs_version_ex()
2013-12-28 13:59:09 +08:00
Nguyen Anh Quynh
04c19beefe
rename API cs_disasm_dyn() to cs_disasm_ex(), and intentionally breaks compatibility with 1.0
2013-12-25 13:26:22 +08:00
Nguyen Anh Quynh
4fe224b1ed
change API cs_disasm_dyn(): break cs_insn into 2 structures, and put all details into new structure cs_detail. this break API compatibility
2013-12-24 16:49:36 +08:00
Nguyen Anh Quynh
b880678a25
old cs_version() and new cs_version() are not compatible, so revert old one, and create new separate API cs_version_ex()
2013-12-22 15:20:07 +08:00
Nguyen Anh Quynh
0877747bcd
cs_version() can accept NULL arguments. this is useful if you dont care about major/minor, but only want to get returned combined version
2013-12-22 14:16:28 +08:00
Nguyen Anh Quynh
9a197b35a1
nullify handle when cs_open() fails. besides, return CS_ERR_ARCH when arch is unsupported
2013-12-22 13:41:38 +08:00
Nguyen Anh Quynh
58747adcbb
to be sure, initialize arch_init[] with NULL
2013-12-22 13:37:13 +08:00
Nguyen Anh Quynh
d345839bce
support cs_option() for arm64 module
2013-12-22 11:10:56 +08:00
Nguyen Anh Quynh
39a42eddfb
Change the way of supporting arch modularization
...
- Always use libapstone.so as library name, no matter which archs are compiled in.
- Add new API cs_support() to check if a particular arch is supported.
- Change cs_version(): return hexical version which encodes both major & minor version.
the return value can be comparable.
- Bump API version to 1.1
2013-12-22 10:40:58 +08:00
Nguyen Anh Quynh
f185180436
cleaner implementation for arch modularization
2013-12-21 12:16:47 +08:00
Nguyen Anh Quynh
31baeb570f
Merge branch 'next' of https://github.com/aquynh/capstone into module
2013-12-21 10:01:02 +08:00
Nguyen Anh Quynh
7d02c92de8
code style: more fix for cs.c
2013-12-21 09:59:31 +08:00
Nguyen Anh Quynh
7008356bc5
change cs_insn struct to follow the commit 18103e4a
. fixed Python & Java bindings accordingly. attn: bindings
2013-12-20 22:02:20 +08:00
danghvu
629a6d8901
Rename arch.h -> module.h
2013-12-20 01:44:17 -06:00
danghvu
0b6ea044ff
Move cs_option dispatch into arch specific
2013-12-19 23:07:26 -06:00
danghvu
2b19296439
Fix indentation problem
2013-12-19 22:40:28 -06:00
danghvu
34d49d935b
Support compilation of individual arch
2013-12-19 12:10:24 -06:00
Nguyen Anh Quynh
1bdb23a76d
add CS_OPT_MODE option. this allows us to change engine's mode at run-time
2013-12-20 00:04:26 +08:00
Nguyen Anh Quynh
9a0dbabc23
simplify checking on condition to end the loop in cs_disasm(). issue spotted by Pancake
2013-12-15 22:25:58 +08:00
Nguyen Anh Quynh
1f44928d97
mips: fix for micromips
2013-12-15 14:04:59 +08:00
Nguyen Anh Quynh
4d3e852fbb
detail option: provide instruction id even when detail option is OFF
2013-12-14 10:45:09 +08:00
Nguyen Anh Quynh
a209e67f8a
support to turn on/off building instruction details
2013-12-14 00:23:41 +08:00
Nguyen Anh Quynh
e5c658c407
move PKG_* away from cs.c to CONFIG
2013-12-13 09:24:41 +08:00
Nguyen Anh Quynh
a01d1546d6
x86: handle outs instruction in 16bit mode
2013-12-12 15:54:30 +08:00