hexcore-capstone 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +26 -0
- package/README.md +191 -0
- package/binding.gyp +168 -0
- package/deps/capstone/LEB128.h +38 -0
- package/deps/capstone/MCDisassembler.h +14 -0
- package/deps/capstone/MCFixedLenDisassembler.h +32 -0
- package/deps/capstone/MCInst.c +270 -0
- package/deps/capstone/MCInst.h +165 -0
- package/deps/capstone/MCInstrDesc.c +41 -0
- package/deps/capstone/MCInstrDesc.h +167 -0
- package/deps/capstone/MCRegisterInfo.c +151 -0
- package/deps/capstone/MCRegisterInfo.h +116 -0
- package/deps/capstone/Mapping.c +254 -0
- package/deps/capstone/Mapping.h +174 -0
- package/deps/capstone/MathExtras.h +442 -0
- package/deps/capstone/SStream.c +181 -0
- package/deps/capstone/SStream.h +40 -0
- package/deps/capstone/arch/AArch64/AArch64AddressingModes.h +945 -0
- package/deps/capstone/arch/AArch64/AArch64BaseInfo.c +77 -0
- package/deps/capstone/arch/AArch64/AArch64BaseInfo.h +585 -0
- package/deps/capstone/arch/AArch64/AArch64Disassembler.c +2280 -0
- package/deps/capstone/arch/AArch64/AArch64Disassembler.h +18 -0
- package/deps/capstone/arch/AArch64/AArch64GenAsmWriter.inc +26589 -0
- package/deps/capstone/arch/AArch64/AArch64GenDisassemblerTables.inc +27322 -0
- package/deps/capstone/arch/AArch64/AArch64GenInstrInfo.inc +13194 -0
- package/deps/capstone/arch/AArch64/AArch64GenRegisterInfo.inc +3814 -0
- package/deps/capstone/arch/AArch64/AArch64GenRegisterName.inc +714 -0
- package/deps/capstone/arch/AArch64/AArch64GenRegisterV.inc +673 -0
- package/deps/capstone/arch/AArch64/AArch64GenSubtargetInfo.inc +229 -0
- package/deps/capstone/arch/AArch64/AArch64GenSystemOperands.inc +2863 -0
- package/deps/capstone/arch/AArch64/AArch64GenSystemOperands_enum.inc +21 -0
- package/deps/capstone/arch/AArch64/AArch64InstPrinter.c +3029 -0
- package/deps/capstone/arch/AArch64/AArch64InstPrinter.h +28 -0
- package/deps/capstone/arch/AArch64/AArch64Mapping.c +883 -0
- package/deps/capstone/arch/AArch64/AArch64Mapping.h +43 -0
- package/deps/capstone/arch/AArch64/AArch64MappingInsn.inc +37790 -0
- package/deps/capstone/arch/AArch64/AArch64MappingInsnName.inc +1282 -0
- package/deps/capstone/arch/AArch64/AArch64MappingInsnOp.inc +26994 -0
- package/deps/capstone/arch/AArch64/AArch64Module.c +44 -0
- package/deps/capstone/arch/AArch64/AArch64Module.h +12 -0
- package/deps/capstone/arch/ARM/ARMAddressingModes.h +698 -0
- package/deps/capstone/arch/ARM/ARMBaseInfo.h +486 -0
- package/deps/capstone/arch/ARM/ARMDisassembler.c +5763 -0
- package/deps/capstone/arch/ARM/ARMDisassembler.h +18 -0
- package/deps/capstone/arch/ARM/ARMGenAsmWriter.inc +9545 -0
- package/deps/capstone/arch/ARM/ARMGenDisassemblerTables.inc +15185 -0
- package/deps/capstone/arch/ARM/ARMGenInstrInfo.inc +6632 -0
- package/deps/capstone/arch/ARM/ARMGenRegisterInfo.inc +2102 -0
- package/deps/capstone/arch/ARM/ARMGenRegisterName.inc +231 -0
- package/deps/capstone/arch/ARM/ARMGenRegisterName_digit.inc +231 -0
- package/deps/capstone/arch/ARM/ARMGenSubtargetInfo.inc +162 -0
- package/deps/capstone/arch/ARM/ARMGenSystemRegister.inc +270 -0
- package/deps/capstone/arch/ARM/ARMInstPrinter.c +3364 -0
- package/deps/capstone/arch/ARM/ARMInstPrinter.h +43 -0
- package/deps/capstone/arch/ARM/ARMMapping.c +551 -0
- package/deps/capstone/arch/ARM/ARMMapping.h +40 -0
- package/deps/capstone/arch/ARM/ARMMappingInsn.inc +18772 -0
- package/deps/capstone/arch/ARM/ARMMappingInsnName.inc +475 -0
- package/deps/capstone/arch/ARM/ARMMappingInsnOp.inc +10729 -0
- package/deps/capstone/arch/ARM/ARMModule.c +63 -0
- package/deps/capstone/arch/ARM/ARMModule.h +12 -0
- package/deps/capstone/arch/BPF/BPFConstants.h +88 -0
- package/deps/capstone/arch/BPF/BPFDisassembler.c +464 -0
- package/deps/capstone/arch/BPF/BPFDisassembler.h +27 -0
- package/deps/capstone/arch/BPF/BPFInstPrinter.c +285 -0
- package/deps/capstone/arch/BPF/BPFInstPrinter.h +16 -0
- package/deps/capstone/arch/BPF/BPFMapping.c +513 -0
- package/deps/capstone/arch/BPF/BPFMapping.h +21 -0
- package/deps/capstone/arch/BPF/BPFModule.c +34 -0
- package/deps/capstone/arch/BPF/BPFModule.h +12 -0
- package/deps/capstone/arch/EVM/EVMDisassembler.c +379 -0
- package/deps/capstone/arch/EVM/EVMDisassembler.h +12 -0
- package/deps/capstone/arch/EVM/EVMInstPrinter.c +20 -0
- package/deps/capstone/arch/EVM/EVMInstPrinter.h +17 -0
- package/deps/capstone/arch/EVM/EVMMapping.c +344 -0
- package/deps/capstone/arch/EVM/EVMMapping.h +8 -0
- package/deps/capstone/arch/EVM/EVMMappingInsn.inc +259 -0
- package/deps/capstone/arch/EVM/EVMModule.c +33 -0
- package/deps/capstone/arch/EVM/EVMModule.h +12 -0
- package/deps/capstone/arch/M680X/M680XDisassembler.c +2307 -0
- package/deps/capstone/arch/M680X/M680XDisassembler.h +17 -0
- package/deps/capstone/arch/M680X/M680XDisassemblerInternals.h +57 -0
- package/deps/capstone/arch/M680X/M680XInstPrinter.c +360 -0
- package/deps/capstone/arch/M680X/M680XInstPrinter.h +25 -0
- package/deps/capstone/arch/M680X/M680XModule.c +77 -0
- package/deps/capstone/arch/M680X/M680XModule.h +12 -0
- package/deps/capstone/arch/M680X/cpu12.inc +335 -0
- package/deps/capstone/arch/M680X/hcs08.inc +60 -0
- package/deps/capstone/arch/M680X/hd6301.inc +15 -0
- package/deps/capstone/arch/M680X/hd6309.inc +259 -0
- package/deps/capstone/arch/M680X/insn_props.inc +367 -0
- package/deps/capstone/arch/M680X/m6800.inc +277 -0
- package/deps/capstone/arch/M680X/m6801.inc +39 -0
- package/deps/capstone/arch/M680X/m6805.inc +277 -0
- package/deps/capstone/arch/M680X/m6808.inc +91 -0
- package/deps/capstone/arch/M680X/m6809.inc +352 -0
- package/deps/capstone/arch/M680X/m6811.inc +105 -0
- package/deps/capstone/arch/M68K/M68KDisassembler.c +3668 -0
- package/deps/capstone/arch/M68K/M68KDisassembler.h +30 -0
- package/deps/capstone/arch/M68K/M68KInstPrinter.c +387 -0
- package/deps/capstone/arch/M68K/M68KInstPrinter.h +21 -0
- package/deps/capstone/arch/M68K/M68KInstructionTable.inc +65540 -0
- package/deps/capstone/arch/M68K/M68KModule.c +42 -0
- package/deps/capstone/arch/M68K/M68KModule.h +12 -0
- package/deps/capstone/arch/MOS65XX/MOS65XXDisassembler.c +544 -0
- package/deps/capstone/arch/MOS65XX/MOS65XXDisassembler.h +22 -0
- package/deps/capstone/arch/MOS65XX/MOS65XXDisassemblerInternals.h +23 -0
- package/deps/capstone/arch/MOS65XX/MOS65XXModule.c +79 -0
- package/deps/capstone/arch/MOS65XX/MOS65XXModule.h +12 -0
- package/deps/capstone/arch/MOS65XX/instruction_info.inc +106 -0
- package/deps/capstone/arch/MOS65XX/m6502.inc +256 -0
- package/deps/capstone/arch/MOS65XX/m65816.inc +256 -0
- package/deps/capstone/arch/MOS65XX/m65c02.inc +256 -0
- package/deps/capstone/arch/MOS65XX/mw65c02.inc +256 -0
- package/deps/capstone/arch/Mips/MipsDisassembler.c +1794 -0
- package/deps/capstone/arch/Mips/MipsDisassembler.h +16 -0
- package/deps/capstone/arch/Mips/MipsGenAsmWriter.inc +5725 -0
- package/deps/capstone/arch/Mips/MipsGenDisassemblerTables.inc +6942 -0
- package/deps/capstone/arch/Mips/MipsGenInstrInfo.inc +1805 -0
- package/deps/capstone/arch/Mips/MipsGenRegisterInfo.inc +1679 -0
- package/deps/capstone/arch/Mips/MipsGenSubtargetInfo.inc +52 -0
- package/deps/capstone/arch/Mips/MipsInstPrinter.c +424 -0
- package/deps/capstone/arch/Mips/MipsInstPrinter.h +25 -0
- package/deps/capstone/arch/Mips/MipsMapping.c +1070 -0
- package/deps/capstone/arch/Mips/MipsMapping.h +25 -0
- package/deps/capstone/arch/Mips/MipsMappingInsn.inc +9315 -0
- package/deps/capstone/arch/Mips/MipsModule.c +52 -0
- package/deps/capstone/arch/Mips/MipsModule.h +12 -0
- package/deps/capstone/arch/PowerPC/PPCDisassembler.c +627 -0
- package/deps/capstone/arch/PowerPC/PPCDisassembler.h +17 -0
- package/deps/capstone/arch/PowerPC/PPCGenAsmWriter.inc +11451 -0
- package/deps/capstone/arch/PowerPC/PPCGenDisassemblerTables.inc +6886 -0
- package/deps/capstone/arch/PowerPC/PPCGenInstrInfo.inc +4772 -0
- package/deps/capstone/arch/PowerPC/PPCGenRegisterInfo.inc +1122 -0
- package/deps/capstone/arch/PowerPC/PPCGenRegisterName.inc +278 -0
- package/deps/capstone/arch/PowerPC/PPCGenSubtargetInfo.inc +90 -0
- package/deps/capstone/arch/PowerPC/PPCInstPrinter.c +1238 -0
- package/deps/capstone/arch/PowerPC/PPCInstPrinter.h +15 -0
- package/deps/capstone/arch/PowerPC/PPCMapping.c +570 -0
- package/deps/capstone/arch/PowerPC/PPCMapping.h +40 -0
- package/deps/capstone/arch/PowerPC/PPCMappingInsn.inc +13220 -0
- package/deps/capstone/arch/PowerPC/PPCMappingInsnName.inc +1731 -0
- package/deps/capstone/arch/PowerPC/PPCModule.c +45 -0
- package/deps/capstone/arch/PowerPC/PPCModule.h +12 -0
- package/deps/capstone/arch/PowerPC/PPCPredicates.h +62 -0
- package/deps/capstone/arch/RISCV/RISCVBaseInfo.h +106 -0
- package/deps/capstone/arch/RISCV/RISCVDisassembler.c +433 -0
- package/deps/capstone/arch/RISCV/RISCVDisassembler.h +18 -0
- package/deps/capstone/arch/RISCV/RISCVGenAsmWriter.inc +2651 -0
- package/deps/capstone/arch/RISCV/RISCVGenDisassemblerTables.inc +1776 -0
- package/deps/capstone/arch/RISCV/RISCVGenInsnNameMaps.inc +275 -0
- package/deps/capstone/arch/RISCV/RISCVGenInstrInfo.inc +470 -0
- package/deps/capstone/arch/RISCV/RISCVGenRegisterInfo.inc +426 -0
- package/deps/capstone/arch/RISCV/RISCVGenSubtargetInfo.inc +33 -0
- package/deps/capstone/arch/RISCV/RISCVInstPrinter.c +447 -0
- package/deps/capstone/arch/RISCV/RISCVInstPrinter.h +24 -0
- package/deps/capstone/arch/RISCV/RISCVMapping.c +366 -0
- package/deps/capstone/arch/RISCV/RISCVMapping.h +22 -0
- package/deps/capstone/arch/RISCV/RISCVMappingInsn.inc +1635 -0
- package/deps/capstone/arch/RISCV/RISCVModule.c +42 -0
- package/deps/capstone/arch/RISCV/RISCVModule.h +12 -0
- package/deps/capstone/arch/SH/SHDisassembler.c +2221 -0
- package/deps/capstone/arch/SH/SHDisassembler.h +19 -0
- package/deps/capstone/arch/SH/SHInsnTable.inc +66 -0
- package/deps/capstone/arch/SH/SHInstPrinter.c +438 -0
- package/deps/capstone/arch/SH/SHInstPrinter.h +23 -0
- package/deps/capstone/arch/SH/SHModule.c +39 -0
- package/deps/capstone/arch/SH/SHModule.h +12 -0
- package/deps/capstone/arch/SH/mktable.rb +390 -0
- package/deps/capstone/arch/Sparc/Sparc.h +63 -0
- package/deps/capstone/arch/Sparc/SparcDisassembler.c +500 -0
- package/deps/capstone/arch/Sparc/SparcDisassembler.h +17 -0
- package/deps/capstone/arch/Sparc/SparcGenAsmWriter.inc +5709 -0
- package/deps/capstone/arch/Sparc/SparcGenDisassemblerTables.inc +2028 -0
- package/deps/capstone/arch/Sparc/SparcGenInstrInfo.inc +514 -0
- package/deps/capstone/arch/Sparc/SparcGenRegisterInfo.inc +451 -0
- package/deps/capstone/arch/Sparc/SparcGenSubtargetInfo.inc +27 -0
- package/deps/capstone/arch/Sparc/SparcInstPrinter.c +446 -0
- package/deps/capstone/arch/Sparc/SparcInstPrinter.h +17 -0
- package/deps/capstone/arch/Sparc/SparcMapping.c +665 -0
- package/deps/capstone/arch/Sparc/SparcMapping.h +34 -0
- package/deps/capstone/arch/Sparc/SparcMappingInsn.inc +2643 -0
- package/deps/capstone/arch/Sparc/SparcModule.c +45 -0
- package/deps/capstone/arch/Sparc/SparcModule.h +12 -0
- package/deps/capstone/arch/SystemZ/SystemZDisassembler.c +484 -0
- package/deps/capstone/arch/SystemZ/SystemZDisassembler.h +17 -0
- package/deps/capstone/arch/SystemZ/SystemZGenAsmWriter.inc +11575 -0
- package/deps/capstone/arch/SystemZ/SystemZGenDisassemblerTables.inc +10262 -0
- package/deps/capstone/arch/SystemZ/SystemZGenInsnNameMaps.inc +2348 -0
- package/deps/capstone/arch/SystemZ/SystemZGenInstrInfo.inc +2820 -0
- package/deps/capstone/arch/SystemZ/SystemZGenRegisterInfo.inc +741 -0
- package/deps/capstone/arch/SystemZ/SystemZGenSubtargetInfo.inc +49 -0
- package/deps/capstone/arch/SystemZ/SystemZInstPrinter.c +433 -0
- package/deps/capstone/arch/SystemZ/SystemZInstPrinter.h +15 -0
- package/deps/capstone/arch/SystemZ/SystemZMCTargetDesc.c +195 -0
- package/deps/capstone/arch/SystemZ/SystemZMCTargetDesc.h +51 -0
- package/deps/capstone/arch/SystemZ/SystemZMapping.c +479 -0
- package/deps/capstone/arch/SystemZ/SystemZMapping.h +23 -0
- package/deps/capstone/arch/SystemZ/SystemZMappingInsn.inc +14175 -0
- package/deps/capstone/arch/SystemZ/SystemZModule.c +44 -0
- package/deps/capstone/arch/SystemZ/SystemZModule.h +12 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xDisassembler.c +628 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xDisassembler.h +19 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xGenAsmWriter.inc +684 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xGenDisassemblerTables.inc +1352 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xGenInstrInfo.inc +298 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xGenRegisterInfo.inc +277 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xInstPrinter.c +572 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xInstPrinter.h +15 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xMapping.c +1926 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xMapping.h +26 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xModule.c +39 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xModule.h +12 -0
- package/deps/capstone/arch/TriCore/TriCore.td +134 -0
- package/deps/capstone/arch/TriCore/TriCoreCallingConv.td +61 -0
- package/deps/capstone/arch/TriCore/TriCoreDisassembler.c +1655 -0
- package/deps/capstone/arch/TriCore/TriCoreDisassembler.h +18 -0
- package/deps/capstone/arch/TriCore/TriCoreGenAsmWriter.inc +3691 -0
- package/deps/capstone/arch/TriCore/TriCoreGenCSFeatureName.inc +22 -0
- package/deps/capstone/arch/TriCore/TriCoreGenCSMappingInsn.inc +8938 -0
- package/deps/capstone/arch/TriCore/TriCoreGenCSMappingInsnName.inc +404 -0
- package/deps/capstone/arch/TriCore/TriCoreGenCSMappingInsnOp.inc +7994 -0
- package/deps/capstone/arch/TriCore/TriCoreGenCSOpGroup.inc +32 -0
- package/deps/capstone/arch/TriCore/TriCoreGenDisassemblerTables.inc +4044 -0
- package/deps/capstone/arch/TriCore/TriCoreGenInstrInfo.inc +2693 -0
- package/deps/capstone/arch/TriCore/TriCoreGenRegisterInfo.inc +295 -0
- package/deps/capstone/arch/TriCore/TriCoreGenSubtargetInfo.inc +40 -0
- package/deps/capstone/arch/TriCore/TriCoreInstPrinter.c +488 -0
- package/deps/capstone/arch/TriCore/TriCoreInstrFormats.td +773 -0
- package/deps/capstone/arch/TriCore/TriCoreInstrInfo.td +1873 -0
- package/deps/capstone/arch/TriCore/TriCoreLinkage.h +21 -0
- package/deps/capstone/arch/TriCore/TriCoreMapping.c +241 -0
- package/deps/capstone/arch/TriCore/TriCoreMapping.h +32 -0
- package/deps/capstone/arch/TriCore/TriCoreModule.c +44 -0
- package/deps/capstone/arch/TriCore/TriCoreModule.h +11 -0
- package/deps/capstone/arch/TriCore/TriCoreRegisterInfo.td +153 -0
- package/deps/capstone/arch/WASM/WASMDisassembler.c +1009 -0
- package/deps/capstone/arch/WASM/WASMDisassembler.h +12 -0
- package/deps/capstone/arch/WASM/WASMInstPrinter.c +47 -0
- package/deps/capstone/arch/WASM/WASMInstPrinter.h +18 -0
- package/deps/capstone/arch/WASM/WASMMapping.c +333 -0
- package/deps/capstone/arch/WASM/WASMMapping.h +9 -0
- package/deps/capstone/arch/WASM/WASMModule.c +33 -0
- package/deps/capstone/arch/WASM/WASMModule.h +12 -0
- package/deps/capstone/arch/X86/X86ATTInstPrinter.c +997 -0
- package/deps/capstone/arch/X86/X86BaseInfo.h +50 -0
- package/deps/capstone/arch/X86/X86Disassembler.c +1033 -0
- package/deps/capstone/arch/X86/X86Disassembler.h +28 -0
- package/deps/capstone/arch/X86/X86DisassemblerDecoder.c +2358 -0
- package/deps/capstone/arch/X86/X86DisassemblerDecoder.h +725 -0
- package/deps/capstone/arch/X86/X86DisassemblerDecoderCommon.h +483 -0
- package/deps/capstone/arch/X86/X86GenAsmWriter.inc +49199 -0
- package/deps/capstone/arch/X86/X86GenAsmWriter1.inc +33196 -0
- package/deps/capstone/arch/X86/X86GenAsmWriter1_reduce.inc +2531 -0
- package/deps/capstone/arch/X86/X86GenAsmWriter_reduce.inc +2855 -0
- package/deps/capstone/arch/X86/X86GenDisassemblerTables.inc +112961 -0
- package/deps/capstone/arch/X86/X86GenDisassemblerTables2.inc +102151 -0
- package/deps/capstone/arch/X86/X86GenDisassemblerTables_reduce.inc +28047 -0
- package/deps/capstone/arch/X86/X86GenDisassemblerTables_reduce2.inc +18827 -0
- package/deps/capstone/arch/X86/X86GenInstrInfo.inc +15158 -0
- package/deps/capstone/arch/X86/X86GenInstrInfo_reduce.inc +1564 -0
- package/deps/capstone/arch/X86/X86GenRegisterInfo.inc +1549 -0
- package/deps/capstone/arch/X86/X86GenRegisterName.inc +292 -0
- package/deps/capstone/arch/X86/X86GenRegisterName1.inc +291 -0
- package/deps/capstone/arch/X86/X86ImmSize.inc +335 -0
- package/deps/capstone/arch/X86/X86InstPrinter.h +26 -0
- package/deps/capstone/arch/X86/X86InstPrinterCommon.c +116 -0
- package/deps/capstone/arch/X86/X86InstPrinterCommon.h +16 -0
- package/deps/capstone/arch/X86/X86IntelInstPrinter.c +1061 -0
- package/deps/capstone/arch/X86/X86Lookup16.inc +16874 -0
- package/deps/capstone/arch/X86/X86Lookup16_reduce.inc +2308 -0
- package/deps/capstone/arch/X86/X86Mapping.c +2266 -0
- package/deps/capstone/arch/X86/X86Mapping.h +96 -0
- package/deps/capstone/arch/X86/X86MappingInsn.inc +105977 -0
- package/deps/capstone/arch/X86/X86MappingInsnName.inc +1527 -0
- package/deps/capstone/arch/X86/X86MappingInsnName_reduce.inc +348 -0
- package/deps/capstone/arch/X86/X86MappingInsnOp.inc +75700 -0
- package/deps/capstone/arch/X86/X86MappingInsnOp_reduce.inc +7729 -0
- package/deps/capstone/arch/X86/X86MappingInsn_reduce.inc +10819 -0
- package/deps/capstone/arch/X86/X86MappingReg.inc +280 -0
- package/deps/capstone/arch/X86/X86Module.c +94 -0
- package/deps/capstone/arch/X86/X86Module.h +12 -0
- package/deps/capstone/arch/XCore/XCoreDisassembler.c +794 -0
- package/deps/capstone/arch/XCore/XCoreDisassembler.h +17 -0
- package/deps/capstone/arch/XCore/XCoreGenAsmWriter.inc +772 -0
- package/deps/capstone/arch/XCore/XCoreGenDisassemblerTables.inc +853 -0
- package/deps/capstone/arch/XCore/XCoreGenInstrInfo.inc +267 -0
- package/deps/capstone/arch/XCore/XCoreGenRegisterInfo.inc +110 -0
- package/deps/capstone/arch/XCore/XCoreInstPrinter.c +250 -0
- package/deps/capstone/arch/XCore/XCoreInstPrinter.h +18 -0
- package/deps/capstone/arch/XCore/XCoreMapping.c +297 -0
- package/deps/capstone/arch/XCore/XCoreMapping.h +26 -0
- package/deps/capstone/arch/XCore/XCoreMappingInsn.inc +1287 -0
- package/deps/capstone/arch/XCore/XCoreModule.c +41 -0
- package/deps/capstone/arch/XCore/XCoreModule.h +12 -0
- package/deps/capstone/cs.c +1664 -0
- package/deps/capstone/cs_priv.h +101 -0
- package/deps/capstone/cs_simple_types.h +886 -0
- package/deps/capstone/include/capstone/arm.h +991 -0
- package/deps/capstone/include/capstone/arm64.h +3159 -0
- package/deps/capstone/include/capstone/bpf.h +209 -0
- package/deps/capstone/include/capstone/capstone.h +875 -0
- package/deps/capstone/include/capstone/evm.h +188 -0
- package/deps/capstone/include/capstone/m680x.h +537 -0
- package/deps/capstone/include/capstone/m68k.h +613 -0
- package/deps/capstone/include/capstone/mips.h +956 -0
- package/deps/capstone/include/capstone/mos65xx.h +204 -0
- package/deps/capstone/include/capstone/platform.h +122 -0
- package/deps/capstone/include/capstone/ppc.h +2108 -0
- package/deps/capstone/include/capstone/riscv.h +531 -0
- package/deps/capstone/include/capstone/sh.h +465 -0
- package/deps/capstone/include/capstone/sparc.h +520 -0
- package/deps/capstone/include/capstone/systemz.h +2601 -0
- package/deps/capstone/include/capstone/tms320c64x.h +359 -0
- package/deps/capstone/include/capstone/tricore.h +567 -0
- package/deps/capstone/include/capstone/wasm.h +250 -0
- package/deps/capstone/include/capstone/x86.h +1986 -0
- package/deps/capstone/include/capstone/xcore.h +235 -0
- package/deps/capstone/include/platform.h +110 -0
- package/deps/capstone/include/windowsce/intrin.h +12 -0
- package/deps/capstone/include/windowsce/stdint.h +133 -0
- package/deps/capstone/utils.c +140 -0
- package/deps/capstone/utils.h +54 -0
- package/index.d.ts +448 -0
- package/index.js +64 -0
- package/index.mjs +25 -0
- package/package.json +82 -0
- package/prebuilds/win32-x64/hexcore-capstone.node +0 -0
- package/src/capstone_wrapper.cpp +910 -0
- package/src/capstone_wrapper.h +147 -0
- package/src/disasm_async_worker.h +215 -0
- package/src/main.cpp +145 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
#ifndef CAPSTONE_XCORE_H
|
|
2
|
+
#define CAPSTONE_XCORE_H
|
|
3
|
+
|
|
4
|
+
/* Capstone Disassembly Engine */
|
|
5
|
+
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2014-2015 */
|
|
6
|
+
|
|
7
|
+
#ifdef __cplusplus
|
|
8
|
+
extern "C" {
|
|
9
|
+
#endif
|
|
10
|
+
|
|
11
|
+
#include "platform.h"
|
|
12
|
+
|
|
13
|
+
#ifdef _MSC_VER
|
|
14
|
+
#pragma warning(disable:4201)
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
/// Operand type for instruction's operands
|
|
18
|
+
typedef enum xcore_op_type {
|
|
19
|
+
XCORE_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized).
|
|
20
|
+
XCORE_OP_REG, ///< = CS_OP_REG (Register operand).
|
|
21
|
+
XCORE_OP_IMM, ///< = CS_OP_IMM (Immediate operand).
|
|
22
|
+
XCORE_OP_MEM, ///< = CS_OP_MEM (Memory operand).
|
|
23
|
+
} xcore_op_type;
|
|
24
|
+
|
|
25
|
+
/// XCore registers
|
|
26
|
+
typedef enum xcore_reg {
|
|
27
|
+
XCORE_REG_INVALID = 0,
|
|
28
|
+
|
|
29
|
+
XCORE_REG_CP,
|
|
30
|
+
XCORE_REG_DP,
|
|
31
|
+
XCORE_REG_LR,
|
|
32
|
+
XCORE_REG_SP,
|
|
33
|
+
XCORE_REG_R0,
|
|
34
|
+
XCORE_REG_R1,
|
|
35
|
+
XCORE_REG_R2,
|
|
36
|
+
XCORE_REG_R3,
|
|
37
|
+
XCORE_REG_R4,
|
|
38
|
+
XCORE_REG_R5,
|
|
39
|
+
XCORE_REG_R6,
|
|
40
|
+
XCORE_REG_R7,
|
|
41
|
+
XCORE_REG_R8,
|
|
42
|
+
XCORE_REG_R9,
|
|
43
|
+
XCORE_REG_R10,
|
|
44
|
+
XCORE_REG_R11,
|
|
45
|
+
|
|
46
|
+
// pseudo registers
|
|
47
|
+
XCORE_REG_PC, ///< pc
|
|
48
|
+
|
|
49
|
+
// internal thread registers
|
|
50
|
+
// see The-XMOS-XS1-Architecture(X7879A).pdf
|
|
51
|
+
XCORE_REG_SCP, ///< save pc
|
|
52
|
+
XCORE_REG_SSR, //< save status
|
|
53
|
+
XCORE_REG_ET, //< exception type
|
|
54
|
+
XCORE_REG_ED, //< exception data
|
|
55
|
+
XCORE_REG_SED, //< save exception data
|
|
56
|
+
XCORE_REG_KEP, //< kernel entry pointer
|
|
57
|
+
XCORE_REG_KSP, //< kernel stack pointer
|
|
58
|
+
XCORE_REG_ID, //< thread ID
|
|
59
|
+
|
|
60
|
+
XCORE_REG_ENDING, // <-- mark the end of the list of registers
|
|
61
|
+
} xcore_reg;
|
|
62
|
+
|
|
63
|
+
/// Instruction's operand referring to memory
|
|
64
|
+
/// This is associated with XCORE_OP_MEM operand type above
|
|
65
|
+
typedef struct xcore_op_mem {
|
|
66
|
+
uint8_t base; ///< base register, can be safely interpreted as
|
|
67
|
+
///< a value of type `xcore_reg`, but it is only
|
|
68
|
+
///< one byte wide
|
|
69
|
+
uint8_t index; ///< index register, same conditions apply here
|
|
70
|
+
int32_t disp; ///< displacement/offset value
|
|
71
|
+
int direct; ///< +1: forward, -1: backward
|
|
72
|
+
} xcore_op_mem;
|
|
73
|
+
|
|
74
|
+
/// Instruction operand
|
|
75
|
+
typedef struct cs_xcore_op {
|
|
76
|
+
xcore_op_type type; ///< operand type
|
|
77
|
+
union {
|
|
78
|
+
xcore_reg reg; ///< register value for REG operand
|
|
79
|
+
int32_t imm; ///< immediate value for IMM operand
|
|
80
|
+
xcore_op_mem mem; ///< base/disp value for MEM operand
|
|
81
|
+
};
|
|
82
|
+
} cs_xcore_op;
|
|
83
|
+
|
|
84
|
+
/// Instruction structure
|
|
85
|
+
typedef struct cs_xcore {
|
|
86
|
+
/// Number of operands of this instruction,
|
|
87
|
+
/// or 0 when instruction has no operand.
|
|
88
|
+
uint8_t op_count;
|
|
89
|
+
cs_xcore_op operands[8]; ///< operands for this instruction.
|
|
90
|
+
} cs_xcore;
|
|
91
|
+
|
|
92
|
+
/// XCore instruction
|
|
93
|
+
typedef enum xcore_insn {
|
|
94
|
+
XCORE_INS_INVALID = 0,
|
|
95
|
+
|
|
96
|
+
XCORE_INS_ADD,
|
|
97
|
+
XCORE_INS_ANDNOT,
|
|
98
|
+
XCORE_INS_AND,
|
|
99
|
+
XCORE_INS_ASHR,
|
|
100
|
+
XCORE_INS_BAU,
|
|
101
|
+
XCORE_INS_BITREV,
|
|
102
|
+
XCORE_INS_BLA,
|
|
103
|
+
XCORE_INS_BLAT,
|
|
104
|
+
XCORE_INS_BL,
|
|
105
|
+
XCORE_INS_BF,
|
|
106
|
+
XCORE_INS_BT,
|
|
107
|
+
XCORE_INS_BU,
|
|
108
|
+
XCORE_INS_BRU,
|
|
109
|
+
XCORE_INS_BYTEREV,
|
|
110
|
+
XCORE_INS_CHKCT,
|
|
111
|
+
XCORE_INS_CLRE,
|
|
112
|
+
XCORE_INS_CLRPT,
|
|
113
|
+
XCORE_INS_CLRSR,
|
|
114
|
+
XCORE_INS_CLZ,
|
|
115
|
+
XCORE_INS_CRC8,
|
|
116
|
+
XCORE_INS_CRC32,
|
|
117
|
+
XCORE_INS_DCALL,
|
|
118
|
+
XCORE_INS_DENTSP,
|
|
119
|
+
XCORE_INS_DGETREG,
|
|
120
|
+
XCORE_INS_DIVS,
|
|
121
|
+
XCORE_INS_DIVU,
|
|
122
|
+
XCORE_INS_DRESTSP,
|
|
123
|
+
XCORE_INS_DRET,
|
|
124
|
+
XCORE_INS_ECALLF,
|
|
125
|
+
XCORE_INS_ECALLT,
|
|
126
|
+
XCORE_INS_EDU,
|
|
127
|
+
XCORE_INS_EEF,
|
|
128
|
+
XCORE_INS_EET,
|
|
129
|
+
XCORE_INS_EEU,
|
|
130
|
+
XCORE_INS_ENDIN,
|
|
131
|
+
XCORE_INS_ENTSP,
|
|
132
|
+
XCORE_INS_EQ,
|
|
133
|
+
XCORE_INS_EXTDP,
|
|
134
|
+
XCORE_INS_EXTSP,
|
|
135
|
+
XCORE_INS_FREER,
|
|
136
|
+
XCORE_INS_FREET,
|
|
137
|
+
XCORE_INS_GETD,
|
|
138
|
+
XCORE_INS_GET,
|
|
139
|
+
XCORE_INS_GETN,
|
|
140
|
+
XCORE_INS_GETR,
|
|
141
|
+
XCORE_INS_GETSR,
|
|
142
|
+
XCORE_INS_GETST,
|
|
143
|
+
XCORE_INS_GETTS,
|
|
144
|
+
XCORE_INS_INCT,
|
|
145
|
+
XCORE_INS_INIT,
|
|
146
|
+
XCORE_INS_INPW,
|
|
147
|
+
XCORE_INS_INSHR,
|
|
148
|
+
XCORE_INS_INT,
|
|
149
|
+
XCORE_INS_IN,
|
|
150
|
+
XCORE_INS_KCALL,
|
|
151
|
+
XCORE_INS_KENTSP,
|
|
152
|
+
XCORE_INS_KRESTSP,
|
|
153
|
+
XCORE_INS_KRET,
|
|
154
|
+
XCORE_INS_LADD,
|
|
155
|
+
XCORE_INS_LD16S,
|
|
156
|
+
XCORE_INS_LD8U,
|
|
157
|
+
XCORE_INS_LDA16,
|
|
158
|
+
XCORE_INS_LDAP,
|
|
159
|
+
XCORE_INS_LDAW,
|
|
160
|
+
XCORE_INS_LDC,
|
|
161
|
+
XCORE_INS_LDW,
|
|
162
|
+
XCORE_INS_LDIVU,
|
|
163
|
+
XCORE_INS_LMUL,
|
|
164
|
+
XCORE_INS_LSS,
|
|
165
|
+
XCORE_INS_LSUB,
|
|
166
|
+
XCORE_INS_LSU,
|
|
167
|
+
XCORE_INS_MACCS,
|
|
168
|
+
XCORE_INS_MACCU,
|
|
169
|
+
XCORE_INS_MJOIN,
|
|
170
|
+
XCORE_INS_MKMSK,
|
|
171
|
+
XCORE_INS_MSYNC,
|
|
172
|
+
XCORE_INS_MUL,
|
|
173
|
+
XCORE_INS_NEG,
|
|
174
|
+
XCORE_INS_NOT,
|
|
175
|
+
XCORE_INS_OR,
|
|
176
|
+
XCORE_INS_OUTCT,
|
|
177
|
+
XCORE_INS_OUTPW,
|
|
178
|
+
XCORE_INS_OUTSHR,
|
|
179
|
+
XCORE_INS_OUTT,
|
|
180
|
+
XCORE_INS_OUT,
|
|
181
|
+
XCORE_INS_PEEK,
|
|
182
|
+
XCORE_INS_REMS,
|
|
183
|
+
XCORE_INS_REMU,
|
|
184
|
+
XCORE_INS_RETSP,
|
|
185
|
+
XCORE_INS_SETCLK,
|
|
186
|
+
XCORE_INS_SET,
|
|
187
|
+
XCORE_INS_SETC,
|
|
188
|
+
XCORE_INS_SETD,
|
|
189
|
+
XCORE_INS_SETEV,
|
|
190
|
+
XCORE_INS_SETN,
|
|
191
|
+
XCORE_INS_SETPSC,
|
|
192
|
+
XCORE_INS_SETPT,
|
|
193
|
+
XCORE_INS_SETRDY,
|
|
194
|
+
XCORE_INS_SETSR,
|
|
195
|
+
XCORE_INS_SETTW,
|
|
196
|
+
XCORE_INS_SETV,
|
|
197
|
+
XCORE_INS_SEXT,
|
|
198
|
+
XCORE_INS_SHL,
|
|
199
|
+
XCORE_INS_SHR,
|
|
200
|
+
XCORE_INS_SSYNC,
|
|
201
|
+
XCORE_INS_ST16,
|
|
202
|
+
XCORE_INS_ST8,
|
|
203
|
+
XCORE_INS_STW,
|
|
204
|
+
XCORE_INS_SUB,
|
|
205
|
+
XCORE_INS_SYNCR,
|
|
206
|
+
XCORE_INS_TESTCT,
|
|
207
|
+
XCORE_INS_TESTLCL,
|
|
208
|
+
XCORE_INS_TESTWCT,
|
|
209
|
+
XCORE_INS_TSETMR,
|
|
210
|
+
XCORE_INS_START,
|
|
211
|
+
XCORE_INS_WAITEF,
|
|
212
|
+
XCORE_INS_WAITET,
|
|
213
|
+
XCORE_INS_WAITEU,
|
|
214
|
+
XCORE_INS_XOR,
|
|
215
|
+
XCORE_INS_ZEXT,
|
|
216
|
+
|
|
217
|
+
XCORE_INS_ENDING, // <-- mark the end of the list of instructions
|
|
218
|
+
} xcore_insn;
|
|
219
|
+
|
|
220
|
+
/// Group of XCore instructions
|
|
221
|
+
typedef enum xcore_insn_group {
|
|
222
|
+
XCORE_GRP_INVALID = 0, ///< = CS_GRP_INVALID
|
|
223
|
+
|
|
224
|
+
// Generic groups
|
|
225
|
+
// all jump instructions (conditional+direct+indirect jumps)
|
|
226
|
+
XCORE_GRP_JUMP, ///< = CS_GRP_JUMP
|
|
227
|
+
|
|
228
|
+
XCORE_GRP_ENDING, // <-- mark the end of the list of groups
|
|
229
|
+
} xcore_insn_group;
|
|
230
|
+
|
|
231
|
+
#ifdef __cplusplus
|
|
232
|
+
}
|
|
233
|
+
#endif
|
|
234
|
+
|
|
235
|
+
#endif
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/* Capstone Disassembly Engine */
|
|
2
|
+
/* By Axel Souchet & Nguyen Anh Quynh, 2014 */
|
|
3
|
+
|
|
4
|
+
#ifndef CAPSTONE_PLATFORM_H
|
|
5
|
+
#define CAPSTONE_PLATFORM_H
|
|
6
|
+
|
|
7
|
+
// handle C99 issue (for pre-2013 VisualStudio)
|
|
8
|
+
#if !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__MINGW64__) && (defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64))
|
|
9
|
+
// MSVC
|
|
10
|
+
|
|
11
|
+
// stdbool.h
|
|
12
|
+
#if (_MSC_VER < 1800) || defined(_KERNEL_MODE)
|
|
13
|
+
// this system does not have stdbool.h
|
|
14
|
+
#ifndef __cplusplus
|
|
15
|
+
typedef unsigned char bool;
|
|
16
|
+
#define false 0
|
|
17
|
+
#define true 1
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
#else
|
|
21
|
+
// VisualStudio 2013+ -> C99 is supported
|
|
22
|
+
#include <stdbool.h>
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
#else
|
|
26
|
+
// not MSVC -> C99 is supported
|
|
27
|
+
#include <stdbool.h>
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
// handle C99 issue (for pre-2013 VisualStudio)
|
|
32
|
+
#if defined(CAPSTONE_HAS_OSXKERNEL) || (defined(_MSC_VER) && (_MSC_VER <= 1700 || defined(_KERNEL_MODE)))
|
|
33
|
+
// this system does not have inttypes.h
|
|
34
|
+
|
|
35
|
+
#if defined(_MSC_VER) && (_MSC_VER < 1600 || defined(_KERNEL_MODE))
|
|
36
|
+
// this system does not have stdint.h
|
|
37
|
+
typedef signed char int8_t;
|
|
38
|
+
typedef signed short int16_t;
|
|
39
|
+
typedef signed int int32_t;
|
|
40
|
+
typedef unsigned char uint8_t;
|
|
41
|
+
typedef unsigned short uint16_t;
|
|
42
|
+
typedef unsigned int uint32_t;
|
|
43
|
+
typedef signed long long int64_t;
|
|
44
|
+
typedef unsigned long long uint64_t;
|
|
45
|
+
|
|
46
|
+
#define INT8_MIN (-127i8 - 1)
|
|
47
|
+
#define INT16_MIN (-32767i16 - 1)
|
|
48
|
+
#define INT32_MIN (-2147483647i32 - 1)
|
|
49
|
+
#define INT64_MIN (-9223372036854775807i64 - 1)
|
|
50
|
+
#define INT8_MAX 127i8
|
|
51
|
+
#define INT16_MAX 32767i16
|
|
52
|
+
#define INT32_MAX 2147483647i32
|
|
53
|
+
#define INT64_MAX 9223372036854775807i64
|
|
54
|
+
#define UINT8_MAX 0xffui8
|
|
55
|
+
#define UINT16_MAX 0xffffui16
|
|
56
|
+
#define UINT32_MAX 0xffffffffui32
|
|
57
|
+
#define UINT64_MAX 0xffffffffffffffffui64
|
|
58
|
+
#endif
|
|
59
|
+
|
|
60
|
+
#define __PRI_8_LENGTH_MODIFIER__ "hh"
|
|
61
|
+
#define __PRI_64_LENGTH_MODIFIER__ "ll"
|
|
62
|
+
|
|
63
|
+
#define PRId8 __PRI_8_LENGTH_MODIFIER__ "d"
|
|
64
|
+
#define PRIi8 __PRI_8_LENGTH_MODIFIER__ "i"
|
|
65
|
+
#define PRIo8 __PRI_8_LENGTH_MODIFIER__ "o"
|
|
66
|
+
#define PRIu8 __PRI_8_LENGTH_MODIFIER__ "u"
|
|
67
|
+
#define PRIx8 __PRI_8_LENGTH_MODIFIER__ "x"
|
|
68
|
+
#define PRIX8 __PRI_8_LENGTH_MODIFIER__ "X"
|
|
69
|
+
|
|
70
|
+
#define PRId16 "hd"
|
|
71
|
+
#define PRIi16 "hi"
|
|
72
|
+
#define PRIo16 "ho"
|
|
73
|
+
#define PRIu16 "hu"
|
|
74
|
+
#define PRIx16 "hx"
|
|
75
|
+
#define PRIX16 "hX"
|
|
76
|
+
|
|
77
|
+
#if defined(_MSC_VER) && _MSC_VER <= 1700
|
|
78
|
+
#define PRId32 "ld"
|
|
79
|
+
#define PRIi32 "li"
|
|
80
|
+
#define PRIo32 "lo"
|
|
81
|
+
#define PRIu32 "lu"
|
|
82
|
+
#define PRIx32 "lx"
|
|
83
|
+
#define PRIX32 "lX"
|
|
84
|
+
#else // OSX
|
|
85
|
+
#define PRId32 "d"
|
|
86
|
+
#define PRIi32 "i"
|
|
87
|
+
#define PRIo32 "o"
|
|
88
|
+
#define PRIu32 "u"
|
|
89
|
+
#define PRIx32 "x"
|
|
90
|
+
#define PRIX32 "X"
|
|
91
|
+
#endif
|
|
92
|
+
|
|
93
|
+
#if defined(_MSC_VER) && _MSC_VER <= 1700
|
|
94
|
+
// redefine functions from inttypes.h used in cstool
|
|
95
|
+
#define strtoull _strtoui64
|
|
96
|
+
#endif
|
|
97
|
+
|
|
98
|
+
#define PRId64 __PRI_64_LENGTH_MODIFIER__ "d"
|
|
99
|
+
#define PRIi64 __PRI_64_LENGTH_MODIFIER__ "i"
|
|
100
|
+
#define PRIo64 __PRI_64_LENGTH_MODIFIER__ "o"
|
|
101
|
+
#define PRIu64 __PRI_64_LENGTH_MODIFIER__ "u"
|
|
102
|
+
#define PRIx64 __PRI_64_LENGTH_MODIFIER__ "x"
|
|
103
|
+
#define PRIX64 __PRI_64_LENGTH_MODIFIER__ "X"
|
|
104
|
+
|
|
105
|
+
#else
|
|
106
|
+
// this system has inttypes.h by default
|
|
107
|
+
#include <inttypes.h>
|
|
108
|
+
#endif
|
|
109
|
+
|
|
110
|
+
#endif
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
#if defined(_MSC_VER) && defined(_WIN32_WCE) && (_WIN32_WCE < 0x800) && !defined(__INTRIN_H_) && !defined(_INTRIN)
|
|
3
|
+
#define _STDINT
|
|
4
|
+
|
|
5
|
+
#ifdef _M_ARM
|
|
6
|
+
#include <armintr.h>
|
|
7
|
+
#if (_WIN32_WCE >= 0x700) && defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__)
|
|
8
|
+
#include <arm_neon.h>
|
|
9
|
+
#endif
|
|
10
|
+
#endif // _M_ARM
|
|
11
|
+
|
|
12
|
+
#endif
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
|
|
2
|
+
#if defined(_MSC_VER) && defined(_WIN32_WCE) && (_WIN32_WCE < 0x800) && !defined(_STDINT_H_) && !defined(_STDINT)
|
|
3
|
+
#define _STDINT
|
|
4
|
+
|
|
5
|
+
typedef __int8
|
|
6
|
+
int8_t,
|
|
7
|
+
int_least8_t;
|
|
8
|
+
|
|
9
|
+
typedef __int16
|
|
10
|
+
int16_t,
|
|
11
|
+
int_least16_t;
|
|
12
|
+
|
|
13
|
+
typedef __int32
|
|
14
|
+
int32_t,
|
|
15
|
+
int_least32_t,
|
|
16
|
+
int_fast8_t,
|
|
17
|
+
int_fast16_t,
|
|
18
|
+
int_fast32_t;
|
|
19
|
+
|
|
20
|
+
typedef __int64
|
|
21
|
+
int64_t,
|
|
22
|
+
intmax_t,
|
|
23
|
+
int_least64_t,
|
|
24
|
+
int_fast64_t;
|
|
25
|
+
|
|
26
|
+
typedef unsigned __int8
|
|
27
|
+
uint8_t,
|
|
28
|
+
uint_least8_t;
|
|
29
|
+
|
|
30
|
+
typedef unsigned __int16
|
|
31
|
+
uint16_t,
|
|
32
|
+
uint_least16_t;
|
|
33
|
+
|
|
34
|
+
typedef unsigned __int32
|
|
35
|
+
uint32_t,
|
|
36
|
+
uint_least32_t,
|
|
37
|
+
uint_fast8_t,
|
|
38
|
+
uint_fast16_t,
|
|
39
|
+
uint_fast32_t;
|
|
40
|
+
|
|
41
|
+
typedef unsigned __int64
|
|
42
|
+
uint64_t,
|
|
43
|
+
uintmax_t,
|
|
44
|
+
uint_least64_t,
|
|
45
|
+
uint_fast64_t;
|
|
46
|
+
|
|
47
|
+
#ifndef _INTPTR_T_DEFINED
|
|
48
|
+
#define _INTPTR_T_DEFINED
|
|
49
|
+
typedef __int32 intptr_t;
|
|
50
|
+
#endif
|
|
51
|
+
|
|
52
|
+
#ifndef _UINTPTR_T_DEFINED
|
|
53
|
+
#define _UINTPTR_T_DEFINED
|
|
54
|
+
typedef unsigned __int32 uintptr_t;
|
|
55
|
+
#endif
|
|
56
|
+
|
|
57
|
+
#define INT8_MIN (-127i8 - 1)
|
|
58
|
+
#define INT16_MIN (-32767i16 - 1)
|
|
59
|
+
#define INT32_MIN (-2147483647i32 - 1)
|
|
60
|
+
#define INT64_MIN (-9223372036854775807i64 - 1)
|
|
61
|
+
#define INT8_MAX 127i8
|
|
62
|
+
#define INT16_MAX 32767i16
|
|
63
|
+
#define INT32_MAX 2147483647i32
|
|
64
|
+
#define INT64_MAX 9223372036854775807i64
|
|
65
|
+
#define UINT8_MAX 0xffui8
|
|
66
|
+
#define UINT16_MAX 0xffffui16
|
|
67
|
+
#define UINT32_MAX 0xffffffffui32
|
|
68
|
+
#define UINT64_MAX 0xffffffffffffffffui64
|
|
69
|
+
|
|
70
|
+
#define INT_LEAST8_MIN INT8_MIN
|
|
71
|
+
#define INT_LEAST16_MIN INT16_MIN
|
|
72
|
+
#define INT_LEAST32_MIN INT32_MIN
|
|
73
|
+
#define INT_LEAST64_MIN INT64_MIN
|
|
74
|
+
#define INT_LEAST8_MAX INT8_MAX
|
|
75
|
+
#define INT_LEAST16_MAX INT16_MAX
|
|
76
|
+
#define INT_LEAST32_MAX INT32_MAX
|
|
77
|
+
#define INT_LEAST64_MAX INT64_MAX
|
|
78
|
+
#define UINT_LEAST8_MAX UINT8_MAX
|
|
79
|
+
#define UINT_LEAST16_MAX UINT16_MAX
|
|
80
|
+
#define UINT_LEAST32_MAX UINT32_MAX
|
|
81
|
+
#define UINT_LEAST64_MAX UINT64_MAX
|
|
82
|
+
|
|
83
|
+
#define INT_FAST8_MIN INT8_MIN
|
|
84
|
+
#define INT_FAST16_MIN INT32_MIN
|
|
85
|
+
#define INT_FAST32_MIN INT32_MIN
|
|
86
|
+
#define INT_FAST64_MIN INT64_MIN
|
|
87
|
+
#define INT_FAST8_MAX INT8_MAX
|
|
88
|
+
#define INT_FAST16_MAX INT32_MAX
|
|
89
|
+
#define INT_FAST32_MAX INT32_MAX
|
|
90
|
+
#define INT_FAST64_MAX INT64_MAX
|
|
91
|
+
#define UINT_FAST8_MAX UINT8_MAX
|
|
92
|
+
#define UINT_FAST16_MAX UINT32_MAX
|
|
93
|
+
#define UINT_FAST32_MAX UINT32_MAX
|
|
94
|
+
#define UINT_FAST64_MAX UINT64_MAX
|
|
95
|
+
|
|
96
|
+
#define INTPTR_MIN INT32_MIN
|
|
97
|
+
#define INTPTR_MAX INT32_MAX
|
|
98
|
+
#define UINTPTR_MAX UINT32_MAX
|
|
99
|
+
|
|
100
|
+
#define INTMAX_MIN INT64_MIN
|
|
101
|
+
#define INTMAX_MAX INT64_MAX
|
|
102
|
+
#define UINTMAX_MAX UINT64_MAX
|
|
103
|
+
|
|
104
|
+
#define PTRDIFF_MIN INTPTR_MIN
|
|
105
|
+
#define PTRDIFF_MAX INTPTR_MAX
|
|
106
|
+
|
|
107
|
+
#ifndef SIZE_MAX
|
|
108
|
+
#define SIZE_MAX UINTPTR_MAX
|
|
109
|
+
#endif
|
|
110
|
+
|
|
111
|
+
#define SIG_ATOMIC_MIN INT32_MIN
|
|
112
|
+
#define SIG_ATOMIC_MAX INT32_MAX
|
|
113
|
+
|
|
114
|
+
#define WCHAR_MIN 0x0000
|
|
115
|
+
#define WCHAR_MAX 0xffff
|
|
116
|
+
|
|
117
|
+
#define WINT_MIN 0x0000
|
|
118
|
+
#define WINT_MAX 0xffff
|
|
119
|
+
|
|
120
|
+
#define INT8_C(x) (x)
|
|
121
|
+
#define INT16_C(x) (x)
|
|
122
|
+
#define INT32_C(x) (x)
|
|
123
|
+
#define INT64_C(x) (x ## LL)
|
|
124
|
+
|
|
125
|
+
#define UINT8_C(x) (x)
|
|
126
|
+
#define UINT16_C(x) (x)
|
|
127
|
+
#define UINT32_C(x) (x ## U)
|
|
128
|
+
#define UINT64_C(x) (x ## ULL)
|
|
129
|
+
|
|
130
|
+
#define INTMAX_C(x) INT64_C(x)
|
|
131
|
+
#define UINTMAX_C(x) UINT64_C(x)
|
|
132
|
+
|
|
133
|
+
#endif
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/* Capstone Disassembly Engine */
|
|
2
|
+
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
|
3
|
+
|
|
4
|
+
#if defined(CAPSTONE_HAS_OSXKERNEL)
|
|
5
|
+
#include <Availability.h>
|
|
6
|
+
#include <libkern/libkern.h>
|
|
7
|
+
#else
|
|
8
|
+
#include <stdlib.h>
|
|
9
|
+
#endif
|
|
10
|
+
#include <string.h>
|
|
11
|
+
|
|
12
|
+
#include "utils.h"
|
|
13
|
+
|
|
14
|
+
// count number of positive members in a list.
|
|
15
|
+
// NOTE: list must be guaranteed to end in 0
|
|
16
|
+
unsigned int count_positive(const uint16_t *list)
|
|
17
|
+
{
|
|
18
|
+
unsigned int c;
|
|
19
|
+
|
|
20
|
+
for (c = 0; list[c] > 0; c++);
|
|
21
|
+
|
|
22
|
+
return c;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// count number of positive members in a list.
|
|
26
|
+
// NOTE: list must be guaranteed to end in 0
|
|
27
|
+
unsigned int count_positive8(const unsigned char *list)
|
|
28
|
+
{
|
|
29
|
+
unsigned int c;
|
|
30
|
+
|
|
31
|
+
for (c = 0; list[c] > 0; c++);
|
|
32
|
+
|
|
33
|
+
return c;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
char *cs_strdup(const char *str)
|
|
37
|
+
{
|
|
38
|
+
size_t len = strlen(str) + 1;
|
|
39
|
+
void *new = cs_mem_malloc(len);
|
|
40
|
+
|
|
41
|
+
if (new == NULL)
|
|
42
|
+
return NULL;
|
|
43
|
+
|
|
44
|
+
return (char *)memmove(new, str, len);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// we need this since Windows doesn't have snprintf()
|
|
48
|
+
int cs_snprintf(char *buffer, size_t size, const char *fmt, ...)
|
|
49
|
+
{
|
|
50
|
+
int ret;
|
|
51
|
+
|
|
52
|
+
va_list ap;
|
|
53
|
+
va_start(ap, fmt);
|
|
54
|
+
ret = cs_vsnprintf(buffer, size, fmt, ap);
|
|
55
|
+
va_end(ap);
|
|
56
|
+
|
|
57
|
+
return ret;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
bool arr_exist8(unsigned char *arr, unsigned char max, unsigned int id)
|
|
61
|
+
{
|
|
62
|
+
int i;
|
|
63
|
+
|
|
64
|
+
for (i = 0; i < max; i++) {
|
|
65
|
+
if (arr[i] == id)
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
bool arr_exist(uint16_t *arr, unsigned char max, unsigned int id)
|
|
73
|
+
{
|
|
74
|
+
int i;
|
|
75
|
+
|
|
76
|
+
for (i = 0; i < max; i++) {
|
|
77
|
+
if (arr[i] == id)
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// binary search for encoding in IndexType array
|
|
85
|
+
// return -1 if not found, or index if found
|
|
86
|
+
unsigned int binsearch_IndexTypeEncoding(const struct IndexType *index, size_t size, uint16_t encoding)
|
|
87
|
+
{
|
|
88
|
+
// binary searching since the index is sorted in encoding order
|
|
89
|
+
size_t left, right, m;
|
|
90
|
+
|
|
91
|
+
right = size - 1;
|
|
92
|
+
|
|
93
|
+
if (encoding < index[0].encoding || encoding > index[right].encoding)
|
|
94
|
+
// not found
|
|
95
|
+
return -1;
|
|
96
|
+
|
|
97
|
+
left = 0;
|
|
98
|
+
|
|
99
|
+
while(left <= right) {
|
|
100
|
+
m = (left + right) / 2;
|
|
101
|
+
if (encoding == index[m].encoding) {
|
|
102
|
+
return m;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (encoding < index[m].encoding)
|
|
106
|
+
right = m - 1;
|
|
107
|
+
else
|
|
108
|
+
left = m + 1;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// not found
|
|
112
|
+
return -1;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/// Reads 4 bytes in the endian order specified in MI->cs->mode.
|
|
116
|
+
uint32_t readBytes32(MCInst *MI, const uint8_t *Bytes)
|
|
117
|
+
{
|
|
118
|
+
assert(MI && Bytes);
|
|
119
|
+
uint32_t Insn;
|
|
120
|
+
if (MODE_IS_BIG_ENDIAN(MI->csh->mode))
|
|
121
|
+
Insn = (Bytes[3] << 0) | (Bytes[2] << 8) | (Bytes[1] << 16) |
|
|
122
|
+
((uint32_t)Bytes[0] << 24);
|
|
123
|
+
else
|
|
124
|
+
Insn = ((uint32_t)Bytes[3] << 24) | (Bytes[2] << 16) |
|
|
125
|
+
(Bytes[1] << 8) | (Bytes[0] << 0);
|
|
126
|
+
return Insn;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/// Reads 2 bytes in the endian order specified in MI->cs->mode.
|
|
130
|
+
uint16_t readBytes16(MCInst *MI, const uint8_t *Bytes)
|
|
131
|
+
{
|
|
132
|
+
assert(MI && Bytes);
|
|
133
|
+
uint16_t Insn;
|
|
134
|
+
if (MODE_IS_BIG_ENDIAN(MI->csh->mode))
|
|
135
|
+
Insn = (Bytes[0] << 8) | Bytes[1];
|
|
136
|
+
else
|
|
137
|
+
Insn = (Bytes[1] << 8) | Bytes[0];
|
|
138
|
+
|
|
139
|
+
return Insn;
|
|
140
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* Capstone Disassembly Engine */
|
|
2
|
+
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
|
3
|
+
|
|
4
|
+
#ifndef CS_UTILS_H
|
|
5
|
+
#define CS_UTILS_H
|
|
6
|
+
|
|
7
|
+
#if defined(CAPSTONE_HAS_OSXKERNEL)
|
|
8
|
+
#include <libkern/libkern.h>
|
|
9
|
+
#else
|
|
10
|
+
#include <stddef.h>
|
|
11
|
+
#include "include/capstone/capstone.h"
|
|
12
|
+
#endif
|
|
13
|
+
#include "cs_priv.h"
|
|
14
|
+
#include "Mapping.h"
|
|
15
|
+
|
|
16
|
+
// threshold number, so above this number will be printed in hexa mode
|
|
17
|
+
#define HEX_THRESHOLD 9
|
|
18
|
+
|
|
19
|
+
// count number of positive members in a list.
|
|
20
|
+
// NOTE: list must be guaranteed to end in 0
|
|
21
|
+
unsigned int count_positive(const uint16_t *list);
|
|
22
|
+
unsigned int count_positive8(const unsigned char *list);
|
|
23
|
+
|
|
24
|
+
#define ARR_SIZE(a) (sizeof(a)/sizeof(a[0]))
|
|
25
|
+
#define MATRIX_SIZE(a) (sizeof(a[0])/sizeof(a[0][0]))
|
|
26
|
+
|
|
27
|
+
char *cs_strdup(const char *str);
|
|
28
|
+
|
|
29
|
+
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
|
30
|
+
|
|
31
|
+
// we need this since Windows doesn't have snprintf()
|
|
32
|
+
int cs_snprintf(char *buffer, size_t size, const char *fmt, ...);
|
|
33
|
+
|
|
34
|
+
#define CS_AC_IGNORE (1 << 7)
|
|
35
|
+
|
|
36
|
+
// check if an id is existent in an array
|
|
37
|
+
bool arr_exist8(unsigned char *arr, unsigned char max, unsigned int id);
|
|
38
|
+
|
|
39
|
+
bool arr_exist(uint16_t *arr, unsigned char max, unsigned int id);
|
|
40
|
+
|
|
41
|
+
struct IndexType {
|
|
42
|
+
uint16_t encoding;
|
|
43
|
+
unsigned index;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// binary search for encoding in IndexType array
|
|
47
|
+
// return -1 if not found, or index if found
|
|
48
|
+
unsigned int binsearch_IndexTypeEncoding(const struct IndexType *index, size_t size, uint16_t encoding);
|
|
49
|
+
|
|
50
|
+
uint16_t readBytes16(MCInst *MI, const uint8_t *Bytes);
|
|
51
|
+
uint32_t readBytes32(MCInst *MI, const uint8_t *Bytes);
|
|
52
|
+
|
|
53
|
+
#endif
|
|
54
|
+
|