Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
350 commits
Select commit Hold shift + click to select a range
68d7fc7
Update sysop inc file
Rot127 Jun 4, 2023
3b1fe08
Fix missing braces warning
Rot127 Jun 4, 2023
b927a0a
Handle new system operands
Rot127 Jun 5, 2023
aa55c32
Fix build errors by renaming.
Rot127 Jun 5, 2023
670ddc4
Fix segfault
Rot127 Jun 5, 2023
d34f6e6
Fix segfault
Rot127 Jun 5, 2023
eac99ed
Add custom MCOperand valiadtors
Rot127 Jun 5, 2023
6f2f8c8
Add AArch64 case for getFeatureBits
Rot127 Jun 5, 2023
09b97ec
Fix infinite loop
Rot127 Jun 5, 2023
412aa47
Fix braces warning.
Rot127 Jun 5, 2023
6646f29
Implement loopuo by name for sys operands
Rot127 Jun 5, 2023
e6140ba
Fix incorrect translation which remove else if statements.
Rot127 Jun 5, 2023
56d3838
Fix several segfaults
Rot127 Jun 5, 2023
d08d731
Rename GetRegFromClass patch
Rot127 Jun 5, 2023
59b7916
Fix segfaults and asserts
Rot127 Jun 5, 2023
4376e28
Fix segfault
Rot127 Jun 6, 2023
a3d9257
Move MRI setting to Mapping
Rot127 Jun 8, 2023
cf13cf6
Remove unused code
Rot127 Jun 8, 2023
7bbb677
Add add_op_X functinos for AArch64.
Rot127 Jun 10, 2023
810f4b4
Add fill detail functins
Rot127 Jun 14, 2023
fec4fa9
Handle RegWithShiftExtend operands
Rot127 Jun 14, 2023
b25c5cf
Handle TypedVectorList operands.
Rot127 Jun 14, 2023
558f2f8
Handle ComplexRoatation operands
Rot127 Jun 15, 2023
16152a3
Handle MemExtend operands
Rot127 Jun 15, 2023
34fb060
Handle ImmRangeScale operands
Rot127 Jun 15, 2023
5e633fb
Handle ExactFPImm operands
Rot127 Jun 15, 2023
e053789
Handle GPRSeqPairsClass operands
Rot127 Jun 15, 2023
34c71c3
Handle Imm8OptLsl operands
Rot127 Jun 15, 2023
914bb5e
Handle ImmScale operands
Rot127 Jun 15, 2023
71784e4
Handle LogicalImm operands
Rot127 Jun 15, 2023
c7fd77f
Handle Matrix operands
Rot127 Jun 15, 2023
761820b
Handle SME Matrix tiles and vectors.
Rot127 Jun 15, 2023
cd7e9e5
Handle normal operands.
Rot127 Jun 15, 2023
1082f50
Fix segfault.
Rot127 Jun 15, 2023
fff9dc0
Handle PostInc operands.
Rot127 Jun 15, 2023
044aead
Reorder VecLayout enum to have no duplicate enum value.
Rot127 Jun 15, 2023
339a9c0
Handle PredicateAsCounter operands
Rot127 Jun 15, 2023
a2d2606
Handle ZPRasFPR operands
Rot127 Jun 16, 2023
9a0f41a
Handle VectorIndex operands
Rot127 Jun 16, 2023
1962c36
Handle UImm12Offset operands.
Rot127 Jun 16, 2023
2443e77
Move reg suffix to enum val to single function.
Rot127 Jun 16, 2023
81e8dff
Handle SVERegOp operands
Rot127 Jun 16, 2023
900f2ad
Handle SVELogicalImm operands
Rot127 Jun 16, 2023
7dc7d59
Handle SImm operand
Rot127 Jun 16, 2023
1458ab6
Handle PrefetchOp operands
Rot127 Jun 16, 2023
6dc02f9
Handle Imm and ImmHex operands
Rot127 Jun 17, 2023
21e542c
Handle GPR64as32 and GPR64x8 operands
Rot127 Jun 17, 2023
a4fa715
Add missing break
Rot127 Jun 17, 2023
db07ca7
Handle FPImm operand
Rot127 Jun 17, 2023
364f426
Handle ExtendedRegister opreand
Rot127 Jun 17, 2023
85c655c
Handle CondCode operands
Rot127 Jun 17, 2023
b6c92ce
Handle BTIHintOp operands
Rot127 Jun 17, 2023
d3974c7
Handle BarrierOption operands
Rot127 Jun 17, 2023
dab8f42
Handle BarrierXSOption
Rot127 Jun 17, 2023
29b6f6c
Add not implemeted case again
Rot127 Jun 17, 2023
de4c275
Handle ArithExtend operands
Rot127 Jun 17, 2023
46c3f2a
Handle AdrpLabel and AlignedLabel operands
Rot127 Jun 17, 2023
ea50554
Handle AMNoIndex operands
Rot127 Jun 17, 2023
d0a8f55
Handle AddSubImm operands
Rot127 Jun 17, 2023
cc644a1
Handle MSRSystemRegisters and MRSSystemRegister operands
Rot127 Jun 17, 2023
86c8bdd
Handle PSBHntOp and RPRFMOperand operands
Rot127 Jun 17, 2023
478b7c2
Remove unused variables
Rot127 Jun 18, 2023
88a2dcd
Handle InverseCondCode operands
Rot127 Jun 18, 2023
3db65c9
Handle ImplicityTypedVectorList operands
Rot127 Jun 18, 2023
227c533
Handle ShiftedRegister operands
Rot127 Jun 18, 2023
d203814
Handle Shifter operands
Rot127 Jun 18, 2023
adfa161
Handle SIMDType10Operand operands
Rot127 Jun 18, 2023
a16039e
Handle SVCROp operands
Rot127 Jun 18, 2023
1ba85a2
Handle SVEPattern operands
Rot127 Jun 18, 2023
302f4d4
Handle SVEVecLenSpecifier operands
Rot127 Jun 18, 2023
89c7a08
Handle SysCROperands
Rot127 Jun 18, 2023
c6af50a
Handle SysXzrPair operands
Rot127 Jun 18, 2023
4c7357a
Handle PState operands
Rot127 Jun 18, 2023
c0a818a
Handle VRegOperands
Rot127 Jun 18, 2023
dfd3949
Primt SME oeprands.
Rot127 Jun 21, 2023
c8c8959
Fix cs_operand.h include
Rot127 Aug 5, 2023
bcbd048
Rename arm64 -> aarch64 in python bindings.
Rot127 Aug 5, 2023
330f6ea
Add Python bindings for SH
peace-maker Jul 13, 2023
d2ea94f
Fix ARM Python bindings (#2127)
peace-maker Jul 29, 2023
5183cd6
Restructure auto-sync update scripts.
Rot127 Aug 5, 2023
5b94d3b
Move Helper functions to Updater dir
Rot127 Aug 5, 2023
cac8273
Move requirements.txt
Rot127 Aug 5, 2023
97cbeae
Add basic ASUpdater.py
Rot127 Aug 5, 2023
b23137d
Run black.
Rot127 Aug 5, 2023
2000343
Add inc file generater to updater
Rot127 Aug 5, 2023
8b515c3
Add option to select certain inc files fore generation.
Rot127 Aug 5, 2023
352db44
Enable clean build and implement patcher for inc files.
Rot127 Aug 7, 2023
b7e3ac2
Format config
Rot127 Aug 7, 2023
cc69f05
Patch main header files after inc generation.
Rot127 Aug 7, 2023
d724e4a
Implement clang-format function (unused yet, because it takes forever.)
Rot127 Aug 7, 2023
1d6ede7
Copy generated inc files to arch dir
Rot127 Aug 7, 2023
da46af6
Invert clean option (noramlly we need to clean the build dir.)
Rot127 Aug 7, 2023
cfc55bd
Clearify arg doc
Rot127 Aug 7, 2023
3de6956
Rename SystemRegister file for AArch64
Rot127 Aug 7, 2023
fda1125
Centralize handling of path variables.
Rot127 Aug 7, 2023
8a41dba
Check if SystemOperands had to be generated before renaming on of its…
Rot127 Aug 7, 2023
5580437
Replace class parameters by calling get_path
Rot127 Aug 7, 2023
6db6e47
Remove updater config which only contained paths.
Rot127 Aug 7, 2023
4bf331f
Add refactor option.
Rot127 Aug 7, 2023
9d70c0a
Remove more path handling in the Configurator.
Rot127 Aug 7, 2023
710c135
Add translation step to updater.
Rot127 Aug 7, 2023
e93531f
Fix includes after CppTranslator was moved into the Updater
Rot127 Aug 7, 2023
fa9cc7b
Remove updater config
Rot127 Aug 7, 2023
bd8196d
Fix several issue in the Configurator
Rot127 Aug 7, 2023
b7d9d45
Fix file operations
Rot127 Aug 7, 2023
f619e42
Remove addition argument from translator.
Rot127 Aug 7, 2023
bad666a
Add Differ step to updater.
Rot127 Aug 7, 2023
8debae7
Add path variable for arch_config
Rot127 Aug 7, 2023
10241c9
Add diff step.
Rot127 Aug 7, 2023
6a79492
Fix typo
Rot127 Aug 7, 2023
98ac374
Introduce .clang-format path variable.
Rot127 Aug 7, 2023
85100fe
Remove duplicate functions
Rot127 Aug 7, 2023
018c659
Add option to select update steps to execute.
Rot127 Aug 7, 2023
7b5b8cf
Check in write functions for write flag.
Rot127 Aug 7, 2023
ad0c126
Rename PatchMainHeader -> HeaderPatcher
Rot127 Aug 7, 2023
ace442a
Move .gitignore
Rot127 Aug 7, 2023
bd03f40
Add README to vendor dir.
Rot127 Aug 7, 2023
f070602
Add all system operands to cstool output
Rot127 Aug 10, 2023
78f1d98
Update cstest with aarch64 changes
Rot127 Aug 10, 2023
a4c0486
Remove wb flag of aarch64 detail struct
Rot127 Aug 10, 2023
2c0e56f
Set updates_flag after decoding
Rot127 Aug 10, 2023
e30f383
Set writeback after decoding.
Rot127 Aug 10, 2023
4d9c4a9
Rename ARM64 -> AArch64
Rot127 Aug 10, 2023
8bcf4d6
Update printer and op mapping
Rot127 Aug 11, 2023
9200e35
Exit normally
Rot127 Aug 11, 2023
199d00e
Add AArch64 alias
Rot127 Aug 11, 2023
bfe8edf
Fix some tmeplate function calls
Rot127 Aug 11, 2023
e4db5e1
Fix flag check after rebase.
Rot127 Aug 11, 2023
7e6b9de
Fix build by commentig unnused code.
Rot127 Aug 11, 2023
7a694e7
Add memory operand flag
Rot127 Aug 21, 2023
1fe02a4
Handle memory operands printed via generic printOperand function.
Rot127 Aug 21, 2023
ddc35fe
Handle UImm memory offsets
Rot127 Aug 21, 2023
68b15b9
Introduce MEM_REG and MEM_IMM op types
Rot127 Aug 21, 2023
1654c9e
Handle scaled memory immediates
Rot127 Aug 21, 2023
2168585
Check for op_count before checking for mem op at -1 index.
Rot127 Aug 21, 2023
ac249f9
Update memory operand flags.
Rot127 Aug 21, 2023
6ba7bfa
Pass imm/reg memory ops in set_imm/reg to set_mem.
Rot127 Aug 21, 2023
c837072
Add missing set_sme_operand call and fix assert.
Rot127 Aug 21, 2023
1e8d993
Remove CS_OP_MEM flag before entering switch.
Rot127 Aug 21, 2023
7fb3449
Preidcates are registers.
Rot127 Aug 21, 2023
7c5dc74
Add shift info always to the previous operand
Rot127 Aug 21, 2023
32f7314
Check for generic system regs
Rot127 Aug 22, 2023
1e1f350
Handle NumLanes = 0 LaneKind = q case
Rot127 Aug 22, 2023
3932894
Replace printImm call with normal print logic. Otherwise ops get adde…
Rot127 Aug 22, 2023
0fc8a97
Handle FP operands in printOperand.
Rot127 Aug 22, 2023
e0db5a4
Add access information to float operands.
Rot127 Aug 22, 2023
23f5ff5
Rewrite SME matrix handling.
Rot127 Aug 22, 2023
ed4bf2b
Set correct SME layouts and allow for immediate range sme offsets.
Rot127 Aug 22, 2023
6cad4c3
Handle cases of unknown system alias by setting their raw values
Rot127 Aug 22, 2023
6e9514f
Update cstool and header file with new SME offset handling
Rot127 Aug 22, 2023
63ab2b7
Handle SME Tile lists.
Rot127 Aug 22, 2023
979a960
Fix build error in cstest
Rot127 Aug 22, 2023
37c31ea
Update MC tests for AArch64
Rot127 Aug 23, 2023
a11546d
Handle TLBI operands and fix printing bug.
Rot127 Aug 23, 2023
688c1d7
Fix: Print signed value as signed.
Rot127 Aug 23, 2023
5e2511c
Add more system alias to detail.
Rot127 Aug 23, 2023
77bf735
Remove duplicate hex prefix
Rot127 Aug 23, 2023
40f3a62
Set correct values for the register info
Rot127 Aug 23, 2023
d1a5b4f
Replace tabs with white spaces
Rot127 Aug 24, 2023
24ac423
Move string append logic to own function.
Rot127 Aug 24, 2023
b1afc36
Set DecodeComplete = true before decoding (as originally in the LLVM …
Rot127 Aug 24, 2023
a7b01b2
Change type of feature argument, since only LLVM features are passed,…
Rot127 Aug 24, 2023
29d92f9
Imitate lower_bound for the index table binary search.
Rot127 Aug 24, 2023
c47cc2a
Remove trailing comments from test files.
Rot127 Aug 24, 2023
70d2b5e
Print shift amount in decimal
Rot127 Aug 24, 2023
192dd0c
Save detail of shift alias instructions.
Rot127 Aug 24, 2023
1b7da36
Add extension details fot ext instruction alias
Rot127 Aug 24, 2023
8df18d0
Print LSB and width in decimal
Rot127 Aug 24, 2023
28a7076
Fix LLVM bug. The feature check for V8_2a doesn't check if all featur…
Rot127 Aug 24, 2023
1ab72f1
Fix lower_bounds check.
Rot127 Aug 24, 2023
347d92a
Fix feature check. Add check for FeatureAll since it includes XS
Rot127 Aug 24, 2023
0af5dc4
Operate on temporary MCInst when trying decoding.
Rot127 Aug 24, 2023
41e7fc9
Add lower_bound behavior to IndexTypeStr binsearch.
Rot127 Aug 24, 2023
23b8efc
Fix MC tests which were incorrect because of missing FeatureAll check
Rot127 Aug 24, 2023
31dc444
Add Alias handling for AArch64
Rot127 Aug 25, 2023
480798c
Update system operands with SYSIMM types and add additional sysop cat…
Rot127 Aug 25, 2023
6bb5e79
Add macros for meta programming (ARM64 <-> AArch64 selection).
Rot127 Aug 26, 2023
c230948
Fix union/struct confusion and add raw_value member to uninions.
Rot127 Aug 26, 2023
047a7a8
Allow to set Syntax and mode options for AArch64
Rot127 Aug 26, 2023
d6d9c65
Fix build warning by using correct type
Rot127 Aug 26, 2023
c528f62
Print shift value in decimal
Rot127 Aug 26, 2023
adb8378
Add missing call to add_cs_detail.
Rot127 Aug 26, 2023
63a83c0
Update name map files with normalized names.
Rot127 Aug 27, 2023
5f47fb6
Remove unused function
Rot127 Aug 27, 2023
06f0840
Add check if detail should be filled.
Rot127 Aug 27, 2023
608987b
Fill detail for real instructions if only real detail is requested.
Rot127 Aug 27, 2023
d2e2d7c
Add always the extension.
Rot127 Aug 27, 2023
f1d60bf
Make dir creation log message debug level
Rot127 Aug 28, 2023
a56d573
Implement ADR immediate operand printer.
Rot127 Aug 28, 2023
eff7e32
Check for flag registers beeing written and update flag.
Rot127 Aug 28, 2023
60551e4
Move multiple CondCode helpers to aarch64.h because they are so freak…
Rot127 Aug 28, 2023
13a8568
Fix incorrectly initialized CC and VectorLayout.
Rot127 Aug 29, 2023
0073a92
Add LSL shift type for extensions.
Rot127 Aug 29, 2023
0b01d16
Fix case when shift amount is 0
Rot127 Aug 29, 2023
964465d
Fix post-index memory instructions.
Rot127 Aug 30, 2023
c8143a0
Pass raw immediate through getShiftValue to extract actual shift amount
Rot127 Aug 30, 2023
18efeb1
Setup AArch64 detail ops.
Rot127 Aug 30, 2023
81022bb
Add flag for operands part of a list.
Rot127 Aug 30, 2023
c283df6
Set vector indices for all relevant registers.
Rot127 Aug 30, 2023
9e15715
Add missing call to add_cs_detail for postIncOperands
Rot127 Aug 30, 2023
bd17082
Add ugly yet reliable way to determine post-index addressing mode
Rot127 Aug 30, 2023
06d3a0f
Add support for old Capstone register alias.
Rot127 Aug 30, 2023
6dce276
Remove leading space before some alias mnemonics.
Rot127 Aug 30, 2023
8f44998
add AARCH64 to `cmake.sh`
watbulb Aug 28, 2023
0816103
add HAS_AARCH64 to `cs.c`
watbulb Aug 28, 2023
58e283e
should probably just reference `cs_operand.h` in `aarch64.h`
watbulb Aug 28, 2023
44bd227
hint compiler at `AArch64_SYSREG` enum type for casting purposes
watbulb Aug 28, 2023
bb1c3c6
update `Makefile` for AARCH64
watbulb Aug 28, 2023
805830f
`testFeatureBits` platform function check
watbulb Aug 28, 2023
9730d3c
update tests to use AARCH64 convention
watbulb Aug 28, 2023
51b3d20
hack: avoid enum casts for `MCInst` Values
watbulb Aug 28, 2023
c8b2f1d
Check for present detail before accessing it.
Rot127 Oct 12, 2023
b7622dc
Add CS only groups
Rot127 Oct 12, 2023
190a5b2
Use general map ins_op type
Rot127 Oct 12, 2023
6fb9f44
Fix build warning about str size computation.
Rot127 Oct 13, 2023
b83103e
Disable warning about unitialized value for GCC 11.
Rot127 Oct 13, 2023
2db40f6
Use correct include guard for PPC
Rot127 Oct 13, 2023
c2f00c9
Add missing requirements
Rot127 Oct 13, 2023
cc6c453
Update SystemOperand enums.
Rot127 Oct 13, 2023
68c63ab
Fix overlapping comparison warning
Rot127 Oct 13, 2023
76c4e25
Fix reachable assert where OpNum is not of type IMM
Rot127 Oct 13, 2023
5f4fa7d
Handle 0.0 operand for fcmp
Rot127 Oct 13, 2023
9675634
Fix incorrect variable passed.
Rot127 Oct 13, 2023
d829adf
Fix for MacOS which doesn't know the warning and throws another one.
Rot127 Oct 14, 2023
3fa2f1f
Make getExtendEncoding static to fix build warning on MSVC.
Rot127 Oct 15, 2023
366af95
Fix build error: 'missing binary operator before token' by checking _…
Rot127 Oct 15, 2023
508cefa
Add string search to add vector layout info.
Rot127 Nov 1, 2023
9bc6be4
Add missing mem disponents of several ldr and str instructions.
Rot127 Nov 2, 2023
cff270c
Add 0 immediates to several instructions.
Rot127 Nov 2, 2023
0a0c69b
Rename v regs to q and d variant.
Rot127 Nov 2, 2023
72dfd45
Fix incorrect enum value.
Rot127 Nov 2, 2023
f5f5306
Fix tests for system operands.
Rot127 Nov 2, 2023
752e4c8
Fix syntax issues in tests.
Rot127 Nov 2, 2023
dc4957b
Rename Arm64 -> AArch64 Python bindings.
Rot127 Nov 2, 2023
5ffa529
Fix Python bindings C structs.
Rot127 Nov 2, 2023
ff52145
Fix generation of constants (ARMCC skipped because it starts with ARM)
Rot127 Nov 2, 2023
d997e59
Update const files
Rot127 Nov 2, 2023
01e2317
Remove -Wmaybe-uninitialized warning since it fails fuzz build
Rot127 Nov 2, 2023
52b689a
Add missing comma
Rot127 Nov 2, 2023
6de0eaf
Fix case
Rot127 Nov 2, 2023
0fb11c7
Fix AArch64 Python bindings:
Rot127 Nov 2, 2023
a5b60e7
Rename ARM64 -> AArch64 in test_corpus.py
Rot127 Nov 2, 2023
c47ddd6
Rename test_arm64 -> test_aarch64
Rot127 Nov 2, 2023
f5918ae
Rename ARM-64 -> AArch64
Rot127 Nov 2, 2023
ccb4e17
Fix diff CI test by disassembling AArch64 at former ARM64 place
Rot127 Nov 3, 2023
75602e3
Fix several wrong types and remove unnecessary memebers from Python b…
Rot127 Nov 3, 2023
060e808
Fix: Same printing format of detail for cstool, test_ and test_*.py
Rot127 Nov 3, 2023
731eb91
Fix: pass correct op index for mov alias with op[1] == reg wzr.
Rot127 Nov 3, 2023
5ba1a6b
Set prfm op manuall in case of unnown sysop. set_imm would add it to …
Rot127 Nov 3, 2023
474d3d3
Fix: If barrier ops are not set an assert is reached.
Rot127 Nov 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ bindings/ocaml/*.cmxa
bindings/ocaml/*.mli
bindings/ocaml/test
bindings/ocaml/test_arm
bindings/ocaml/test_arm64
bindings/ocaml/test_aarch64
bindings/ocaml/test_basic
bindings/ocaml/test_mips
bindings/ocaml/test_x86
Expand All @@ -54,7 +54,7 @@ tests/test_basic
tests/test_detail
tests/test_iter
tests/test_arm
tests/test_arm64
tests/test_aarch64
tests/test_mips
tests/test_x86
tests/test_ppc
Expand Down
36 changes: 18 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ option(CAPSTONE_ARCHITECTURE_DEFAULT "Whether architectures are enabled by defau
option(CAPSTONE_DEBUG "Whether to enable extra debug assertions" OFF)
option(CAPSTONE_INSTALL "Generate install target" ${PROJECT_IS_TOP_LEVEL})

set(SUPPORTED_ARCHITECTURES ARM ARM64 M68K MIPS PPC SPARC SYSZ XCORE X86 TMS320C64X M680X EVM MOS65XX WASM BPF RISCV SH TRICORE)
set(SUPPORTED_ARCHITECTURE_LABELS ARM ARM64 M68K MIPS PowerPC Sparc SystemZ XCore x86 TMS320C64x M680x EVM MOS65XX WASM BPF RISCV SH TriCore)
set(SUPPORTED_ARCHITECTURES ARM AARCH64 M68K MIPS PPC SPARC SYSZ XCORE X86 TMS320C64X M680X EVM MOS65XX WASM BPF RISCV SH TRICORE)
set(SUPPORTED_ARCHITECTURE_LABELS ARM AARCH64 M68K MIPS PowerPC Sparc SystemZ XCore x86 TMS320C64x M680x EVM MOS65XX WASM BPF RISCV SH TriCore)

list(LENGTH SUPPORTED_ARCHITECTURES count)
math(EXPR count "${count}-1")
Expand Down Expand Up @@ -123,7 +123,7 @@ set(HEADERS_ENGINE
)

set(HEADERS_COMMON
include/capstone/arm64.h
include/capstone/aarch64.h
include/capstone/arm.h
include/capstone/capstone.h
include/capstone/cs_operand.h
Expand Down Expand Up @@ -181,35 +181,35 @@ if(CAPSTONE_ARM_SUPPORT)
set(TEST_SOURCES ${TEST_SOURCES} test_arm.c)
endif()

if(CAPSTONE_ARM64_SUPPORT)
add_definitions(-DCAPSTONE_HAS_ARM64)
set(SOURCES_ARM64
if(CAPSTONE_AARCH64_SUPPORT)
add_definitions(-DCAPSTONE_HAS_AARCH64)
set(SOURCES_AARCH64
arch/AArch64/AArch64BaseInfo.c
arch/AArch64/AArch64Disassembler.c
arch/AArch64/AArch64DisassemblerExtension.c
arch/AArch64/AArch64InstPrinter.c
arch/AArch64/AArch64Mapping.c
arch/AArch64/AArch64Module.c
)
set(HEADERS_ARM64
set(HEADERS_AARCH64
arch/AArch64/AArch64AddressingModes.h
arch/AArch64/AArch64BaseInfo.h
arch/AArch64/AArch64Disassembler.h
arch/AArch64/AArch64DisassemblerExtension.h
arch/AArch64/AArch64InstPrinter.h
arch/AArch64/AArch64Linkage.h
arch/AArch64/AArch64Mapping.h
arch/AArch64/AArch64GenAsmWriter.inc
arch/AArch64/AArch64GenDisassemblerTables.inc
arch/AArch64/AArch64GenInstrInfo.inc
arch/AArch64/AArch64GenRegisterInfo.inc
arch/AArch64/AArch64GenRegisterName.inc
arch/AArch64/AArch64GenRegisterV.inc
arch/AArch64/AArch64GenSubtargetInfo.inc
arch/AArch64/AArch64GenSystemOperands.inc
arch/AArch64/AArch64GenSystemOperands_enum.inc
arch/AArch64/AArch64MappingInsn.inc
arch/AArch64/AArch64MappingInsnName.inc
arch/AArch64/AArch64MappingInsnOp.inc
arch/AArch64/AArch64GenCSMappingInsn.inc
arch/AArch64/AArch64GenCSMappingInsnName.inc
arch/AArch64/AArch64GenCSMappingInsnOp.inc
)
set(TEST_SOURCES ${TEST_SOURCES} test_arm64.c)
set(TEST_SOURCES ${TEST_SOURCES} test_aarch64.c)
endif()

if(CAPSTONE_MIPS_SUPPORT)
Expand Down Expand Up @@ -576,7 +576,7 @@ endif()
set(ALL_SOURCES
${SOURCES_ENGINE}
${SOURCES_ARM}
${SOURCES_ARM64}
${SOURCES_AARCH64}
${SOURCES_MIPS}
${SOURCES_PPC}
${SOURCES_X86}
Expand All @@ -599,7 +599,7 @@ set(ALL_HEADERS
${HEADERS_COMMON}
${HEADERS_ENGINE}
${HEADERS_ARM}
${HEADERS_ARM64}
${HEADERS_AARCH64}
${HEADERS_MIPS}
${HEADERS_PPC}
${HEADERS_X86}
Expand Down Expand Up @@ -662,7 +662,7 @@ endif()

source_group("Source\\Engine" FILES ${SOURCES_ENGINE})
source_group("Source\\ARM" FILES ${SOURCES_ARM})
source_group("Source\\ARM64" FILES ${SOURCES_ARM64})
source_group("Source\\AARCH64" FILES ${SOURCES_AARCH64})
source_group("Source\\Mips" FILES ${SOURCES_MIPS})
source_group("Source\\PowerPC" FILES ${SOURCES_PPC})
source_group("Source\\Sparc" FILES ${SOURCES_SPARC})
Expand All @@ -683,7 +683,7 @@ source_group("Source\\TriCore" FILES ${SOURCES_TRICORE})
source_group("Include\\Common" FILES ${HEADERS_COMMON})
source_group("Include\\Engine" FILES ${HEADERS_ENGINE})
source_group("Include\\ARM" FILES ${HEADERS_ARM})
source_group("Include\\ARM64" FILES ${HEADERS_ARM64})
source_group("Include\\AARCH64" FILES ${HEADERS_AARCH64})
source_group("Include\\Mips" FILES ${HEADERS_MIPS})
source_group("Include\\PowerPC" FILES ${HEADERS_PPC})
source_group("Include\\Sparc" FILES ${HEADERS_SPARC})
Expand Down
2 changes: 1 addition & 1 deletion COMPILE.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Capstone requires no prerequisite packages, so it is easy to compile & install.
(5) Cross-compile for Android

To cross-compile for Android (smartphone/tablet), Android NDK is required.
NOTE: Only ARM and ARM64 are currently supported.
NOTE: Only ARM and AARCH64 are currently supported.

$ NDK=/android/android-ndk-r10e ./make.sh cross-android arm
or
Expand Down
4 changes: 2 additions & 2 deletions COMPILE_CMAKE.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Get CMake for free from http://www.cmake.org.
run "cmake" with the unwanted archs disabled (set to 0) as followings.

- CAPSTONE_ARM_SUPPORT: support ARM. Run cmake with -DCAPSTONE_ARM_SUPPORT=0 to remove ARM.
- CAPSTONE_ARM64_SUPPORT: support ARM64. Run cmake with -DCAPSTONE_ARM64_SUPPORT=0 to remove ARM64.
- CAPSTONE_AARCH64_SUPPORT: support AARCH64. Run cmake with -DCAPSTONE_AARCH64_SUPPORT=0 to remove AARCH64.
- CAPSTONE_M680X_SUPPORT: support M680X. Run cmake with -DCAPSTONE_M680X_SUPPORT=0 to remove M680X.
- CAPSTONE_M68K_SUPPORT: support M68K. Run cmake with -DCAPSTONE_M68K_SUPPORT=0 to remove M68K.
- CAPSTONE_MIPS_SUPPORT: support Mips. Run cmake with -DCAPSTONE_MIPS_SUPPORT=0 to remove Mips.
Expand Down Expand Up @@ -112,7 +112,7 @@ Get CMake for free from http://www.cmake.org.
../cmake.sh x86

Will just target the x86 architecture. The list of available architectures is: ARM,
ARM64, M68K, MIPS, PowerPC, Sparc, SystemZ, XCore, x86, TMS320C64x, M680x, EVM, MOS65XX,
AARCH64, M68K, MIPS, PowerPC, Sparc, SystemZ, XCore, x86, TMS320C64x, M680x, EVM, MOS65XX,
WASM, BPF, RISCV.

(4) You can also create an installation image with cmake, by using the 'install' target.
Expand Down
2 changes: 1 addition & 1 deletion COMPILE_MSVC.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ versions, and Windows Driver Kit 8.1 Update 1 or newer versions are required.
to customize Capstone library, as followings.

- CAPSTONE_HAS_ARM: support ARM. Delete this to remove ARM support.
- CAPSTONE_HAS_ARM64: support ARM64. Delete this to remove ARM64 support.
- CAPSTONE_HAS_AARCH64: support AARCH64. Delete this to remove AARCH64 support.
- CAPSTONE_HAS_M68K: support M68K. Delete this to remove M68K support.
- CAPSTONE_HAS_MIPS: support Mips. Delete this to remove Mips support.
- CAPSTONE_HAS_POWERPC: support PPC. Delete this to remove PPC support.
Expand Down
2 changes: 1 addition & 1 deletion HACK.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Capstone source is organized as followings.

. <- core engine + README + COMPILE.TXT etc
├── arch <- code handling disasm engine for each arch
│   ├── AArch64 <- ARM64 (aka ARMv8) engine
│   ├── AArch64 <- AArch64 engine
│   ├── ARM <- ARM engine
│   ├── BPF <- Berkeley Packet Filter engine
│   ├── EVM <- Ethereum engine
Expand Down
15 changes: 13 additions & 2 deletions MCInst.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void MCOperand_setReg(MCOperand *op, unsigned Reg)
op->RegVal = Reg;
}

int64_t MCOperand_getImm(MCOperand *op)
int64_t MCOperand_getImm(const MCOperand *op)
{
return op->ImmVal;
}
Expand Down Expand Up @@ -281,11 +281,22 @@ uint64_t MCInst_getOpVal(MCInst *MI, unsigned OpNum)
return MCOperand_getImm(op);
else
assert(0 && "Operand type not handled in this getter.");
return false;
return MCOperand_getImm(op);
}

void MCInst_setIsAlias(MCInst *MI, bool Flag) {
assert(MI);
MI->isAliasInstr = Flag;
MI->flat_insn->is_alias = Flag;
}

/// @brief Copies the relevant members of a temporary MCInst to
/// the main MCInst. This is used if TryDecode was run on a temporary MCInst.
/// @param MI The main MCInst
/// @param TmpMI The temporary MCInst.
void MCInst_updateWithTmpMI(MCInst *MI, MCInst *TmpMI) {
MI->size = TmpMI->size;
MI->Opcode = TmpMI->Opcode;
assert(MI->size < MAX_MC_OPS);
memcpy(MI->Operands, TmpMI->Operands, sizeof(MI->Operands[0]) * MI->size);
}
4 changes: 3 additions & 1 deletion MCInst.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ unsigned MCOperand_getReg(const MCOperand *op);
/// setReg - Set the register number.
void MCOperand_setReg(MCOperand *op, unsigned Reg);

int64_t MCOperand_getImm(MCOperand *op);
int64_t MCOperand_getImm(const MCOperand *op);

void MCOperand_setImm(MCOperand *op, int64_t Val);

Expand Down Expand Up @@ -171,4 +171,6 @@ static inline bool MCInst_isAlias(const MCInst *MI) {
return MI->isAliasInstr;
}

void MCInst_updateWithTmpMI(MCInst *MI, MCInst *TmpMI);

#endif
20 changes: 20 additions & 0 deletions MCInstPrinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,27 @@

extern bool ARM_getFeatureBits(unsigned int mode, unsigned int feature);
extern bool PPC_getFeatureBits(unsigned int mode, unsigned int feature);
extern bool AArch64_getFeatureBits(unsigned int mode, unsigned int feature);

static bool testFeatureBits(const MCInst *MI, uint32_t Value)
{
assert(MI && MI->csh);
switch (MI->csh->arch) {
default:
assert(0 && "Not implemented for current arch.");
return false;
#ifdef CAPSTONE_HAS_ARM
case CS_ARCH_ARM:
return ARM_getFeatureBits(MI->csh->mode, Value);
#endif
#ifdef CAPSTONE_HAS_POWERPC
case CS_ARCH_PPC:
return PPC_getFeatureBits(MI->csh->mode, Value);
#endif
#ifdef CAPSTONE_HAS_AARCH64
case CS_ARCH_AARCH64:
return AArch64_getFeatureBits(MI->csh->mode, Value);
#endif
}
}

Expand Down Expand Up @@ -185,6 +195,11 @@ unsigned int binsearch_IndexTypeEncoding(const struct IndexType *index, size_t s
while(left <= right) {
m = (left + right) / 2;
if (encoding == index[m].encoding) {
// LLVM actually uses lower_bound for the index table search
// Here we need to check if a previous entry is of the same encoding
// and return the first one.
while (m > 0 && encoding == index[m - 1].encoding)
--m;
return m;
}

Expand Down Expand Up @@ -218,6 +233,11 @@ unsigned int binsearch_IndexTypeStrEncoding(const struct IndexTypeStr *index, si
while(left <= right) {
m = (left + right) / 2;
if (strcmp(name, index[m].name) == 0) {
// LLVM actually uses lower_bound for the index table search
// Here we need to check if a previous entry is of the same encoding
// and return the first one.
while (m > 0 && (strcmp(name, index[m - 1].name) == 0))
--m;
return m;
}

Expand Down
19 changes: 10 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,15 @@ ifneq (,$(findstring arm,$(CAPSTONE_ARCHS)))
LIBOBJ_ARM += $(LIBSRC_ARM:%.c=$(OBJDIR)/%.o)
endif

DEP_ARM64 =
DEP_ARM64 += $(wildcard arch/AArch64/AArch64*.inc)
DEP_AARCH64 =
DEP_AARCH64 += $(wildcard arch/AArch64/AArch64*.inc)

LIBOBJ_ARM64 =
LIBOBJ_AARCH64 =
ifneq (,$(findstring aarch64,$(CAPSTONE_ARCHS)))
CFLAGS += -DCAPSTONE_HAS_ARM64
LIBSRC_ARM64 += $(wildcard arch/AArch64/AArch64*.c)
LIBOBJ_ARM64 += $(LIBSRC_ARM64:%.c=$(OBJDIR)/%.o)
CFLAGS += -DCAPSTONE_HAS_AARCH64
LIBSRC_AARCH64 += $(wildcard arch/AArch64/AArch64*.c)
LIBOBJ_AARCH64 += $(LIBSRC_AARCH64:%.c=$(OBJDIR)/%.o)
endif


Expand Down Expand Up @@ -327,7 +328,7 @@ endif

LIBOBJ =
LIBOBJ += $(OBJDIR)/cs.o $(OBJDIR)/utils.o $(OBJDIR)/SStream.o $(OBJDIR)/MCInstrDesc.o $(OBJDIR)/MCRegisterInfo.o $(OBJDIR)/MCInst.o $(OBJDIR)/MCInstPrinter.o $(OBJDIR)/Mapping.o
LIBOBJ += $(LIBOBJ_ARM) $(LIBOBJ_ARM64) $(LIBOBJ_M68K) $(LIBOBJ_MIPS) $(LIBOBJ_PPC) $(LIBOBJ_RISCV) $(LIBOBJ_SPARC) $(LIBOBJ_SYSZ) $(LIBOBJ_SH)
LIBOBJ += $(LIBOBJ_ARM) $(LIBOBJ_AARCH64) $(LIBOBJ_M68K) $(LIBOBJ_MIPS) $(LIBOBJ_PPC) $(LIBOBJ_RISCV) $(LIBOBJ_SPARC) $(LIBOBJ_SYSZ) $(LIBOBJ_SH)
LIBOBJ += $(LIBOBJ_X86) $(LIBOBJ_XCORE) $(LIBOBJ_TMS320C64X) $(LIBOBJ_M680X) $(LIBOBJ_EVM) $(LIBOBJ_MOS65XX) $(LIBOBJ_WASM) $(LIBOBJ_BPF)
LIBOBJ += $(LIBOBJ_TRICORE)

Expand Down Expand Up @@ -448,7 +449,7 @@ endif
$(LIBOBJ): config.mk

$(LIBOBJ_ARM): $(DEP_ARM)
$(LIBOBJ_ARM64): $(DEP_ARM64)
$(LIBOBJ_AARCH64): $(DEP_AARCH64)
$(LIBOBJ_M68K): $(DEP_M68K)
$(LIBOBJ_MIPS): $(DEP_MIPS)
$(LIBOBJ_PPC): $(DEP_PPC)
Expand Down Expand Up @@ -550,9 +551,9 @@ dist:
git archive --format=tar.gz --prefix=capstone-$(DIST_VERSION)/ $(TAG) > capstone-$(DIST_VERSION).tgz
git archive --format=zip --prefix=capstone-$(DIST_VERSION)/ $(TAG) > capstone-$(DIST_VERSION).zip

TESTS = test_basic test_detail test_arm test_arm64 test_m68k test_mips test_ppc test_sparc test_tricore
TESTS = test_basic test_detail test_arm test_aarch64 test_m68k test_mips test_ppc test_sparc test_tricore
TESTS += test_systemz test_x86 test_xcore test_iter test_evm test_riscv test_mos65xx test_wasm test_bpf
TESTS += test_basic.static test_detail.static test_arm.static test_arm64.static
TESTS += test_basic.static test_detail.static test_arm.static test_aarch64.static
TESTS += test_m68k.static test_mips.static test_ppc.static test_sparc.static
TESTS += test_systemz.static test_x86.static test_xcore.static test_m680x.static
TESTS += test_skipdata test_skipdata.static test_iter.static test_evm.static test_riscv.static
Expand Down
3 changes: 2 additions & 1 deletion Mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ const cs_ac_type mapping_get_op_access(MCInst *MI, unsigned OpNum,
DEFINE_get_detail_op(arm, ARM);
DEFINE_get_detail_op(ppc, PPC);
DEFINE_get_detail_op(tricore, TriCore);
DEFINE_get_detail_op(aarch64, AArch64);

/// Returns true if for this architecture the
/// alias operands should be filled.
Expand Down Expand Up @@ -363,7 +364,7 @@ void map_set_alias_id(MCInst *MI, const SStream *O, const name_map *alias_mnem_i
for (; j < sizeof(alias_mnem) - 1; ++j, ++i) {
if (!asm_str_buf[i] || asm_str_buf[i] == ' ' || asm_str_buf[i] == '\t')
break;
alias_mnem[j] = O->buffer[i];
alias_mnem[j] = asm_str_buf[i];
}

MI->flat_insn->alias_id = name2id(alias_mnem_id_map, map_size, alias_mnem);
Expand Down
12 changes: 5 additions & 7 deletions Mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ unsigned short insn_find(const insn_map *m, unsigned int max, unsigned int id,
unsigned int find_cs_id(unsigned MC_Opcode, const insn_map *imap,
unsigned imap_size);

#define MAX_NO_DATA_TYPES 10
#define MAX_NO_DATA_TYPES 16

///< A LLVM<->CS Mapping entry of an MCOperand.
typedef struct {
Expand Down Expand Up @@ -120,6 +120,7 @@ void map_cs_id(MCInst *MI, const insn_map *imap, unsigned int imap_size);
DECL_get_detail_op(arm, ARM);
DECL_get_detail_op(ppc, PPC);
DECL_get_detail_op(tricore, TriCore);
DECL_get_detail_op(aarch64, AArch64);

/// Increments the detail->arch.op_count by one.
#define DEFINE_inc_detail_op_count(arch, ARCH) \
Expand All @@ -141,6 +142,8 @@ DEFINE_inc_detail_op_count(ppc, PPC);
DEFINE_dec_detail_op_count(ppc, PPC);
DEFINE_inc_detail_op_count(tricore, TriCore);
DEFINE_dec_detail_op_count(tricore, TriCore);
DEFINE_inc_detail_op_count(aarch64, AArch64);
DEFINE_dec_detail_op_count(aarch64, AArch64);

/// Returns true if a memory operand is currently edited.
static inline bool doing_mem(const MCInst *MI)
Expand All @@ -165,6 +168,7 @@ static inline void set_doing_mem(const MCInst *MI, bool status)
DEFINE_get_arch_detail(arm, ARM);
DEFINE_get_arch_detail(ppc, PPC);
DEFINE_get_arch_detail(tricore, TriCore);
DEFINE_get_arch_detail(aarch64, AArch64);

static inline bool detail_is_set(const MCInst *MI)
{
Expand All @@ -178,12 +182,6 @@ static inline cs_detail *get_detail(const MCInst *MI)
return MI->flat_insn->detail;
}

static inline bool set_detail_ops(const MCInst *MI)
{
assert(MI && MI->flat_insn);
return MI->fillDetailOps;
}

/// Returns if the given instruction is an alias instruction.
#define RETURN_IF_INSN_IS_ALIAS(MI) \
do { \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ disasm engine for binary analysis and reversing in the security community.
Created by Nguyen Anh Quynh, then developed and maintained by a small community,
Capstone offers some unparalleled features:

- Support multiple hardware architectures: ARM, ARM64 (ARMv8), BPF, Ethereum VM,
- Support multiple hardware architectures: ARM, AArch64, BPF, Ethereum VM,
M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH, Sparc, SystemZ,
TMS320C64X, TriCore, Webassembly, XCore and X86 (16, 32, 64).

Expand Down
Loading