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,52 @@
|
|
|
1
|
+
/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|
|
2
|
+
|* *|
|
|
3
|
+
|*Subtarget Enumeration Source Fragment *|
|
|
4
|
+
|* *|
|
|
5
|
+
|* Automatically generated file, do not edit! *|
|
|
6
|
+
|* *|
|
|
7
|
+
\*===----------------------------------------------------------------------===*/
|
|
8
|
+
|
|
9
|
+
/* Capstone Disassembly Engine, http://www.capstone-engine.org */
|
|
10
|
+
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
#ifdef GET_SUBTARGETINFO_ENUM
|
|
14
|
+
#undef GET_SUBTARGETINFO_ENUM
|
|
15
|
+
|
|
16
|
+
#define Mips_FeatureCnMips (1ULL << 0)
|
|
17
|
+
#define Mips_FeatureDSP (1ULL << 1)
|
|
18
|
+
#define Mips_FeatureDSPR2 (1ULL << 2)
|
|
19
|
+
#define Mips_FeatureFP64Bit (1ULL << 3)
|
|
20
|
+
#define Mips_FeatureFPXX (1ULL << 4)
|
|
21
|
+
#define Mips_FeatureGP64Bit (1ULL << 5)
|
|
22
|
+
#define Mips_FeatureMSA (1ULL << 6)
|
|
23
|
+
#define Mips_FeatureMicroMips (1ULL << 7)
|
|
24
|
+
#define Mips_FeatureMips1 (1ULL << 8)
|
|
25
|
+
#define Mips_FeatureMips2 (1ULL << 9)
|
|
26
|
+
#define Mips_FeatureMips3 (1ULL << 10)
|
|
27
|
+
#define Mips_FeatureMips3_32 (1ULL << 11)
|
|
28
|
+
#define Mips_FeatureMips3_32r2 (1ULL << 12)
|
|
29
|
+
#define Mips_FeatureMips4 (1ULL << 13)
|
|
30
|
+
#define Mips_FeatureMips4_32 (1ULL << 14)
|
|
31
|
+
#define Mips_FeatureMips4_32r2 (1ULL << 15)
|
|
32
|
+
#define Mips_FeatureMips5 (1ULL << 16)
|
|
33
|
+
#define Mips_FeatureMips5_32r2 (1ULL << 17)
|
|
34
|
+
#define Mips_FeatureMips16 (1ULL << 18)
|
|
35
|
+
#define Mips_FeatureMips32 (1ULL << 19)
|
|
36
|
+
#define Mips_FeatureMips32r2 (1ULL << 20)
|
|
37
|
+
#define Mips_FeatureMips32r3 (1ULL << 21)
|
|
38
|
+
#define Mips_FeatureMips32r5 (1ULL << 22)
|
|
39
|
+
#define Mips_FeatureMips32r6 (1ULL << 23)
|
|
40
|
+
#define Mips_FeatureMips64 (1ULL << 24)
|
|
41
|
+
#define Mips_FeatureMips64r2 (1ULL << 25)
|
|
42
|
+
#define Mips_FeatureMips64r3 (1ULL << 26)
|
|
43
|
+
#define Mips_FeatureMips64r5 (1ULL << 27)
|
|
44
|
+
#define Mips_FeatureMips64r6 (1ULL << 28)
|
|
45
|
+
#define Mips_FeatureNaN2008 (1ULL << 29)
|
|
46
|
+
#define Mips_FeatureNoABICalls (1ULL << 30)
|
|
47
|
+
#define Mips_FeatureNoOddSPReg (1ULL << 31)
|
|
48
|
+
#define Mips_FeatureSingleFloat (1ULL << 32)
|
|
49
|
+
#define Mips_FeatureVFPU (1ULL << 33)
|
|
50
|
+
|
|
51
|
+
#endif // GET_SUBTARGETINFO_ENUM
|
|
52
|
+
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
//===-- MipsInstPrinter.cpp - Convert Mips MCInst to assembly syntax ------===//
|
|
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 class prints an Mips MCInst to a .s file.
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
13
|
+
|
|
14
|
+
/* Capstone Disassembly Engine */
|
|
15
|
+
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */
|
|
16
|
+
|
|
17
|
+
#ifdef CAPSTONE_HAS_MIPS
|
|
18
|
+
|
|
19
|
+
#include <capstone/platform.h>
|
|
20
|
+
#include <stdlib.h>
|
|
21
|
+
#include <stdio.h> // debug
|
|
22
|
+
#include <string.h>
|
|
23
|
+
|
|
24
|
+
#include "MipsInstPrinter.h"
|
|
25
|
+
#include "../../MCInst.h"
|
|
26
|
+
#include "../../utils.h"
|
|
27
|
+
#include "../../SStream.h"
|
|
28
|
+
#include "../../MCRegisterInfo.h"
|
|
29
|
+
#include "MipsMapping.h"
|
|
30
|
+
|
|
31
|
+
#include "MipsInstPrinter.h"
|
|
32
|
+
|
|
33
|
+
static void printUnsignedImm(MCInst *MI, int opNum, SStream *O);
|
|
34
|
+
static char *printAliasInstr(MCInst *MI, SStream *O, void *info);
|
|
35
|
+
static char *printAlias(MCInst *MI, SStream *OS);
|
|
36
|
+
|
|
37
|
+
// These enumeration declarations were originally in MipsInstrInfo.h but
|
|
38
|
+
// had to be moved here to avoid circular dependencies between
|
|
39
|
+
// LLVMMipsCodeGen and LLVMMipsAsmPrinter.
|
|
40
|
+
|
|
41
|
+
// Mips Condition Codes
|
|
42
|
+
typedef enum Mips_CondCode {
|
|
43
|
+
// To be used with float branch True
|
|
44
|
+
Mips_FCOND_F,
|
|
45
|
+
Mips_FCOND_UN,
|
|
46
|
+
Mips_FCOND_OEQ,
|
|
47
|
+
Mips_FCOND_UEQ,
|
|
48
|
+
Mips_FCOND_OLT,
|
|
49
|
+
Mips_FCOND_ULT,
|
|
50
|
+
Mips_FCOND_OLE,
|
|
51
|
+
Mips_FCOND_ULE,
|
|
52
|
+
Mips_FCOND_SF,
|
|
53
|
+
Mips_FCOND_NGLE,
|
|
54
|
+
Mips_FCOND_SEQ,
|
|
55
|
+
Mips_FCOND_NGL,
|
|
56
|
+
Mips_FCOND_LT,
|
|
57
|
+
Mips_FCOND_NGE,
|
|
58
|
+
Mips_FCOND_LE,
|
|
59
|
+
Mips_FCOND_NGT,
|
|
60
|
+
|
|
61
|
+
// To be used with float branch False
|
|
62
|
+
// This conditions have the same mnemonic as the
|
|
63
|
+
// above ones, but are used with a branch False;
|
|
64
|
+
Mips_FCOND_T,
|
|
65
|
+
Mips_FCOND_OR,
|
|
66
|
+
Mips_FCOND_UNE,
|
|
67
|
+
Mips_FCOND_ONE,
|
|
68
|
+
Mips_FCOND_UGE,
|
|
69
|
+
Mips_FCOND_OGE,
|
|
70
|
+
Mips_FCOND_UGT,
|
|
71
|
+
Mips_FCOND_OGT,
|
|
72
|
+
Mips_FCOND_ST,
|
|
73
|
+
Mips_FCOND_GLE,
|
|
74
|
+
Mips_FCOND_SNE,
|
|
75
|
+
Mips_FCOND_GL,
|
|
76
|
+
Mips_FCOND_NLT,
|
|
77
|
+
Mips_FCOND_GE,
|
|
78
|
+
Mips_FCOND_NLE,
|
|
79
|
+
Mips_FCOND_GT
|
|
80
|
+
} Mips_CondCode;
|
|
81
|
+
|
|
82
|
+
#define GET_INSTRINFO_ENUM
|
|
83
|
+
#include "MipsGenInstrInfo.inc"
|
|
84
|
+
|
|
85
|
+
static const char *getRegisterName(unsigned RegNo);
|
|
86
|
+
static void printInstruction(MCInst *MI, SStream *O, const MCRegisterInfo *MRI);
|
|
87
|
+
|
|
88
|
+
static void set_mem_access(MCInst *MI, bool status)
|
|
89
|
+
{
|
|
90
|
+
MI->csh->doing_mem = status;
|
|
91
|
+
|
|
92
|
+
if (MI->csh->detail != CS_OPT_ON)
|
|
93
|
+
return;
|
|
94
|
+
|
|
95
|
+
if (status) {
|
|
96
|
+
MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].type = MIPS_OP_MEM;
|
|
97
|
+
MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].mem.base = MIPS_REG_INVALID;
|
|
98
|
+
MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].mem.disp = 0;
|
|
99
|
+
} else {
|
|
100
|
+
// done, create the next operand slot
|
|
101
|
+
MI->flat_insn->detail->mips.op_count++;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static bool isReg(MCInst *MI, unsigned OpNo, unsigned R)
|
|
106
|
+
{
|
|
107
|
+
return (MCOperand_isReg(MCInst_getOperand(MI, OpNo)) &&
|
|
108
|
+
MCOperand_getReg(MCInst_getOperand(MI, OpNo)) == R);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
static const char* MipsFCCToString(Mips_CondCode CC)
|
|
112
|
+
{
|
|
113
|
+
switch (CC) {
|
|
114
|
+
default: return 0; // never reach
|
|
115
|
+
case Mips_FCOND_F:
|
|
116
|
+
case Mips_FCOND_T: return "f";
|
|
117
|
+
case Mips_FCOND_UN:
|
|
118
|
+
case Mips_FCOND_OR: return "un";
|
|
119
|
+
case Mips_FCOND_OEQ:
|
|
120
|
+
case Mips_FCOND_UNE: return "eq";
|
|
121
|
+
case Mips_FCOND_UEQ:
|
|
122
|
+
case Mips_FCOND_ONE: return "ueq";
|
|
123
|
+
case Mips_FCOND_OLT:
|
|
124
|
+
case Mips_FCOND_UGE: return "olt";
|
|
125
|
+
case Mips_FCOND_ULT:
|
|
126
|
+
case Mips_FCOND_OGE: return "ult";
|
|
127
|
+
case Mips_FCOND_OLE:
|
|
128
|
+
case Mips_FCOND_UGT: return "ole";
|
|
129
|
+
case Mips_FCOND_ULE:
|
|
130
|
+
case Mips_FCOND_OGT: return "ule";
|
|
131
|
+
case Mips_FCOND_SF:
|
|
132
|
+
case Mips_FCOND_ST: return "sf";
|
|
133
|
+
case Mips_FCOND_NGLE:
|
|
134
|
+
case Mips_FCOND_GLE: return "ngle";
|
|
135
|
+
case Mips_FCOND_SEQ:
|
|
136
|
+
case Mips_FCOND_SNE: return "seq";
|
|
137
|
+
case Mips_FCOND_NGL:
|
|
138
|
+
case Mips_FCOND_GL: return "ngl";
|
|
139
|
+
case Mips_FCOND_LT:
|
|
140
|
+
case Mips_FCOND_NLT: return "lt";
|
|
141
|
+
case Mips_FCOND_NGE:
|
|
142
|
+
case Mips_FCOND_GE: return "nge";
|
|
143
|
+
case Mips_FCOND_LE:
|
|
144
|
+
case Mips_FCOND_NLE: return "le";
|
|
145
|
+
case Mips_FCOND_NGT:
|
|
146
|
+
case Mips_FCOND_GT: return "ngt";
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
static void printRegName(SStream *OS, unsigned RegNo)
|
|
151
|
+
{
|
|
152
|
+
SStream_concat(OS, "$%s", getRegisterName(RegNo));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
void Mips_printInst(MCInst *MI, SStream *O, void *info)
|
|
156
|
+
{
|
|
157
|
+
char *mnem;
|
|
158
|
+
|
|
159
|
+
switch (MCInst_getOpcode(MI)) {
|
|
160
|
+
default: break;
|
|
161
|
+
case Mips_Save16:
|
|
162
|
+
case Mips_SaveX16:
|
|
163
|
+
case Mips_Restore16:
|
|
164
|
+
case Mips_RestoreX16:
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Try to print any aliases first.
|
|
169
|
+
mnem = printAliasInstr(MI, O, info);
|
|
170
|
+
if (!mnem) {
|
|
171
|
+
mnem = printAlias(MI, O);
|
|
172
|
+
if (!mnem) {
|
|
173
|
+
printInstruction(MI, O, NULL);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (mnem) {
|
|
178
|
+
// fixup instruction id due to the change in alias instruction
|
|
179
|
+
MCInst_setOpcodePub(MI, Mips_map_insn(mnem));
|
|
180
|
+
cs_mem_free(mnem);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
static void printOperand(MCInst *MI, unsigned OpNo, SStream *O)
|
|
185
|
+
{
|
|
186
|
+
MCOperand *Op;
|
|
187
|
+
|
|
188
|
+
if (OpNo >= MI->size)
|
|
189
|
+
return;
|
|
190
|
+
|
|
191
|
+
Op = MCInst_getOperand(MI, OpNo);
|
|
192
|
+
if (MCOperand_isReg(Op)) {
|
|
193
|
+
unsigned int reg = MCOperand_getReg(Op);
|
|
194
|
+
printRegName(O, reg);
|
|
195
|
+
reg = Mips_map_register(reg);
|
|
196
|
+
if (MI->csh->detail) {
|
|
197
|
+
if (MI->csh->doing_mem) {
|
|
198
|
+
MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].mem.base = reg;
|
|
199
|
+
} else {
|
|
200
|
+
MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].type = MIPS_OP_REG;
|
|
201
|
+
MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].reg = reg;
|
|
202
|
+
MI->flat_insn->detail->mips.op_count++;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
} else if (MCOperand_isImm(Op)) {
|
|
206
|
+
int64_t imm = MCOperand_getImm(Op);
|
|
207
|
+
if (MI->csh->doing_mem) {
|
|
208
|
+
if (imm) { // only print Imm offset if it is not 0
|
|
209
|
+
printInt64(O, imm);
|
|
210
|
+
}
|
|
211
|
+
if (MI->csh->detail)
|
|
212
|
+
MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].mem.disp = imm;
|
|
213
|
+
} else {
|
|
214
|
+
printInt64(O, imm);
|
|
215
|
+
|
|
216
|
+
if (MI->csh->detail) {
|
|
217
|
+
MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].type = MIPS_OP_IMM;
|
|
218
|
+
MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].imm = imm;
|
|
219
|
+
MI->flat_insn->detail->mips.op_count++;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
static void printUnsignedImm(MCInst *MI, int opNum, SStream *O)
|
|
226
|
+
{
|
|
227
|
+
MCOperand *MO = MCInst_getOperand(MI, opNum);
|
|
228
|
+
if (MCOperand_isImm(MO)) {
|
|
229
|
+
int64_t imm = MCOperand_getImm(MO);
|
|
230
|
+
printInt64(O, imm);
|
|
231
|
+
|
|
232
|
+
if (MI->csh->detail) {
|
|
233
|
+
MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].type = MIPS_OP_IMM;
|
|
234
|
+
MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].imm = (unsigned short int)imm;
|
|
235
|
+
MI->flat_insn->detail->mips.op_count++;
|
|
236
|
+
}
|
|
237
|
+
} else
|
|
238
|
+
printOperand(MI, opNum, O);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
static void printUnsignedImm8(MCInst *MI, int opNum, SStream *O)
|
|
242
|
+
{
|
|
243
|
+
MCOperand *MO = MCInst_getOperand(MI, opNum);
|
|
244
|
+
if (MCOperand_isImm(MO)) {
|
|
245
|
+
uint8_t imm = (uint8_t)MCOperand_getImm(MO);
|
|
246
|
+
if (imm > HEX_THRESHOLD)
|
|
247
|
+
SStream_concat(O, "0x%x", imm);
|
|
248
|
+
else
|
|
249
|
+
SStream_concat(O, "%u", imm);
|
|
250
|
+
if (MI->csh->detail) {
|
|
251
|
+
MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].type = MIPS_OP_IMM;
|
|
252
|
+
MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].imm = imm;
|
|
253
|
+
MI->flat_insn->detail->mips.op_count++;
|
|
254
|
+
}
|
|
255
|
+
} else
|
|
256
|
+
printOperand(MI, opNum, O);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
static void printMemOperand(MCInst *MI, int opNum, SStream *O)
|
|
260
|
+
{
|
|
261
|
+
// Load/Store memory operands -- imm($reg)
|
|
262
|
+
// If PIC target the target is loaded as the
|
|
263
|
+
// pattern lw $25,%call16($28)
|
|
264
|
+
|
|
265
|
+
// opNum can be invalid if instruction had reglist as operand.
|
|
266
|
+
// MemOperand is always last operand of instruction (base + offset).
|
|
267
|
+
switch (MCInst_getOpcode(MI)) {
|
|
268
|
+
default:
|
|
269
|
+
break;
|
|
270
|
+
case Mips_SWM32_MM:
|
|
271
|
+
case Mips_LWM32_MM:
|
|
272
|
+
case Mips_SWM16_MM:
|
|
273
|
+
case Mips_LWM16_MM:
|
|
274
|
+
opNum = MCInst_getNumOperands(MI) - 2;
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
set_mem_access(MI, true);
|
|
279
|
+
printOperand(MI, opNum + 1, O);
|
|
280
|
+
SStream_concat0(O, "(");
|
|
281
|
+
printOperand(MI, opNum, O);
|
|
282
|
+
SStream_concat0(O, ")");
|
|
283
|
+
set_mem_access(MI, false);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// TODO???
|
|
287
|
+
static void printMemOperandEA(MCInst *MI, int opNum, SStream *O)
|
|
288
|
+
{
|
|
289
|
+
// when using stack locations for not load/store instructions
|
|
290
|
+
// print the same way as all normal 3 operand instructions.
|
|
291
|
+
printOperand(MI, opNum, O);
|
|
292
|
+
SStream_concat0(O, ", ");
|
|
293
|
+
printOperand(MI, opNum + 1, O);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
static void printFCCOperand(MCInst *MI, int opNum, SStream *O)
|
|
298
|
+
{
|
|
299
|
+
MCOperand *MO = MCInst_getOperand(MI, opNum);
|
|
300
|
+
SStream_concat0(O, MipsFCCToString((Mips_CondCode)MCOperand_getImm(MO)));
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
static void printRegisterPair(MCInst *MI, int opNum, SStream *O)
|
|
304
|
+
{
|
|
305
|
+
printRegName(O, MCOperand_getReg(MCInst_getOperand(MI, opNum)));
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
static char *printAlias1(const char *Str, MCInst *MI, unsigned OpNo, SStream *OS)
|
|
309
|
+
{
|
|
310
|
+
SStream_concat(OS, "%s\t", Str);
|
|
311
|
+
printOperand(MI, OpNo, OS);
|
|
312
|
+
return cs_strdup(Str);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
static char *printAlias2(const char *Str, MCInst *MI,
|
|
316
|
+
unsigned OpNo0, unsigned OpNo1, SStream *OS)
|
|
317
|
+
{
|
|
318
|
+
char *tmp;
|
|
319
|
+
|
|
320
|
+
tmp = printAlias1(Str, MI, OpNo0, OS);
|
|
321
|
+
SStream_concat0(OS, ", ");
|
|
322
|
+
printOperand(MI, OpNo1, OS);
|
|
323
|
+
|
|
324
|
+
return tmp;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
#define GET_REGINFO_ENUM
|
|
328
|
+
#include "MipsGenRegisterInfo.inc"
|
|
329
|
+
|
|
330
|
+
static char *printAlias(MCInst *MI, SStream *OS)
|
|
331
|
+
{
|
|
332
|
+
switch (MCInst_getOpcode(MI)) {
|
|
333
|
+
case Mips_BEQ:
|
|
334
|
+
case Mips_BEQ_MM:
|
|
335
|
+
// beq $zero, $zero, $L2 => b $L2
|
|
336
|
+
// beq $r0, $zero, $L2 => beqz $r0, $L2
|
|
337
|
+
if (isReg(MI, 0, Mips_ZERO) && isReg(MI, 1, Mips_ZERO))
|
|
338
|
+
return printAlias1("b", MI, 2, OS);
|
|
339
|
+
if (isReg(MI, 1, Mips_ZERO))
|
|
340
|
+
return printAlias2("beqz", MI, 0, 2, OS);
|
|
341
|
+
return NULL;
|
|
342
|
+
case Mips_BEQ64:
|
|
343
|
+
// beq $r0, $zero, $L2 => beqz $r0, $L2
|
|
344
|
+
if (isReg(MI, 1, Mips_ZERO_64))
|
|
345
|
+
return printAlias2("beqz", MI, 0, 2, OS);
|
|
346
|
+
return NULL;
|
|
347
|
+
case Mips_BNE:
|
|
348
|
+
// bne $r0, $zero, $L2 => bnez $r0, $L2
|
|
349
|
+
if (isReg(MI, 1, Mips_ZERO))
|
|
350
|
+
return printAlias2("bnez", MI, 0, 2, OS);
|
|
351
|
+
return NULL;
|
|
352
|
+
case Mips_BNE64:
|
|
353
|
+
// bne $r0, $zero, $L2 => bnez $r0, $L2
|
|
354
|
+
if (isReg(MI, 1, Mips_ZERO_64))
|
|
355
|
+
return printAlias2("bnez", MI, 0, 2, OS);
|
|
356
|
+
return NULL;
|
|
357
|
+
case Mips_BGEZAL:
|
|
358
|
+
// bgezal $zero, $L1 => bal $L1
|
|
359
|
+
if (isReg(MI, 0, Mips_ZERO))
|
|
360
|
+
return printAlias1("bal", MI, 1, OS);
|
|
361
|
+
return NULL;
|
|
362
|
+
case Mips_BC1T:
|
|
363
|
+
// bc1t $fcc0, $L1 => bc1t $L1
|
|
364
|
+
if (isReg(MI, 0, Mips_FCC0))
|
|
365
|
+
return printAlias1("bc1t", MI, 1, OS);
|
|
366
|
+
return NULL;
|
|
367
|
+
case Mips_BC1F:
|
|
368
|
+
// bc1f $fcc0, $L1 => bc1f $L1
|
|
369
|
+
if (isReg(MI, 0, Mips_FCC0))
|
|
370
|
+
return printAlias1("bc1f", MI, 1, OS);
|
|
371
|
+
return NULL;
|
|
372
|
+
case Mips_JALR:
|
|
373
|
+
// jalr $ra, $r1 => jalr $r1
|
|
374
|
+
if (isReg(MI, 0, Mips_RA))
|
|
375
|
+
return printAlias1("jalr", MI, 1, OS);
|
|
376
|
+
return NULL;
|
|
377
|
+
case Mips_JALR64:
|
|
378
|
+
// jalr $ra, $r1 => jalr $r1
|
|
379
|
+
if (isReg(MI, 0, Mips_RA_64))
|
|
380
|
+
return printAlias1("jalr", MI, 1, OS);
|
|
381
|
+
return NULL;
|
|
382
|
+
case Mips_NOR:
|
|
383
|
+
case Mips_NOR_MM:
|
|
384
|
+
// nor $r0, $r1, $zero => not $r0, $r1
|
|
385
|
+
if (isReg(MI, 2, Mips_ZERO))
|
|
386
|
+
return printAlias2("not", MI, 0, 1, OS);
|
|
387
|
+
return NULL;
|
|
388
|
+
case Mips_NOR64:
|
|
389
|
+
// nor $r0, $r1, $zero => not $r0, $r1
|
|
390
|
+
if (isReg(MI, 2, Mips_ZERO_64))
|
|
391
|
+
return printAlias2("not", MI, 0, 1, OS);
|
|
392
|
+
return NULL;
|
|
393
|
+
case Mips_OR:
|
|
394
|
+
// or $r0, $r1, $zero => move $r0, $r1
|
|
395
|
+
if (isReg(MI, 2, Mips_ZERO))
|
|
396
|
+
return printAlias2("move", MI, 0, 1, OS);
|
|
397
|
+
return NULL;
|
|
398
|
+
default: return NULL;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
static void printRegisterList(MCInst *MI, int opNum, SStream *O)
|
|
403
|
+
{
|
|
404
|
+
int i, e, reg;
|
|
405
|
+
|
|
406
|
+
// - 2 because register List is always first operand of instruction and it is
|
|
407
|
+
// always followed by memory operand (base + offset).
|
|
408
|
+
for (i = opNum, e = MCInst_getNumOperands(MI) - 2; i != e; ++i) {
|
|
409
|
+
if (i != opNum)
|
|
410
|
+
SStream_concat0(O, ", ");
|
|
411
|
+
reg = MCOperand_getReg(MCInst_getOperand(MI, i));
|
|
412
|
+
printRegName(O, reg);
|
|
413
|
+
if (MI->csh->detail) {
|
|
414
|
+
MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].type = MIPS_OP_REG;
|
|
415
|
+
MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].reg = reg;
|
|
416
|
+
MI->flat_insn->detail->mips.op_count++;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
#define PRINT_ALIAS_INSTR
|
|
422
|
+
#include "MipsGenAsmWriter.inc"
|
|
423
|
+
|
|
424
|
+
#endif
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//=== MipsInstPrinter.h - Convert Mips MCInst to assembly syntax -*- 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 class prints a Mips MCInst to a .s file.
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
13
|
+
|
|
14
|
+
/* Capstone Disassembly Engine */
|
|
15
|
+
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */
|
|
16
|
+
|
|
17
|
+
#ifndef CS_MIPSINSTPRINTER_H
|
|
18
|
+
#define CS_MIPSINSTPRINTER_H
|
|
19
|
+
|
|
20
|
+
#include "../../MCInst.h"
|
|
21
|
+
#include "../../SStream.h"
|
|
22
|
+
|
|
23
|
+
void Mips_printInst(MCInst *MI, SStream *O, void *info);
|
|
24
|
+
|
|
25
|
+
#endif
|