Commit Graph

2494 Commits

Author SHA1 Message Date
semihalf-oleksy-michalina 85960f9edd arm64: handling of system registers added in ARMv8.1/2 (#960)
* arm64: handling of system registers added in ARMv8.2

This commit adds handling of system registers added in ARMv8.2.
Those registers are accessed by mrs and msr instructions.
Changes based on https://static.docs.arm.com/ddi0487/b/DDI0487B_a_armv8_arm.pdf, chapters D7.2-5.

List of added registers:
id_mmfr4_el1
id_aa64mmfr2_el1
sctlr_el12
cpacr_el12
ttbr0_el12
ttbr1_el12
ttbr1_el2
tcr_el12
spsr_el12
elr_el12
afsr0_el12
afsr1_el12
esr_el12
far_el12
mair_el12
amair_el12
vbar_el12
cntkctl_el12
cnthv_ctl_el2
cnthv_cval_el2
cnthv_tval_el2
cntp_tval_el02
cntp_cval_el02
cntv_ctl_el02
ntv_cval_el02
cntv_tval_el02
lorid_el1
lorc_el1
lorea_el1
lorn_el1
lorsa_el1
contextidr_el12

sign-of: Michalina Oleksy (https://github.com/layika)

* arm64: handling of system registers added in ARMv8.1/2

v8.1:
PAN (https://static.docs.arm.com/ddi0487/b/DDI0487B_a_armv8_arm.pdf, page 358)
PAN (as pstate field)
contextdir_el2

v8.2:
UAO (https://static.docs.arm.com/ddi0487/b/DDI0487B_a_armv8_arm.pdf, page 403)
UAO (as pstate field)

* arm64: handling of system registers for statistical profiling

Added handling of system registers for statistical profiling extension based on https://static.docs.arm.com/ddi0586/a/DDI0586A_Statistical_Profiling_Extension.pdf

* Update AArch64BaseInfo.h

* arm64: An attempt to fix indentation
2017-07-29 18:27:32 +08:00
Nguyen Anh Quynh 438f824446 cstool: cs_op_count() can return -1. fix #978 2017-07-26 23:16:52 +08:00
Nguyen Anh Quynh f5b0e3cf43 cmake: do not set libsuffix=64 on MacOS. fix issue #963 2017-07-19 22:53:09 +08:00
Fernie 408de035d2 detect 64bit library location. compatibility for 64bit systems. (#963)
credit goes to Theo. (Theodore Papadopoulo Theodore.Papadopoulo at inria.fr https://cmake.org/pipermail/cmake/2013-July/055374.html)
2017-07-18 08:26:39 +08:00
Nguyen Anh Quynh d4babd9808 x86: MOV AL, [mem] has 2 operands. fix #959 2017-07-08 13:58:36 +07:00
Nguyen Anh Quynh c508224896 x86: wrong number of operands. fix #950 2017-06-23 00:54:09 +08:00
Adrian Herrera 229593dc3f mingw build: cstool fails to build with mingw (#941)
The correct compiler was not being passed to cstool/Makefile. The expected name
for the capstone lib was also incorrect - there is no "lib" prefix when
compiling with mingw.
2017-06-02 21:49:10 +08:00
Nguyen Anh Quynh b6c4c3f5c7 rebuild cstool when the core changes. fix #932 2017-05-25 23:11:12 +08:00
vit9696 4a757e129f Several changes for size reduction (#929)
* Support CAPSTONE_STATIC with __GNUC__ compilers

* Allow custom export rules

* Make CAPSTONE_SHARED the default visibility option with GNUC (avoids behaviour changes)

* Reduce capstone static build size (mainly for kernel usage)

* Allow basic cs_detail support in diet mode

* Fixed valid_bnd unused function warning

* Do not disable cs_detail generation in CAPSTONE_DIET, use CAPSTONE_NO_DETAIL for that.

* Reverted CAPSTONE_NO_DETAIL at least until capstone supports more flexible configuration

* Added a missing endif

* Disallow custom export rules
2017-05-24 13:07:11 +08:00
Nguyen Anh Quynh 44c419a64c x86: indentation 2017-05-22 21:36:04 +08:00
Quang Nguyễn 69b163a00e Compile cstool on Windows using Microsoft Visual Studio (VS). (#927)
* provide a validity check to prevent against Integer overflow conditions

* fix some style issues.

* provide a validity check in malloc() function to prevent against integer overflow conditions

* missing Ntintsafe.h

* use tabs for indentation

* add cstool project
2017-05-16 16:52:34 +07:00
Nick Briggs ce3f0d0935 Rename test.c to test_basic.c with corresponding executable name change. (#923)
* Rename test.c to test_basic.c with corresponding executable name change.

* Fix Makefile, tests/Makefile to comprehend renamed test program. See issue #922

* Fix XCode project to comprehend renamed test program.  See issue #922

* Rename python test.py to test_basic.py to parallel C test name.  See issue #922

* Rename ocaml test.ml to test_basic.ml to parallel C test name.  See issue #922

* Fix MSVC project definitions to comprehend renamed test program.  See issue #922
2017-05-11 22:58:12 +07:00
Nguyen Anh Quynh 7b4e870480 x86: LDS is invalid in x64. see #904 2017-05-08 10:49:55 +08:00
Nguyen Anh Quynh 7ca24f143d Merge branch 'master' of https://github.com/aquynh/capstone 2017-05-07 14:32:52 +08:00
Nguyen Anh Quynh ce8a822c79 x86: handle f2/f3 prefix for 16bit. see issue #452 2017-05-07 14:32:39 +08:00
Nguyen Anh Quynh a8ad69ab79 x86: LES is invalid in x64. see #904 2017-05-06 14:29:11 +08:00
Nguyen Anh Quynh efc9036063 x86: AT&T syntax bug with zero offset segment register. see #884 2017-05-06 10:38:08 +08:00
Nguyen Anh Quynh f4c5d5ef3c Makefile: do not delete capstone.pc.in 2017-05-05 09:46:46 +08:00
Nguyen Anh Quynh 079d94d7f0 arm: POP {reg} read/write SP register. this fixes #913 2017-05-04 17:21:41 +08:00
Nguyen Anh Quynh 3cebee3301 x86: lock nop is a valid instruction. #915 2017-05-03 20:06:39 +08:00
Gabor Buella 3cc69be43d cmake - fix SOVERSION property used for libcapstone.so (#914)
It was set as a global property before, but cmake appears to ignore that,
even after the following fix:
-set_property(GLOBAL PROPERTY SOVERSION SOVERSION ${VERSION_MAJOR})
+set_property(GLOBAL PROPERTY SOVERSION ${VERSION_MAJOR})

So this patch removes the global property, and SOVERSION is now specified as
a target specific property. The result of the cmake install target seems better:

Before:

$ ls -la lib
4375834 May  1 16:05 libcapstone.a
3510040 May  1 16:05 libcapstone.so

After:

$ ls -la lib
4375834 May  1 16:05 libcapstone.a
     16 May  1 16:08 libcapstone.so -> libcapstone.so.4
     20 May  1 16:08 libcapstone.so.4 -> libcapstone.so.4.0.0
3510040 May  1 16:08 libcapstone.so.4.0.0

The SOVERSION property triggers symlink creation in cmake, see:
https://cmake.org/cmake/help/v3.0/prop_tgt/SOVERSION.html
2017-05-02 09:25:32 +08:00
Nguyen Anh Quynh bc0e173dab CMake: fix pkgconfig file 2017-04-30 23:20:08 +08:00
Gabor Buella b9a2c1a73c cmake: install pkg config file 2017-04-30 23:19:54 +08:00
noword e1e2b5b790 fix compiling error in MS VS2015 (#869)
for issue #868
2017-04-26 09:10:44 +08:00
Nguyen Anh Quynh 2acb20560c cstool: support arm64be 2017-04-25 21:33:56 +08:00
Simorfo 10e8323f26 Bugfix : setting all fields to insns cache (#899)
* Bugfix : setting all fields to insns cache

* Bugfix
Fixing root cause, not setting opcode to 0 in default case

* Not resetting opcode to 0 in this case as well

* Finalizing bugfix
2017-04-21 21:20:17 +08:00
Nguyen Anh Quynh 54f4863303 python: add a debug line 2017-04-19 23:19:00 +08:00
Nguyen Anh Quynh c1d5c09949 cleanup 2017-04-17 10:24:31 +08:00
el2ro 3c467fec2f Fix for incorrect operand size in 64bit CALL / JMP when x66 prefix in use (#777) 2017-04-15 10:34:50 +08:00
szt 8e39d82841 replace if-s in AArch64_AM_decodeAdvSIMDModImmType10 with lookup table (#552)
* replace if-s in AArch64_AM_decodeAdvSIMDModImmType10 with lookup table

Lookup table is much faster than bunch of if-s. If you don't like lookup tables, I have another proposal. See http://goo.gl/RjW1lr and compare generated machine code

* Smaller lookup table and shifting and bit mask used

* Update AArch64AddressingModes.h
2017-04-15 09:50:06 +08:00
David Zimmer e3ff166781 vb6 bindings added to credits.txt (#891)
* +vb6 bindings

* + vb6 bindings to credits.txt
2017-04-15 00:12:41 +08:00
Nguyen Anh Quynh bbb6b9e2f8 add VB to README 2017-04-14 23:26:55 +08:00
David Zimmer edc8ef0faa +vb6 bindings (#889) 2017-04-14 23:23:08 +08:00
Nguyen Anh Quynh 0e4cdd9b6b PHP binding 2017-04-12 10:02:16 +08:00
Nguyen Anh Quynh 04ce7f29a6 cstool: fix mips64 mode 2017-04-11 09:46:18 +08:00
Quang Nguyễn 85f4b8f7d9 Fix an integer overflow issue (#871)
* provide a validity check to prevent against Integer overflow conditions

* fix some style issues.

* provide a validity check in malloc() function to prevent against integer overflow conditions

* missing Ntintsafe.h

* use tabs for indentation
2017-03-20 20:13:14 +08:00
Nguyen Anh Quynh 5be7444c09 x86: support BND prefix. issue #872 2017-03-18 00:08:10 +08:00
Quang Nguyễn 6fe86eef62 provide a validity check to prevent against Integer overflow conditions (#870)
* provide a validity check to prevent against Integer overflow conditions

* fix some style issues.
2017-03-13 23:34:48 +08:00
Nguyen Anh Quynh fbfa991cae add nmake.bat 2017-03-13 15:06:32 +08:00
Nguyen Anh Quynh d786983104 cstool: support armbe mode 2017-03-10 20:31:23 +08:00
Nguyen Anh Quynh e2d9ada4ee Update cs.c
remove a dead code, suggested by @vit9696 on #867
2017-03-08 20:57:33 +08:00
Nguyen Anh Quynh 93f7af2375 Merge pull request #867 from vit9696/patch-1
Fix compilation from within a macOS kernel extension
2017-03-08 20:53:02 +08:00
vit9696 4361596b92 fix compilation from within a macOS kernel extension 2017-03-08 14:40:22 +03:00
Nguyen Anh Quynh d8ef4914d7 fix some warnings on VS2010 on redefining INTxx_MIN, INTxx_MAX 2017-03-06 14:40:30 +08:00
Nguyen Anh Quynh bac2b3b202 Merge pull request #865 from rhelmot/master
Add python prebuilt directory
2017-03-05 14:07:00 +08:00
Andrew Dutcher 9d3e929ae6 Add ability to copy prebuilt libraries from prebuilt directory during python build 2017-03-04 17:09:07 -08:00
Nguyen Anh Quynh e22577e42d update ChangeLog 2017-03-02 22:21:24 +08:00
Nguyen Anh Quynh 335b85c627 arm64: fix immediate number in detail mode. see #860 2017-02-26 18:17:39 +08:00
Nguyen Anh Quynh adec3a88d5 CMake: bump version to 3.0.5 2017-02-26 10:45:16 +08:00
Nguyen Anh Quynh 1504f913f1 x86: consistent register names ST0-ST7 with the asm output 2017-02-22 15:54:11 +08:00