Commit Graph

38 Commits

Author SHA1 Message Date
Richard Henderson
936dca0e2d Constify backends (#1549)
* Constify registerinfo.py output

Remove two conditionals separating identical bits of code.
Add "const" markup to MCRegisterDesc and MCRegisterClass.

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify instrinfo-arch.py output

In this case, do not actively strip const.

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the AArch64 backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the EVM backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify M680X backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify M68K backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the Mips backend

The Mips backend has not been regenerated from LLVM recently,
and there are more fixups required than I'd like.  Just apply
the fixes to the tables by hand for now.

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the Sparc backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the TMS320C64x backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the X86 backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the XCore backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify systemregister.py output

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the ARM backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the PowerPC backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the MOS65XX backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the SystemZ backend

The mapping of system register to indexes is easy to
generate read-only.  Since we know the indexes are
between 0 and 31, use uint8_t instead of unsigned.

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the WASM backend

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify cs.c

Signed-off-by: Richard Henderson <rth@twiddle.net>

* Constify the BPF backend

Signed-off-by: Richard Henderson <rth@twiddle.net>
2019-12-23 20:30:57 +08:00
Nguyen Anh Quynh
c829a8bfd4 x86: fix is64Bit(), so it access insns array after ID lookup 2019-02-26 16:31:02 +08:00
Nguyen Anh Quynh
3dcdcfa713 sync with LLVM 7.0.1. X86 is first 2019-02-26 15:19:51 +08:00
Nguyen Anh Quynh
76c1c3c4e9 merge next to master 2018-07-20 12:36:50 +08:00
Nguyen Anh Quynh
97f34c87c7 x86: X86_immediate_size() returns uint8 2018-07-04 23:02:22 +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
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
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
de8dd26780 x86: handle operand size properly for immediate operands 2015-06-28 12:18:13 +08:00
remittor
f59b3a759b [x86] Fix decode opcode A0 and A1 (movabs)
Bug:
  00491AD0  A0 11 12 13 14            mov al, byte ptr [0x14131211]
        Prefix:0x00 0x00 0x00 0x00
        Opcode:0xa0 0x00 0x00 0x00
        addr_size: 4
        op_count: 1
                operands[0].type: MEM
                        operands[0].mem.disp: 0x14131211
                operands[0].size: 1
2015-04-15 13:44:11 +03:00
Nguyen Anh Quynh
efffe787d1 Add new API and start to provide access information for instruction operands
- New API cs_regs_access() that provide registers being read & modified by instruction

- New field cs_x86_op.access provides access info (READ, WRITE) for each operand

- New field cs_x86.eflags provides EFLAGS affected by instruction

- Extend cs_detail.{regs_read, regs_write} from uint8_t to uint16_t type
2015-03-25 15:02:13 +08:00
Nguyen Anh Quynh
a81bf4247c x86: add new field @xop_cc to struct @cs_x86 2015-03-07 13:37:32 +08:00
Nguyen Anh Quynh
bfcaba5851 2015 2015-03-04 17:45:23 +08:00
pancake
9c10ace558 Make pkg-config and source consistent with installation 2015-02-24 05:03:04 +01:00
Nguyen Anh Quynh
9578185ad8 x86: add missing operands in detail mode for 'IN/OUT reg, reg' instructions. bug reported by Andrew Wesie 2014-12-12 11:25:12 +08:00
Nguyen Anh Quynh
ea3c089591 some simple optimizations for speed. this improves performance about 5% 2014-10-02 10:17:55 +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
1a66fecdbc x86: support avx_sae & avx_rm in cs_x86 struct. this also updates Python & Java bindings following the core's change 2014-06-26 12:09:15 +08:00
Nguyen Anh Quynh
92a3d4c079 x86: add AVX's zero_opmask to cs_x86_op struct. updated Python & Java bindings for this change 2014-06-25 23:10:39 +08:00
Nguyen Anh Quynh
4c5eabc32b x86: support SSE_CC & AVX_CC in cs_x86 struct. this also updates Python & Java bindings 2014-06-24 23:50:41 +08:00
Nguyen Anh Quynh
0d716450fc x86: add avx_bcast to cs_x86_op to support AVX512 instructions. this also updates Python & Java binding 2014-06-24 22:51:56 +08:00
Nguyen Anh Quynh
14ba46bfab x86: add segment to x86_op_mem struct. this fixes a bug in generating detail for instructions with segment override. bug reported by Sean Heelan. 2014-06-24 14:32:01 +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
d69f9ded5b x86: delete dead code 2014-05-28 12:39:11 +08:00
Nguyen Anh Quynh
04f2ec6d0f cleanup redundant headers included 2014-05-27 10:39:04 +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
288d6b3c8a x86: properly handle lock/rep prefixes when DIET option is enable 2014-05-07 12:26:55 +08:00
Nguyen Anh Quynh
45c77aeadd x86: handle tricky instructions related to MULPD at http://habrahabr.ru/company/intel/blog/200658/ 2014-05-07 11:39:41 +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
17874d084e x86: handle NOP instruction 0f18* 2014-04-29 11:16:21 +08:00
Nguyen Anh Quynh
6d3d8005aa x86: do not print memory offset in negative form. bug reported by Le Dinh Long 2014-03-29 17:26:51 +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
85cddef303 x86: optimize handling special instructions with accumulate registers 2014-02-18 11:59:36 +08:00
Nguyen Anh Quynh
005c5148a6 x86: eliminate X86_get_insn_id2() 2014-02-18 11:11:46 +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
3732725342 rename mapping.c, mapping.h, module.c to have arch prefix. suggested by Alex Ionescu 2014-01-20 09:52:05 +08:00