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,500 @@
|
|
|
1
|
+
//===------ SparcDisassembler.cpp - Disassembler for PowerPC ------*- 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
|
+
/* Capstone Disassembly Engine */
|
|
11
|
+
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */
|
|
12
|
+
|
|
13
|
+
#ifdef CAPSTONE_HAS_SPARC
|
|
14
|
+
|
|
15
|
+
#include <stdio.h> // DEBUG
|
|
16
|
+
#include <stdlib.h>
|
|
17
|
+
#include <string.h>
|
|
18
|
+
|
|
19
|
+
#include "../../cs_priv.h"
|
|
20
|
+
#include "../../utils.h"
|
|
21
|
+
|
|
22
|
+
#include "SparcDisassembler.h"
|
|
23
|
+
|
|
24
|
+
#include "../../MCInst.h"
|
|
25
|
+
#include "../../MCInstrDesc.h"
|
|
26
|
+
#include "../../MCFixedLenDisassembler.h"
|
|
27
|
+
#include "../../MCRegisterInfo.h"
|
|
28
|
+
#include "../../MCDisassembler.h"
|
|
29
|
+
#include "../../MathExtras.h"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
#define GET_REGINFO_MC_DESC
|
|
33
|
+
#define GET_REGINFO_ENUM
|
|
34
|
+
#include "SparcGenRegisterInfo.inc"
|
|
35
|
+
static const unsigned IntRegDecoderTable[] = {
|
|
36
|
+
SP_G0, SP_G1, SP_G2, SP_G3,
|
|
37
|
+
SP_G4, SP_G5, SP_G6, SP_G7,
|
|
38
|
+
SP_O0, SP_O1, SP_O2, SP_O3,
|
|
39
|
+
SP_O4, SP_O5, SP_O6, SP_O7,
|
|
40
|
+
SP_L0, SP_L1, SP_L2, SP_L3,
|
|
41
|
+
SP_L4, SP_L5, SP_L6, SP_L7,
|
|
42
|
+
SP_I0, SP_I1, SP_I2, SP_I3,
|
|
43
|
+
SP_I4, SP_I5, SP_I6, SP_I7
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
static const unsigned FPRegDecoderTable[] = {
|
|
47
|
+
SP_F0, SP_F1, SP_F2, SP_F3,
|
|
48
|
+
SP_F4, SP_F5, SP_F6, SP_F7,
|
|
49
|
+
SP_F8, SP_F9, SP_F10, SP_F11,
|
|
50
|
+
SP_F12, SP_F13, SP_F14, SP_F15,
|
|
51
|
+
SP_F16, SP_F17, SP_F18, SP_F19,
|
|
52
|
+
SP_F20, SP_F21, SP_F22, SP_F23,
|
|
53
|
+
SP_F24, SP_F25, SP_F26, SP_F27,
|
|
54
|
+
SP_F28, SP_F29, SP_F30, SP_F31
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
static const unsigned DFPRegDecoderTable[] = {
|
|
58
|
+
SP_D0, SP_D16, SP_D1, SP_D17,
|
|
59
|
+
SP_D2, SP_D18, SP_D3, SP_D19,
|
|
60
|
+
SP_D4, SP_D20, SP_D5, SP_D21,
|
|
61
|
+
SP_D6, SP_D22, SP_D7, SP_D23,
|
|
62
|
+
SP_D8, SP_D24, SP_D9, SP_D25,
|
|
63
|
+
SP_D10, SP_D26, SP_D11, SP_D27,
|
|
64
|
+
SP_D12, SP_D28, SP_D13, SP_D29,
|
|
65
|
+
SP_D14, SP_D30, SP_D15, SP_D31
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
static const unsigned QFPRegDecoderTable[] = {
|
|
69
|
+
SP_Q0, SP_Q8, ~0U, ~0U,
|
|
70
|
+
SP_Q1, SP_Q9, ~0U, ~0U,
|
|
71
|
+
SP_Q2, SP_Q10, ~0U, ~0U,
|
|
72
|
+
SP_Q3, SP_Q11, ~0U, ~0U,
|
|
73
|
+
SP_Q4, SP_Q12, ~0U, ~0U,
|
|
74
|
+
SP_Q5, SP_Q13, ~0U, ~0U,
|
|
75
|
+
SP_Q6, SP_Q14, ~0U, ~0U,
|
|
76
|
+
SP_Q7, SP_Q15, ~0U, ~0U
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
static const unsigned FCCRegDecoderTable[] = {
|
|
80
|
+
SP_FCC0, SP_FCC1, SP_FCC2, SP_FCC3
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
static uint64_t getFeatureBits(int mode)
|
|
84
|
+
{
|
|
85
|
+
// support everything
|
|
86
|
+
return (uint64_t)-1;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static DecodeStatus DecodeIntRegsRegisterClass(MCInst *Inst, unsigned RegNo,
|
|
90
|
+
uint64_t Address, const void *Decoder)
|
|
91
|
+
{
|
|
92
|
+
unsigned Reg;
|
|
93
|
+
|
|
94
|
+
if (RegNo > 31)
|
|
95
|
+
return MCDisassembler_Fail;
|
|
96
|
+
|
|
97
|
+
Reg = IntRegDecoderTable[RegNo];
|
|
98
|
+
MCOperand_CreateReg0(Inst, Reg);
|
|
99
|
+
|
|
100
|
+
return MCDisassembler_Success;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
static DecodeStatus DecodeI64RegsRegisterClass(MCInst *Inst, unsigned RegNo,
|
|
104
|
+
uint64_t Address, const void *Decoder)
|
|
105
|
+
{
|
|
106
|
+
unsigned Reg;
|
|
107
|
+
|
|
108
|
+
if (RegNo > 31)
|
|
109
|
+
return MCDisassembler_Fail;
|
|
110
|
+
|
|
111
|
+
Reg = IntRegDecoderTable[RegNo];
|
|
112
|
+
MCOperand_CreateReg0(Inst, Reg);
|
|
113
|
+
|
|
114
|
+
return MCDisassembler_Success;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static DecodeStatus DecodeFPRegsRegisterClass(MCInst *Inst, unsigned RegNo,
|
|
118
|
+
uint64_t Address, const void *Decoder)
|
|
119
|
+
{
|
|
120
|
+
unsigned Reg;
|
|
121
|
+
|
|
122
|
+
if (RegNo > 31)
|
|
123
|
+
return MCDisassembler_Fail;
|
|
124
|
+
|
|
125
|
+
Reg = FPRegDecoderTable[RegNo];
|
|
126
|
+
MCOperand_CreateReg0(Inst, Reg);
|
|
127
|
+
|
|
128
|
+
return MCDisassembler_Success;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
static DecodeStatus DecodeDFPRegsRegisterClass(MCInst *Inst, unsigned RegNo,
|
|
132
|
+
uint64_t Address, const void *Decoder)
|
|
133
|
+
{
|
|
134
|
+
unsigned Reg;
|
|
135
|
+
|
|
136
|
+
if (RegNo > 31)
|
|
137
|
+
return MCDisassembler_Fail;
|
|
138
|
+
|
|
139
|
+
Reg = DFPRegDecoderTable[RegNo];
|
|
140
|
+
MCOperand_CreateReg0(Inst, Reg);
|
|
141
|
+
|
|
142
|
+
return MCDisassembler_Success;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
static DecodeStatus DecodeQFPRegsRegisterClass(MCInst *Inst, unsigned RegNo,
|
|
146
|
+
uint64_t Address, const void *Decoder)
|
|
147
|
+
{
|
|
148
|
+
unsigned Reg;
|
|
149
|
+
|
|
150
|
+
if (RegNo > 31)
|
|
151
|
+
return MCDisassembler_Fail;
|
|
152
|
+
|
|
153
|
+
Reg = QFPRegDecoderTable[RegNo];
|
|
154
|
+
if (Reg == ~0U)
|
|
155
|
+
return MCDisassembler_Fail;
|
|
156
|
+
|
|
157
|
+
MCOperand_CreateReg0(Inst, Reg);
|
|
158
|
+
|
|
159
|
+
return MCDisassembler_Success;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
static DecodeStatus DecodeFCCRegsRegisterClass(MCInst *Inst, unsigned RegNo,
|
|
163
|
+
uint64_t Address, const void *Decoder)
|
|
164
|
+
{
|
|
165
|
+
if (RegNo > 3)
|
|
166
|
+
return MCDisassembler_Fail;
|
|
167
|
+
|
|
168
|
+
MCOperand_CreateReg0(Inst, FCCRegDecoderTable[RegNo]);
|
|
169
|
+
|
|
170
|
+
return MCDisassembler_Success;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
static DecodeStatus DecodeLoadInt(MCInst *Inst, unsigned insn, uint64_t Address,
|
|
175
|
+
const void *Decoder);
|
|
176
|
+
static DecodeStatus DecodeLoadFP(MCInst *Inst, unsigned insn, uint64_t Address,
|
|
177
|
+
const void *Decoder);
|
|
178
|
+
static DecodeStatus DecodeLoadDFP(MCInst *Inst, unsigned insn, uint64_t Address,
|
|
179
|
+
const void *Decoder);
|
|
180
|
+
static DecodeStatus DecodeLoadQFP(MCInst *Inst, unsigned insn, uint64_t Address,
|
|
181
|
+
const void *Decoder);
|
|
182
|
+
static DecodeStatus DecodeStoreInt(MCInst *Inst, unsigned insn,
|
|
183
|
+
uint64_t Address, const void *Decoder);
|
|
184
|
+
static DecodeStatus DecodeStoreFP(MCInst *Inst, unsigned insn,
|
|
185
|
+
uint64_t Address, const void *Decoder);
|
|
186
|
+
static DecodeStatus DecodeStoreDFP(MCInst *Inst, unsigned insn,
|
|
187
|
+
uint64_t Address, const void *Decoder);
|
|
188
|
+
static DecodeStatus DecodeStoreQFP(MCInst *Inst, unsigned insn,
|
|
189
|
+
uint64_t Address, const void *Decoder);
|
|
190
|
+
static DecodeStatus DecodeCall(MCInst *Inst, unsigned insn,
|
|
191
|
+
uint64_t Address, const void *Decoder);
|
|
192
|
+
static DecodeStatus DecodeSIMM13(MCInst *Inst, unsigned insn,
|
|
193
|
+
uint64_t Address, const void *Decoder);
|
|
194
|
+
static DecodeStatus DecodeJMPL(MCInst *Inst, unsigned insn, uint64_t Address,
|
|
195
|
+
const void *Decoder);
|
|
196
|
+
static DecodeStatus DecodeReturn(MCInst *MI, unsigned insn, uint64_t Address,
|
|
197
|
+
const void *Decoder);
|
|
198
|
+
static DecodeStatus DecodeSWAP(MCInst *Inst, unsigned insn, uint64_t Address,
|
|
199
|
+
const void *Decoder);
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
#define GET_SUBTARGETINFO_ENUM
|
|
203
|
+
#include "SparcGenSubtargetInfo.inc"
|
|
204
|
+
#include "SparcGenDisassemblerTables.inc"
|
|
205
|
+
|
|
206
|
+
/// readInstruction - read four bytes and return 32 bit word.
|
|
207
|
+
static DecodeStatus readInstruction32(const uint8_t *code, size_t len, uint32_t *Insn)
|
|
208
|
+
{
|
|
209
|
+
if (len < 4)
|
|
210
|
+
// not enough data
|
|
211
|
+
return MCDisassembler_Fail;
|
|
212
|
+
|
|
213
|
+
// Encoded as a big-endian 32-bit word in the stream.
|
|
214
|
+
*Insn = (code[3] << 0) |
|
|
215
|
+
(code[2] << 8) |
|
|
216
|
+
(code[1] << 16) |
|
|
217
|
+
((uint32_t) code[0] << 24);
|
|
218
|
+
|
|
219
|
+
return MCDisassembler_Success;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
bool Sparc_getInstruction(csh ud, const uint8_t *code, size_t code_len, MCInst *MI,
|
|
223
|
+
uint16_t *size, uint64_t address, void *info)
|
|
224
|
+
{
|
|
225
|
+
uint32_t Insn;
|
|
226
|
+
DecodeStatus Result;
|
|
227
|
+
|
|
228
|
+
Result = readInstruction32(code, code_len, &Insn);
|
|
229
|
+
if (Result == MCDisassembler_Fail)
|
|
230
|
+
return false;
|
|
231
|
+
|
|
232
|
+
if (MI->flat_insn->detail) {
|
|
233
|
+
memset(MI->flat_insn->detail, 0, offsetof(cs_detail, sparc)+sizeof(cs_sparc));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
Result = decodeInstruction_4(DecoderTableSparc32, MI, Insn, address,
|
|
237
|
+
(MCRegisterInfo *)info, 0);
|
|
238
|
+
if (Result != MCDisassembler_Fail) {
|
|
239
|
+
*size = 4;
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
typedef DecodeStatus (*DecodeFunc)(MCInst *MI, unsigned insn, uint64_t Address,
|
|
247
|
+
const void *Decoder);
|
|
248
|
+
|
|
249
|
+
static DecodeStatus DecodeMem(MCInst *MI, unsigned insn, uint64_t Address,
|
|
250
|
+
const void *Decoder,
|
|
251
|
+
bool isLoad, DecodeFunc DecodeRD)
|
|
252
|
+
{
|
|
253
|
+
DecodeStatus status;
|
|
254
|
+
unsigned rd = fieldFromInstruction_4(insn, 25, 5);
|
|
255
|
+
unsigned rs1 = fieldFromInstruction_4(insn, 14, 5);
|
|
256
|
+
bool isImm = fieldFromInstruction_4(insn, 13, 1) != 0;
|
|
257
|
+
unsigned rs2 = 0;
|
|
258
|
+
unsigned simm13 = 0;
|
|
259
|
+
|
|
260
|
+
if (isImm)
|
|
261
|
+
simm13 = SignExtend32(fieldFromInstruction_4(insn, 0, 13), 13);
|
|
262
|
+
else
|
|
263
|
+
rs2 = fieldFromInstruction_4(insn, 0, 5);
|
|
264
|
+
|
|
265
|
+
if (isLoad) {
|
|
266
|
+
status = DecodeRD(MI, rd, Address, Decoder);
|
|
267
|
+
if (status != MCDisassembler_Success)
|
|
268
|
+
return status;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Decode rs1.
|
|
272
|
+
status = DecodeIntRegsRegisterClass(MI, rs1, Address, Decoder);
|
|
273
|
+
if (status != MCDisassembler_Success)
|
|
274
|
+
return status;
|
|
275
|
+
|
|
276
|
+
// Decode imm|rs2.
|
|
277
|
+
if (isImm)
|
|
278
|
+
MCOperand_CreateImm0(MI, simm13);
|
|
279
|
+
else {
|
|
280
|
+
status = DecodeIntRegsRegisterClass(MI, rs2, Address, Decoder);
|
|
281
|
+
if (status != MCDisassembler_Success)
|
|
282
|
+
return status;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (!isLoad) {
|
|
286
|
+
status = DecodeRD(MI, rd, Address, Decoder);
|
|
287
|
+
if (status != MCDisassembler_Success)
|
|
288
|
+
return status;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return MCDisassembler_Success;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
static DecodeStatus DecodeLoadInt(MCInst *Inst, unsigned insn, uint64_t Address,
|
|
295
|
+
const void *Decoder)
|
|
296
|
+
{
|
|
297
|
+
return DecodeMem(Inst, insn, Address, Decoder, true,
|
|
298
|
+
DecodeIntRegsRegisterClass);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
static DecodeStatus DecodeLoadFP(MCInst *Inst, unsigned insn, uint64_t Address,
|
|
302
|
+
const void *Decoder)
|
|
303
|
+
{
|
|
304
|
+
return DecodeMem(Inst, insn, Address, Decoder, true,
|
|
305
|
+
DecodeFPRegsRegisterClass);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
static DecodeStatus DecodeLoadDFP(MCInst *Inst, unsigned insn, uint64_t Address,
|
|
309
|
+
const void *Decoder)
|
|
310
|
+
{
|
|
311
|
+
return DecodeMem(Inst, insn, Address, Decoder, true,
|
|
312
|
+
DecodeDFPRegsRegisterClass);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
static DecodeStatus DecodeLoadQFP(MCInst *Inst, unsigned insn, uint64_t Address,
|
|
316
|
+
const void *Decoder)
|
|
317
|
+
{
|
|
318
|
+
return DecodeMem(Inst, insn, Address, Decoder, true,
|
|
319
|
+
DecodeQFPRegsRegisterClass);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
static DecodeStatus DecodeStoreInt(MCInst *Inst, unsigned insn,
|
|
323
|
+
uint64_t Address, const void *Decoder)
|
|
324
|
+
{
|
|
325
|
+
return DecodeMem(Inst, insn, Address, Decoder, false,
|
|
326
|
+
DecodeIntRegsRegisterClass);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
static DecodeStatus DecodeStoreFP(MCInst *Inst, unsigned insn, uint64_t Address,
|
|
330
|
+
const void *Decoder)
|
|
331
|
+
{
|
|
332
|
+
return DecodeMem(Inst, insn, Address, Decoder, false,
|
|
333
|
+
DecodeFPRegsRegisterClass);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
static DecodeStatus DecodeStoreDFP(MCInst *Inst, unsigned insn,
|
|
337
|
+
uint64_t Address, const void *Decoder)
|
|
338
|
+
{
|
|
339
|
+
return DecodeMem(Inst, insn, Address, Decoder, false,
|
|
340
|
+
DecodeDFPRegsRegisterClass);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
static DecodeStatus DecodeStoreQFP(MCInst *Inst, unsigned insn,
|
|
344
|
+
uint64_t Address, const void *Decoder)
|
|
345
|
+
{
|
|
346
|
+
return DecodeMem(Inst, insn, Address, Decoder, false,
|
|
347
|
+
DecodeQFPRegsRegisterClass);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
static DecodeStatus DecodeCall(MCInst *MI, unsigned insn,
|
|
351
|
+
uint64_t Address, const void *Decoder)
|
|
352
|
+
{
|
|
353
|
+
unsigned tgt = fieldFromInstruction_4(insn, 0, 30);
|
|
354
|
+
tgt <<= 2;
|
|
355
|
+
|
|
356
|
+
MCOperand_CreateImm0(MI, tgt);
|
|
357
|
+
|
|
358
|
+
return MCDisassembler_Success;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
static DecodeStatus DecodeSIMM13(MCInst *MI, unsigned insn,
|
|
362
|
+
uint64_t Address, const void *Decoder)
|
|
363
|
+
{
|
|
364
|
+
unsigned tgt = SignExtend32(fieldFromInstruction_4(insn, 0, 13), 13);
|
|
365
|
+
|
|
366
|
+
MCOperand_CreateImm0(MI, tgt);
|
|
367
|
+
|
|
368
|
+
return MCDisassembler_Success;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
static DecodeStatus DecodeJMPL(MCInst *MI, unsigned insn, uint64_t Address,
|
|
372
|
+
const void *Decoder)
|
|
373
|
+
{
|
|
374
|
+
DecodeStatus status;
|
|
375
|
+
unsigned rd = fieldFromInstruction_4(insn, 25, 5);
|
|
376
|
+
unsigned rs1 = fieldFromInstruction_4(insn, 14, 5);
|
|
377
|
+
unsigned isImm = fieldFromInstruction_4(insn, 13, 1);
|
|
378
|
+
unsigned rs2 = 0;
|
|
379
|
+
unsigned simm13 = 0;
|
|
380
|
+
|
|
381
|
+
if (isImm)
|
|
382
|
+
simm13 = SignExtend32(fieldFromInstruction_4(insn, 0, 13), 13);
|
|
383
|
+
else
|
|
384
|
+
rs2 = fieldFromInstruction_4(insn, 0, 5);
|
|
385
|
+
|
|
386
|
+
// Decode RD.
|
|
387
|
+
status = DecodeIntRegsRegisterClass(MI, rd, Address, Decoder);
|
|
388
|
+
if (status != MCDisassembler_Success)
|
|
389
|
+
return status;
|
|
390
|
+
|
|
391
|
+
// Decode RS1.
|
|
392
|
+
status = DecodeIntRegsRegisterClass(MI, rs1, Address, Decoder);
|
|
393
|
+
if (status != MCDisassembler_Success)
|
|
394
|
+
return status;
|
|
395
|
+
|
|
396
|
+
// Decode RS1 | SIMM13.
|
|
397
|
+
if (isImm)
|
|
398
|
+
MCOperand_CreateImm0(MI, simm13);
|
|
399
|
+
else {
|
|
400
|
+
status = DecodeIntRegsRegisterClass(MI, rs2, Address, Decoder);
|
|
401
|
+
if (status != MCDisassembler_Success)
|
|
402
|
+
return status;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
return MCDisassembler_Success;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
static DecodeStatus DecodeReturn(MCInst *MI, unsigned insn, uint64_t Address,
|
|
409
|
+
const void *Decoder)
|
|
410
|
+
{
|
|
411
|
+
DecodeStatus status;
|
|
412
|
+
unsigned rs1 = fieldFromInstruction_4(insn, 14, 5);
|
|
413
|
+
unsigned isImm = fieldFromInstruction_4(insn, 13, 1);
|
|
414
|
+
unsigned rs2 = 0;
|
|
415
|
+
unsigned simm13 = 0;
|
|
416
|
+
if (isImm)
|
|
417
|
+
simm13 = SignExtend32(fieldFromInstruction_4(insn, 0, 13), 13);
|
|
418
|
+
else
|
|
419
|
+
rs2 = fieldFromInstruction_4(insn, 0, 5);
|
|
420
|
+
|
|
421
|
+
// Decode RS1.
|
|
422
|
+
status = DecodeIntRegsRegisterClass(MI, rs1, Address, Decoder);
|
|
423
|
+
if (status != MCDisassembler_Success)
|
|
424
|
+
return status;
|
|
425
|
+
|
|
426
|
+
// Decode RS2 | SIMM13.
|
|
427
|
+
if (isImm)
|
|
428
|
+
MCOperand_CreateImm0(MI, simm13);
|
|
429
|
+
else {
|
|
430
|
+
status = DecodeIntRegsRegisterClass(MI, rs2, Address, Decoder);
|
|
431
|
+
if (status != MCDisassembler_Success)
|
|
432
|
+
return status;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
return MCDisassembler_Success;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
static DecodeStatus DecodeSWAP(MCInst *MI, unsigned insn, uint64_t Address,
|
|
439
|
+
const void *Decoder)
|
|
440
|
+
{
|
|
441
|
+
DecodeStatus status;
|
|
442
|
+
unsigned rd = fieldFromInstruction_4(insn, 25, 5);
|
|
443
|
+
unsigned rs1 = fieldFromInstruction_4(insn, 14, 5);
|
|
444
|
+
unsigned isImm = fieldFromInstruction_4(insn, 13, 1);
|
|
445
|
+
unsigned rs2 = 0;
|
|
446
|
+
unsigned simm13 = 0;
|
|
447
|
+
|
|
448
|
+
if (isImm)
|
|
449
|
+
simm13 = SignExtend32(fieldFromInstruction_4(insn, 0, 13), 13);
|
|
450
|
+
else
|
|
451
|
+
rs2 = fieldFromInstruction_4(insn, 0, 5);
|
|
452
|
+
|
|
453
|
+
// Decode RD.
|
|
454
|
+
status = DecodeIntRegsRegisterClass(MI, rd, Address, Decoder);
|
|
455
|
+
if (status != MCDisassembler_Success)
|
|
456
|
+
return status;
|
|
457
|
+
|
|
458
|
+
// Decode RS1.
|
|
459
|
+
status = DecodeIntRegsRegisterClass(MI, rs1, Address, Decoder);
|
|
460
|
+
if (status != MCDisassembler_Success)
|
|
461
|
+
return status;
|
|
462
|
+
|
|
463
|
+
// Decode RS1 | SIMM13.
|
|
464
|
+
if (isImm)
|
|
465
|
+
MCOperand_CreateImm0(MI, simm13);
|
|
466
|
+
else {
|
|
467
|
+
status = DecodeIntRegsRegisterClass(MI, rs2, Address, Decoder);
|
|
468
|
+
if (status != MCDisassembler_Success)
|
|
469
|
+
return status;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
return MCDisassembler_Success;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
void Sparc_init(MCRegisterInfo *MRI)
|
|
476
|
+
{
|
|
477
|
+
/*
|
|
478
|
+
InitMCRegisterInfo(SparcRegDesc, 119, RA, PC,
|
|
479
|
+
SparcMCRegisterClasses, 8,
|
|
480
|
+
SparcRegUnitRoots,
|
|
481
|
+
86,
|
|
482
|
+
SparcRegDiffLists,
|
|
483
|
+
SparcRegStrings,
|
|
484
|
+
SparcSubRegIdxLists,
|
|
485
|
+
7,
|
|
486
|
+
SparcSubRegIdxRanges,
|
|
487
|
+
SparcRegEncodingTable);
|
|
488
|
+
*/
|
|
489
|
+
|
|
490
|
+
MCRegisterInfo_InitMCRegisterInfo(MRI, SparcRegDesc, 119,
|
|
491
|
+
0, 0,
|
|
492
|
+
SparcMCRegisterClasses, 8,
|
|
493
|
+
0, 0,
|
|
494
|
+
SparcRegDiffLists,
|
|
495
|
+
0,
|
|
496
|
+
SparcSubRegIdxLists, 7,
|
|
497
|
+
0);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
#endif
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* Capstone Disassembly Engine */
|
|
2
|
+
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */
|
|
3
|
+
|
|
4
|
+
#ifndef CS_SPARCDISASSEMBLER_H
|
|
5
|
+
#define CS_SPARCDISASSEMBLER_H
|
|
6
|
+
|
|
7
|
+
#include "capstone/capstone.h"
|
|
8
|
+
#include "../../MCRegisterInfo.h"
|
|
9
|
+
#include "../../MCInst.h"
|
|
10
|
+
|
|
11
|
+
void Sparc_init(MCRegisterInfo *MRI);
|
|
12
|
+
|
|
13
|
+
bool Sparc_getInstruction(csh ud, const uint8_t *code, size_t code_len,
|
|
14
|
+
MCInst *instr, uint16_t *size, uint64_t address, void *info);
|
|
15
|
+
|
|
16
|
+
#endif
|
|
17
|
+
|