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,270 @@
|
|
|
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 <stdio.h>
|
|
9
|
+
#include <stdlib.h>
|
|
10
|
+
#endif
|
|
11
|
+
#include <string.h>
|
|
12
|
+
#include <assert.h>
|
|
13
|
+
|
|
14
|
+
#include "MCInst.h"
|
|
15
|
+
#include "utils.h"
|
|
16
|
+
|
|
17
|
+
#define MCINST_CACHE (ARR_SIZE(mcInst->Operands) - 1)
|
|
18
|
+
|
|
19
|
+
void MCInst_Init(MCInst *inst)
|
|
20
|
+
{
|
|
21
|
+
// unnecessary to initialize in loop . its expensive and inst->size shuold be honored
|
|
22
|
+
inst->Operands[0].Kind = kInvalid;
|
|
23
|
+
inst->Operands[0].ImmVal = 0;
|
|
24
|
+
|
|
25
|
+
inst->Opcode = 0;
|
|
26
|
+
inst->OpcodePub = 0;
|
|
27
|
+
inst->size = 0;
|
|
28
|
+
inst->has_imm = false;
|
|
29
|
+
inst->op1_size = 0;
|
|
30
|
+
inst->writeback = false;
|
|
31
|
+
inst->ac_idx = 0;
|
|
32
|
+
inst->popcode_adjust = 0;
|
|
33
|
+
inst->assembly[0] = '\0';
|
|
34
|
+
inst->wasm_data.type = WASM_OP_INVALID;
|
|
35
|
+
inst->xAcquireRelease = 0;
|
|
36
|
+
for (int i = 0; i < MAX_MC_OPS; ++i)
|
|
37
|
+
inst->tied_op_idx[i] = -1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
void MCInst_clear(MCInst *inst)
|
|
41
|
+
{
|
|
42
|
+
inst->size = 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// does not free @Op
|
|
46
|
+
void MCInst_insert0(MCInst *inst, int index, MCOperand *Op)
|
|
47
|
+
{
|
|
48
|
+
assert(index < MAX_MC_OPS);
|
|
49
|
+
int i;
|
|
50
|
+
|
|
51
|
+
for(i = inst->size; i > index; i--)
|
|
52
|
+
//memcpy(&(inst->Operands[i]), &(inst->Operands[i-1]), sizeof(MCOperand));
|
|
53
|
+
inst->Operands[i] = inst->Operands[i-1];
|
|
54
|
+
|
|
55
|
+
inst->Operands[index] = *Op;
|
|
56
|
+
inst->size++;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
void MCInst_setOpcode(MCInst *inst, unsigned Op)
|
|
60
|
+
{
|
|
61
|
+
inst->Opcode = Op;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
void MCInst_setOpcodePub(MCInst *inst, unsigned Op)
|
|
65
|
+
{
|
|
66
|
+
inst->OpcodePub = Op;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
unsigned MCInst_getOpcode(const MCInst *inst)
|
|
70
|
+
{
|
|
71
|
+
return inst->Opcode;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
unsigned MCInst_getOpcodePub(const MCInst *inst)
|
|
75
|
+
{
|
|
76
|
+
return inst->OpcodePub;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
MCOperand *MCInst_getOperand(MCInst *inst, unsigned i)
|
|
80
|
+
{
|
|
81
|
+
assert(i < MAX_MC_OPS);
|
|
82
|
+
return &inst->Operands[i];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
unsigned MCInst_getNumOperands(const MCInst *inst)
|
|
86
|
+
{
|
|
87
|
+
return inst->size;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// This addOperand2 function doesnt free Op
|
|
91
|
+
void MCInst_addOperand2(MCInst *inst, MCOperand *Op)
|
|
92
|
+
{
|
|
93
|
+
assert(inst->size < MAX_MC_OPS);
|
|
94
|
+
inst->Operands[inst->size] = *Op;
|
|
95
|
+
|
|
96
|
+
inst->size++;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
bool MCOperand_isValid(const MCOperand *op)
|
|
100
|
+
{
|
|
101
|
+
return op->Kind != kInvalid;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
bool MCOperand_isReg(const MCOperand *op)
|
|
105
|
+
{
|
|
106
|
+
return op->Kind == kRegister;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
bool MCOperand_isImm(const MCOperand *op)
|
|
110
|
+
{
|
|
111
|
+
return op->Kind == kImmediate;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
bool MCOperand_isFPImm(const MCOperand *op)
|
|
115
|
+
{
|
|
116
|
+
return op->Kind == kFPImmediate;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
bool MCOperand_isDFPImm(const MCOperand *op)
|
|
120
|
+
{
|
|
121
|
+
return op->Kind == kDFPImmediate;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
bool MCOperand_isExpr(const MCOperand *op)
|
|
125
|
+
{
|
|
126
|
+
return op->Kind == kExpr;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
bool MCOperand_isInst(const MCOperand *op)
|
|
130
|
+
{
|
|
131
|
+
return op->Kind == kInst;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/// getReg - Returns the register number.
|
|
135
|
+
unsigned MCOperand_getReg(const MCOperand *op)
|
|
136
|
+
{
|
|
137
|
+
return op->RegVal;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/// setReg - Set the register number.
|
|
141
|
+
void MCOperand_setReg(MCOperand *op, unsigned Reg)
|
|
142
|
+
{
|
|
143
|
+
op->RegVal = Reg;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
int64_t MCOperand_getImm(MCOperand *op)
|
|
147
|
+
{
|
|
148
|
+
return op->ImmVal;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
void MCOperand_setImm(MCOperand *op, int64_t Val)
|
|
152
|
+
{
|
|
153
|
+
op->ImmVal = Val;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
double MCOperand_getFPImm(const MCOperand *op)
|
|
157
|
+
{
|
|
158
|
+
return op->FPImmVal;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
void MCOperand_setFPImm(MCOperand *op, double Val)
|
|
162
|
+
{
|
|
163
|
+
op->FPImmVal = Val;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
MCOperand *MCOperand_CreateReg1(MCInst *mcInst, unsigned Reg)
|
|
167
|
+
{
|
|
168
|
+
MCOperand *op = &(mcInst->Operands[MCINST_CACHE]);
|
|
169
|
+
|
|
170
|
+
op->MachineOperandType = kRegister;
|
|
171
|
+
op->Kind = kRegister;
|
|
172
|
+
op->RegVal = Reg;
|
|
173
|
+
|
|
174
|
+
return op;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
void MCOperand_CreateReg0(MCInst *mcInst, unsigned Reg)
|
|
178
|
+
{
|
|
179
|
+
MCOperand *op = &(mcInst->Operands[mcInst->size]);
|
|
180
|
+
mcInst->size++;
|
|
181
|
+
|
|
182
|
+
op->MachineOperandType = kRegister;
|
|
183
|
+
op->Kind = kRegister;
|
|
184
|
+
op->RegVal = Reg;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
MCOperand *MCOperand_CreateImm1(MCInst *mcInst, int64_t Val)
|
|
188
|
+
{
|
|
189
|
+
MCOperand *op = &(mcInst->Operands[MCINST_CACHE]);
|
|
190
|
+
|
|
191
|
+
op->MachineOperandType = kImmediate;
|
|
192
|
+
op->Kind = kImmediate;
|
|
193
|
+
op->ImmVal = Val;
|
|
194
|
+
|
|
195
|
+
return op;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
void MCOperand_CreateImm0(MCInst *mcInst, int64_t Val)
|
|
199
|
+
{
|
|
200
|
+
assert(mcInst->size < MAX_MC_OPS);
|
|
201
|
+
MCOperand *op = &(mcInst->Operands[mcInst->size]);
|
|
202
|
+
mcInst->size++;
|
|
203
|
+
|
|
204
|
+
op->MachineOperandType = kImmediate;
|
|
205
|
+
op->Kind = kImmediate;
|
|
206
|
+
op->ImmVal = Val;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/// Check if any operand of the MCInstrDesc is predicable
|
|
210
|
+
bool MCInst_isPredicable(const MCInstrDesc *MIDesc)
|
|
211
|
+
{
|
|
212
|
+
const MCOperandInfo *OpInfo = MIDesc->OpInfo;
|
|
213
|
+
unsigned NumOps = MIDesc->NumOperands;
|
|
214
|
+
for (unsigned i = 0; i < NumOps; ++i) {
|
|
215
|
+
if (MCOperandInfo_isPredicate(&OpInfo[i])) {
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/// Checks if tied operands exist in the instruction and sets
|
|
223
|
+
/// - The writeback flag in detail
|
|
224
|
+
/// - Saves the indices of the tied destination operands.
|
|
225
|
+
void MCInst_handleWriteback(MCInst *MI, const MCInstrDesc *InstDesc)
|
|
226
|
+
{
|
|
227
|
+
const MCOperandInfo *OpInfo = InstDesc[MCInst_getOpcode(MI)].OpInfo;
|
|
228
|
+
unsigned short NumOps = InstDesc[MCInst_getOpcode(MI)].NumOperands;
|
|
229
|
+
|
|
230
|
+
unsigned i;
|
|
231
|
+
for (i = 0; i < NumOps; ++i) {
|
|
232
|
+
if (MCOperandInfo_isTiedToOp(&OpInfo[i])) {
|
|
233
|
+
int idx = MCOperandInfo_getOperandConstraint(
|
|
234
|
+
&InstDesc[MCInst_getOpcode(MI)], i,
|
|
235
|
+
MCOI_TIED_TO);
|
|
236
|
+
|
|
237
|
+
if (idx == -1)
|
|
238
|
+
continue;
|
|
239
|
+
|
|
240
|
+
if (i >= MAX_MC_OPS) {
|
|
241
|
+
assert(0 &&
|
|
242
|
+
"Maximum number of MC operands reached.");
|
|
243
|
+
}
|
|
244
|
+
MI->tied_op_idx[i] = idx;
|
|
245
|
+
|
|
246
|
+
if (MI->flat_insn->detail)
|
|
247
|
+
MI->flat_insn->detail->writeback = true;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/// Check if operand with OpNum is tied by another operand
|
|
253
|
+
/// (operand is tying destination).
|
|
254
|
+
bool MCInst_opIsTied(const MCInst *MI, unsigned OpNum)
|
|
255
|
+
{
|
|
256
|
+
assert(OpNum < MAX_MC_OPS && "Maximum number of MC operands exceeded.");
|
|
257
|
+
for (int i = 0; i < MAX_MC_OPS; ++i) {
|
|
258
|
+
if (MI->tied_op_idx[i] == OpNum)
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/// Check if operand with OpNum is tying another operand
|
|
265
|
+
/// (operand is tying src).
|
|
266
|
+
bool MCInst_opIsTying(const MCInst *MI, unsigned OpNum)
|
|
267
|
+
{
|
|
268
|
+
assert(OpNum < MAX_MC_OPS && "Maximum number of MC operands exceeded.");
|
|
269
|
+
return MI->tied_op_idx[OpNum] != -1;
|
|
270
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
//===-- llvm/MC/MCInst.h - MCInst class -------------------------*- C++ -*-===//
|
|
2
|
+
//
|
|
3
|
+
// The LLVM Compiler Infrastructure
|
|
4
|
+
//
|
|
5
|
+
// This file is distributed under the University of Illinois Open Source
|
|
6
|
+
// License. See LICENSE.TXT for details.
|
|
7
|
+
//
|
|
8
|
+
//===----------------------------------------------------------------------===//
|
|
9
|
+
//
|
|
10
|
+
// This file contains the declaration of the MCInst and MCOperand classes, which
|
|
11
|
+
// is the basic representation used to represent low-level machine code
|
|
12
|
+
// instructions.
|
|
13
|
+
//
|
|
14
|
+
//===----------------------------------------------------------------------===//
|
|
15
|
+
|
|
16
|
+
/* Capstone Disassembly Engine */
|
|
17
|
+
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
|
18
|
+
|
|
19
|
+
#ifndef CS_MCINST_H
|
|
20
|
+
#define CS_MCINST_H
|
|
21
|
+
|
|
22
|
+
#include "include/capstone/capstone.h"
|
|
23
|
+
#include "MCInstrDesc.h"
|
|
24
|
+
#include "MCRegisterInfo.h"
|
|
25
|
+
|
|
26
|
+
typedef struct MCInst MCInst;
|
|
27
|
+
typedef struct cs_struct cs_struct;
|
|
28
|
+
typedef struct MCOperand MCOperand;
|
|
29
|
+
|
|
30
|
+
/// MCOperand - Instances of this class represent operands of the MCInst class.
|
|
31
|
+
/// This is a simple discriminated union.
|
|
32
|
+
struct MCOperand {
|
|
33
|
+
enum {
|
|
34
|
+
kInvalid = 0, ///< Uninitialized.
|
|
35
|
+
kRegister, ///< Register operand.
|
|
36
|
+
kImmediate, ///< Immediate operand.
|
|
37
|
+
kFPImmediate, ///< Floating-point immediate operand.
|
|
38
|
+
kDFPImmediate, ///< Double-Floating-point immediate operand.
|
|
39
|
+
kExpr, ///< Relocatable immediate operand.
|
|
40
|
+
kInst ///< Sub-instruction operand.
|
|
41
|
+
|
|
42
|
+
} MachineOperandType;
|
|
43
|
+
unsigned char Kind;
|
|
44
|
+
|
|
45
|
+
union {
|
|
46
|
+
unsigned RegVal;
|
|
47
|
+
int64_t ImmVal;
|
|
48
|
+
double FPImmVal;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
bool MCOperand_isValid(const MCOperand *op);
|
|
53
|
+
|
|
54
|
+
bool MCOperand_isReg(const MCOperand *op);
|
|
55
|
+
|
|
56
|
+
bool MCOperand_isImm(const MCOperand *op);
|
|
57
|
+
|
|
58
|
+
bool MCOperand_isFPImm(const MCOperand *op);
|
|
59
|
+
|
|
60
|
+
bool MCOperand_isDFPImm(const MCOperand *op);
|
|
61
|
+
|
|
62
|
+
bool MCOperand_isExpr(const MCOperand *op);
|
|
63
|
+
|
|
64
|
+
bool MCOperand_isInst(const MCOperand *op);
|
|
65
|
+
|
|
66
|
+
/// getReg - Returns the register number.
|
|
67
|
+
unsigned MCOperand_getReg(const MCOperand *op);
|
|
68
|
+
|
|
69
|
+
/// setReg - Set the register number.
|
|
70
|
+
void MCOperand_setReg(MCOperand *op, unsigned Reg);
|
|
71
|
+
|
|
72
|
+
int64_t MCOperand_getImm(MCOperand *op);
|
|
73
|
+
|
|
74
|
+
void MCOperand_setImm(MCOperand *op, int64_t Val);
|
|
75
|
+
|
|
76
|
+
double MCOperand_getFPImm(const MCOperand *op);
|
|
77
|
+
|
|
78
|
+
void MCOperand_setFPImm(MCOperand *op, double Val);
|
|
79
|
+
|
|
80
|
+
const MCInst *MCOperand_getInst(const MCOperand *op);
|
|
81
|
+
|
|
82
|
+
void MCOperand_setInst(MCOperand *op, const MCInst *Val);
|
|
83
|
+
|
|
84
|
+
// create Reg operand in the next slot
|
|
85
|
+
void MCOperand_CreateReg0(MCInst *inst, unsigned Reg);
|
|
86
|
+
|
|
87
|
+
// create Reg operand use the last-unused slot
|
|
88
|
+
MCOperand *MCOperand_CreateReg1(MCInst *inst, unsigned Reg);
|
|
89
|
+
|
|
90
|
+
// create Imm operand in the next slot
|
|
91
|
+
void MCOperand_CreateImm0(MCInst *inst, int64_t Val);
|
|
92
|
+
|
|
93
|
+
// create Imm operand in the last-unused slot
|
|
94
|
+
MCOperand *MCOperand_CreateImm1(MCInst *inst, int64_t Val);
|
|
95
|
+
|
|
96
|
+
#define MAX_MC_OPS 48
|
|
97
|
+
|
|
98
|
+
/// MCInst - Instances of this class represent a single low-level machine
|
|
99
|
+
/// instruction.
|
|
100
|
+
struct MCInst {
|
|
101
|
+
unsigned OpcodePub; // public opcode (<arch>_INS_yyy in header files <arch>.h)
|
|
102
|
+
uint8_t size; // number of operands
|
|
103
|
+
bool has_imm; // indicate this instruction has an X86_OP_IMM operand - used for ATT syntax
|
|
104
|
+
uint8_t op1_size; // size of 1st operand - for X86 Intel syntax
|
|
105
|
+
unsigned Opcode; // private opcode
|
|
106
|
+
MCOperand Operands[MAX_MC_OPS];
|
|
107
|
+
cs_insn *flat_insn; // insn to be exposed to public
|
|
108
|
+
uint64_t address; // address of this insn
|
|
109
|
+
cs_struct *csh; // save the main csh
|
|
110
|
+
uint8_t x86opsize; // opsize for [mem] operand
|
|
111
|
+
|
|
112
|
+
// These flags could be used to pass some info from one target subcomponent
|
|
113
|
+
// to another, for example, from disassembler to asm printer. The values of
|
|
114
|
+
// the flags have any sense on target level only (e.g. prefixes on x86).
|
|
115
|
+
unsigned flags;
|
|
116
|
+
|
|
117
|
+
// (Optional) instruction prefix, which can be up to 4 bytes.
|
|
118
|
+
// A prefix byte gets value 0 when irrelevant.
|
|
119
|
+
// This is copied from cs_x86 struct
|
|
120
|
+
uint8_t x86_prefix[4];
|
|
121
|
+
uint8_t imm_size; // immediate size for X86_OP_IMM operand
|
|
122
|
+
bool writeback; // writeback for ARM
|
|
123
|
+
int8_t tied_op_idx
|
|
124
|
+
[MAX_MC_OPS]; ///< Tied operand indices. Index = Src op; Value: Dest op
|
|
125
|
+
// operand access index for list of registers sharing the same access right (for ARM)
|
|
126
|
+
uint8_t ac_idx;
|
|
127
|
+
uint8_t popcode_adjust; // Pseudo X86 instruction adjust
|
|
128
|
+
char assembly[8]; // for special instruction, so that we dont need printer
|
|
129
|
+
unsigned char evm_data[32]; // for EVM PUSH operand
|
|
130
|
+
cs_wasm_op wasm_data; // for WASM operand
|
|
131
|
+
MCRegisterInfo *MRI;
|
|
132
|
+
uint8_t xAcquireRelease; // X86 xacquire/xrelease
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
void MCInst_Init(MCInst *inst);
|
|
136
|
+
|
|
137
|
+
void MCInst_clear(MCInst *inst);
|
|
138
|
+
|
|
139
|
+
// do not free operand after inserting
|
|
140
|
+
void MCInst_insert0(MCInst *inst, int index, MCOperand *Op);
|
|
141
|
+
|
|
142
|
+
void MCInst_setOpcode(MCInst *inst, unsigned Op);
|
|
143
|
+
|
|
144
|
+
unsigned MCInst_getOpcode(const MCInst*);
|
|
145
|
+
|
|
146
|
+
void MCInst_setOpcodePub(MCInst *inst, unsigned Op);
|
|
147
|
+
|
|
148
|
+
unsigned MCInst_getOpcodePub(const MCInst*);
|
|
149
|
+
|
|
150
|
+
MCOperand *MCInst_getOperand(MCInst *inst, unsigned i);
|
|
151
|
+
|
|
152
|
+
unsigned MCInst_getNumOperands(const MCInst *inst);
|
|
153
|
+
|
|
154
|
+
// This addOperand2 function doesnt free Op
|
|
155
|
+
void MCInst_addOperand2(MCInst *inst, MCOperand *Op);
|
|
156
|
+
|
|
157
|
+
bool MCInst_isPredicable(const MCInstrDesc *MIDesc);
|
|
158
|
+
|
|
159
|
+
void MCInst_handleWriteback(MCInst *MI, const MCInstrDesc *InstDesc);
|
|
160
|
+
|
|
161
|
+
bool MCInst_opIsTied(const MCInst *MI, unsigned OpNum);
|
|
162
|
+
|
|
163
|
+
bool MCInst_opIsTying(const MCInst *MI, unsigned OpNum);
|
|
164
|
+
|
|
165
|
+
#endif
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* Capstone Disassembly Engine */
|
|
2
|
+
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
|
3
|
+
|
|
4
|
+
#include "MCInstrDesc.h"
|
|
5
|
+
|
|
6
|
+
/// isPredicate - Set if this is one of the operands that made up of
|
|
7
|
+
/// the predicate operand that controls an isPredicable() instruction.
|
|
8
|
+
bool MCOperandInfo_isPredicate(const MCOperandInfo *m)
|
|
9
|
+
{
|
|
10
|
+
return m->Flags & (1 << MCOI_Predicate);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/// isOptionalDef - Set if this operand is a optional def.
|
|
14
|
+
///
|
|
15
|
+
bool MCOperandInfo_isOptionalDef(const MCOperandInfo *m)
|
|
16
|
+
{
|
|
17
|
+
return m->Flags & (1 << MCOI_OptionalDef);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/// Checks if operand is tied to another one.
|
|
21
|
+
bool MCOperandInfo_isTiedToOp(const MCOperandInfo *m)
|
|
22
|
+
{
|
|
23
|
+
if (m->Constraints & (1 << MCOI_TIED_TO))
|
|
24
|
+
return true;
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/// Returns the value of the specified operand constraint if
|
|
29
|
+
/// it is present. Returns -1 if it is not present.
|
|
30
|
+
int MCOperandInfo_getOperandConstraint(const MCInstrDesc *InstrDesc,
|
|
31
|
+
unsigned OpNum,
|
|
32
|
+
MCOI_OperandConstraint Constraint)
|
|
33
|
+
{
|
|
34
|
+
const MCOperandInfo OpInfo = InstrDesc->OpInfo[OpNum];
|
|
35
|
+
if (OpNum < InstrDesc->NumOperands &&
|
|
36
|
+
(OpInfo.Constraints & (1 << Constraint))) {
|
|
37
|
+
unsigned ValuePos = 4 + Constraint * 4;
|
|
38
|
+
return (OpInfo.Constraints >> ValuePos) & 0xf;
|
|
39
|
+
}
|
|
40
|
+
return -1;
|
|
41
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
//===-- llvm/MC/MCInstrDesc.h - Instruction Descriptors -*- C++ -*-===//
|
|
2
|
+
//
|
|
3
|
+
// The LLVM Compiler Infrastructure
|
|
4
|
+
//
|
|
5
|
+
// This file is distributed under the University of Illinois Open Source
|
|
6
|
+
// License. See LICENSE.TXT for details.
|
|
7
|
+
//
|
|
8
|
+
//===----------------------------------------------------------------------===//
|
|
9
|
+
//
|
|
10
|
+
// This file defines the MCOperandInfo and MCInstrDesc classes, which
|
|
11
|
+
// are used to describe target instructions and their operands.
|
|
12
|
+
//
|
|
13
|
+
//===----------------------------------------------------------------------===//
|
|
14
|
+
|
|
15
|
+
/* Capstone Disassembly Engine */
|
|
16
|
+
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
|
17
|
+
|
|
18
|
+
#ifndef CS_LLVM_MC_MCINSTRDESC_H
|
|
19
|
+
#define CS_LLVM_MC_MCINSTRDESC_H
|
|
20
|
+
|
|
21
|
+
#include "MCRegisterInfo.h"
|
|
22
|
+
#include "capstone/platform.h"
|
|
23
|
+
|
|
24
|
+
//===----------------------------------------------------------------------===//
|
|
25
|
+
// Machine Operand Flags and Description
|
|
26
|
+
//===----------------------------------------------------------------------===//
|
|
27
|
+
|
|
28
|
+
/// Operand constraints. These are encoded in 16 bits with one of the
|
|
29
|
+
/// low-order 3 bits specifying that a constraint is present and the
|
|
30
|
+
/// corresponding high-order hex digit specifying the constraint value.
|
|
31
|
+
/// This allows for a maximum of 3 constraints.
|
|
32
|
+
typedef enum {
|
|
33
|
+
MCOI_TIED_TO = 0, // Operand tied to another operand.
|
|
34
|
+
MCOI_EARLY_CLOBBER // Operand is an early clobber register operand
|
|
35
|
+
} MCOI_OperandConstraint;
|
|
36
|
+
|
|
37
|
+
// Define a macro to produce each constraint value.
|
|
38
|
+
#define CONSTRAINT_MCOI_TIED_TO(op) \
|
|
39
|
+
((1 << MCOI_TIED_TO) | ((op) << (4 + MCOI_TIED_TO * 4)))
|
|
40
|
+
|
|
41
|
+
#define CONSTRAINT_MCOI_EARLY_CLOBBER \
|
|
42
|
+
(1 << MCOI_EARLY_CLOBBER)
|
|
43
|
+
|
|
44
|
+
/// OperandFlags - These are flags set on operands, but should be considered
|
|
45
|
+
/// private, all access should go through the MCOperandInfo accessors.
|
|
46
|
+
/// See the accessors for a description of what these are.
|
|
47
|
+
enum MCOI_OperandFlags {
|
|
48
|
+
MCOI_LookupPtrRegClass = 0,
|
|
49
|
+
MCOI_Predicate,
|
|
50
|
+
MCOI_OptionalDef
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/// Operand Type - Operands are tagged with one of the values of this enum.
|
|
54
|
+
enum MCOI_OperandType {
|
|
55
|
+
MCOI_OPERAND_UNKNOWN = 0,
|
|
56
|
+
MCOI_OPERAND_IMMEDIATE = 1,
|
|
57
|
+
MCOI_OPERAND_REGISTER = 2,
|
|
58
|
+
MCOI_OPERAND_MEMORY = 3,
|
|
59
|
+
MCOI_OPERAND_PCREL = 4,
|
|
60
|
+
|
|
61
|
+
MCOI_OPERAND_FIRST_GENERIC = 6,
|
|
62
|
+
MCOI_OPERAND_GENERIC_0 = 6,
|
|
63
|
+
MCOI_OPERAND_GENERIC_1 = 7,
|
|
64
|
+
MCOI_OPERAND_GENERIC_2 = 8,
|
|
65
|
+
MCOI_OPERAND_GENERIC_3 = 9,
|
|
66
|
+
MCOI_OPERAND_GENERIC_4 = 10,
|
|
67
|
+
MCOI_OPERAND_GENERIC_5 = 11,
|
|
68
|
+
MCOI_OPERAND_LAST_GENERIC = 11,
|
|
69
|
+
|
|
70
|
+
MCOI_OPERAND_FIRST_GENERIC_IMM = 12,
|
|
71
|
+
MCOI_OPERAND_GENERIC_IMM_0 = 12,
|
|
72
|
+
MCOI_OPERAND_LAST_GENERIC_IMM = 12,
|
|
73
|
+
|
|
74
|
+
MCOI_OPERAND_FIRST_TARGET = 13,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
/// MCOperandInfo - This holds information about one operand of a machine
|
|
79
|
+
/// instruction, indicating the register class for register operands, etc.
|
|
80
|
+
///
|
|
81
|
+
typedef struct MCOperandInfo {
|
|
82
|
+
/// This specifies the register class enumeration of the operand
|
|
83
|
+
/// if the operand is a register. If isLookupPtrRegClass is set, then this is
|
|
84
|
+
/// an index that is passed to TargetRegisterInfo::getPointerRegClass(x) to
|
|
85
|
+
/// get a dynamic register class.
|
|
86
|
+
int16_t RegClass;
|
|
87
|
+
|
|
88
|
+
/// These are flags from the MCOI::OperandFlags enum.
|
|
89
|
+
uint8_t Flags;
|
|
90
|
+
|
|
91
|
+
/// Information about the type of the operand.
|
|
92
|
+
uint8_t OperandType;
|
|
93
|
+
|
|
94
|
+
/// The lower 16 bits are used to specify which constraints are set.
|
|
95
|
+
/// The higher 16 bits are used to specify the value of constraints (4 bits each).
|
|
96
|
+
uint32_t Constraints;
|
|
97
|
+
/// Currently no other information.
|
|
98
|
+
} MCOperandInfo;
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
//===----------------------------------------------------------------------===//
|
|
102
|
+
// Machine Instruction Flags and Description
|
|
103
|
+
//===----------------------------------------------------------------------===//
|
|
104
|
+
|
|
105
|
+
/// MCInstrDesc flags - These should be considered private to the
|
|
106
|
+
/// implementation of the MCInstrDesc class. Clients should use the predicate
|
|
107
|
+
/// methods on MCInstrDesc, not use these directly. These all correspond to
|
|
108
|
+
/// bitfields in the MCInstrDesc::Flags field.
|
|
109
|
+
enum {
|
|
110
|
+
MCID_Variadic = 0,
|
|
111
|
+
MCID_HasOptionalDef,
|
|
112
|
+
MCID_Pseudo,
|
|
113
|
+
MCID_Return,
|
|
114
|
+
MCID_Call,
|
|
115
|
+
MCID_Barrier,
|
|
116
|
+
MCID_Terminator,
|
|
117
|
+
MCID_Branch,
|
|
118
|
+
MCID_IndirectBranch,
|
|
119
|
+
MCID_Compare,
|
|
120
|
+
MCID_MoveImm,
|
|
121
|
+
MCID_MoveReg,
|
|
122
|
+
MCID_Bitcast,
|
|
123
|
+
MCID_Select,
|
|
124
|
+
MCID_DelaySlot,
|
|
125
|
+
MCID_FoldableAsLoad,
|
|
126
|
+
MCID_MayLoad,
|
|
127
|
+
MCID_MayStore,
|
|
128
|
+
MCID_Predicable,
|
|
129
|
+
MCID_NotDuplicable,
|
|
130
|
+
MCID_UnmodeledSideEffects,
|
|
131
|
+
MCID_Commutable,
|
|
132
|
+
MCID_ConvertibleTo3Addr,
|
|
133
|
+
MCID_UsesCustomInserter,
|
|
134
|
+
MCID_HasPostISelHook,
|
|
135
|
+
MCID_Rematerializable,
|
|
136
|
+
MCID_CheapAsAMove,
|
|
137
|
+
MCID_ExtraSrcRegAllocReq,
|
|
138
|
+
MCID_ExtraDefRegAllocReq,
|
|
139
|
+
MCID_RegSequence,
|
|
140
|
+
MCID_ExtractSubreg,
|
|
141
|
+
MCID_InsertSubreg,
|
|
142
|
+
MCID_Convergent,
|
|
143
|
+
MCID_Add,
|
|
144
|
+
MCID_Trap,
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/// MCInstrDesc - Describe properties that are true of each instruction in the
|
|
148
|
+
/// target description file. This captures information about side effects,
|
|
149
|
+
/// register use and many other things. There is one instance of this struct
|
|
150
|
+
/// for each target instruction class, and the MachineInstr class points to
|
|
151
|
+
/// this struct directly to describe itself.
|
|
152
|
+
typedef struct MCInstrDesc {
|
|
153
|
+
unsigned char NumOperands; // Num of args (may be more if variable_ops)
|
|
154
|
+
const MCOperandInfo *OpInfo; // 'NumOperands' entries about operands
|
|
155
|
+
} MCInstrDesc;
|
|
156
|
+
|
|
157
|
+
bool MCOperandInfo_isPredicate(const MCOperandInfo *m);
|
|
158
|
+
|
|
159
|
+
bool MCOperandInfo_isOptionalDef(const MCOperandInfo *m);
|
|
160
|
+
|
|
161
|
+
bool MCOperandInfo_isTiedToOp(const MCOperandInfo *m);
|
|
162
|
+
|
|
163
|
+
int MCOperandInfo_getOperandConstraint(const MCInstrDesc *OpInfo,
|
|
164
|
+
unsigned OpNum,
|
|
165
|
+
MCOI_OperandConstraint Constraint);
|
|
166
|
+
|
|
167
|
+
#endif
|