Commit Graph

37 Commits

Author SHA1 Message Date
Nguyen Anh Quynh 0b874b2fca cleanup 2018-06-22 01:03:26 +08:00
Alberto Garcia Illera 5f173b0562 prefix cs_ to global variables to avoid link problems (#1102) 2018-03-19 22:23:09 +08:00
Richard Henderson 22ead3e0bf 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
Travis Finkenauer 8998a3a1d5 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
Nguyen Anh Quynh 8bd0fdb992 arm: reduce the size of ARM_ITStatus.ITStates[] to 8 2015-06-03 22:25:59 +08:00
Nguyen Anh Quynh 650f96ce43 add new API cs_group_name() to return group name in string, given the group id 2014-07-08 08:59:27 +08:00
Nguyen Anh Quynh 1085073f8f x86: remove disp_size, imm_size, op_size. add size to each operand. thanks Gabriel Quadros for some nice ideas 2014-06-18 12:16:24 +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 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 d3ffe37c47 API: support SKIPDATA option (off by default) 2014-04-09 23:49:30 +08:00
Nguyen Anh Quynh 2ff665ad4a arm: support asm syntax CS_OPT_SYNTAX_NOREGNAME to print out registers with numbers (ex: 'r11' rather than 'fp') 2014-03-11 00:18:50 +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 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 1acfd0b883 move insn_cache into cs_struct to gurantee thread-safe 2014-01-06 10:56:59 +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 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 ae3649ff71 rename some C header guards to be without _ as prefix to follow naming convention of C language. suggested by Markus Elfring 2014-01-02 13:15:07 +08:00
Nguyen Anh Quynh 19b0de3c8d moving static doing_mem variable into cs_struct to guarantee thread-safe when handling memory operands 2013-12-31 22:40:04 +08:00
Nguyen Anh Quynh 42c6b1acc7 initial support for PPC 2013-12-30 00:15:25 +08:00
Nguyen Anh Quynh 0755282f04 reduce MAX_ARCH to save some memory. this is for internal usage only, so we can increase it in future if needed without having any compatibility issue 2013-12-22 11:13:07 +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 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 a01d1546d6 x86: handle outs instruction in 16bit mode 2013-12-12 15:54:30 +08:00
pancake f0e4eed89d Use const on all read-only buffers 2013-12-11 22:14:42 +01:00
Nguyen Anh Quynh 2215895ebc mips: no need cs_struct.micro_mips, as we can get that from cs_struct.mode 2013-12-11 18:11:49 +08:00
Nguyen Anh Quynh a253c7a8e8 x86: map EFLAGS to string of 'flags', 'eflags' or 'rflags' depending on current CS_MODE 2013-12-09 10:26:18 +08:00
pancake c04f873791 Use uint64_t instead of size_t for addresses 2013-12-03 02:51:46 +01:00
Nguyen Anh Quynh 7c7a8bc523 arm: move static variable ITBlock to cs_struct, so make arm code truly thread-safe 2013-12-02 13:16:44 +08:00
Nguyen Anh Quynh b42a657873 change cs_disasm() and cs_disasm_dyn() to be portable API. fix related code using these API 2013-11-29 17:40:07 +08:00
Nguyen Anh Quynh 3eb9ac9bb9 mingw doesnt accept .errno of cs_struct. this fixes make it happy, and enable Windows cross-compile again 2013-11-27 15:24:47 +08:00
Nguyen Anh Quynh 26ee41aa67 initial import 2013-11-27 12:11:31 +08:00