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.
Files changed (332) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +191 -0
  3. package/binding.gyp +168 -0
  4. package/deps/capstone/LEB128.h +38 -0
  5. package/deps/capstone/MCDisassembler.h +14 -0
  6. package/deps/capstone/MCFixedLenDisassembler.h +32 -0
  7. package/deps/capstone/MCInst.c +270 -0
  8. package/deps/capstone/MCInst.h +165 -0
  9. package/deps/capstone/MCInstrDesc.c +41 -0
  10. package/deps/capstone/MCInstrDesc.h +167 -0
  11. package/deps/capstone/MCRegisterInfo.c +151 -0
  12. package/deps/capstone/MCRegisterInfo.h +116 -0
  13. package/deps/capstone/Mapping.c +254 -0
  14. package/deps/capstone/Mapping.h +174 -0
  15. package/deps/capstone/MathExtras.h +442 -0
  16. package/deps/capstone/SStream.c +181 -0
  17. package/deps/capstone/SStream.h +40 -0
  18. package/deps/capstone/arch/AArch64/AArch64AddressingModes.h +945 -0
  19. package/deps/capstone/arch/AArch64/AArch64BaseInfo.c +77 -0
  20. package/deps/capstone/arch/AArch64/AArch64BaseInfo.h +585 -0
  21. package/deps/capstone/arch/AArch64/AArch64Disassembler.c +2280 -0
  22. package/deps/capstone/arch/AArch64/AArch64Disassembler.h +18 -0
  23. package/deps/capstone/arch/AArch64/AArch64GenAsmWriter.inc +26589 -0
  24. package/deps/capstone/arch/AArch64/AArch64GenDisassemblerTables.inc +27322 -0
  25. package/deps/capstone/arch/AArch64/AArch64GenInstrInfo.inc +13194 -0
  26. package/deps/capstone/arch/AArch64/AArch64GenRegisterInfo.inc +3814 -0
  27. package/deps/capstone/arch/AArch64/AArch64GenRegisterName.inc +714 -0
  28. package/deps/capstone/arch/AArch64/AArch64GenRegisterV.inc +673 -0
  29. package/deps/capstone/arch/AArch64/AArch64GenSubtargetInfo.inc +229 -0
  30. package/deps/capstone/arch/AArch64/AArch64GenSystemOperands.inc +2863 -0
  31. package/deps/capstone/arch/AArch64/AArch64GenSystemOperands_enum.inc +21 -0
  32. package/deps/capstone/arch/AArch64/AArch64InstPrinter.c +3029 -0
  33. package/deps/capstone/arch/AArch64/AArch64InstPrinter.h +28 -0
  34. package/deps/capstone/arch/AArch64/AArch64Mapping.c +883 -0
  35. package/deps/capstone/arch/AArch64/AArch64Mapping.h +43 -0
  36. package/deps/capstone/arch/AArch64/AArch64MappingInsn.inc +37790 -0
  37. package/deps/capstone/arch/AArch64/AArch64MappingInsnName.inc +1282 -0
  38. package/deps/capstone/arch/AArch64/AArch64MappingInsnOp.inc +26994 -0
  39. package/deps/capstone/arch/AArch64/AArch64Module.c +44 -0
  40. package/deps/capstone/arch/AArch64/AArch64Module.h +12 -0
  41. package/deps/capstone/arch/ARM/ARMAddressingModes.h +698 -0
  42. package/deps/capstone/arch/ARM/ARMBaseInfo.h +486 -0
  43. package/deps/capstone/arch/ARM/ARMDisassembler.c +5763 -0
  44. package/deps/capstone/arch/ARM/ARMDisassembler.h +18 -0
  45. package/deps/capstone/arch/ARM/ARMGenAsmWriter.inc +9545 -0
  46. package/deps/capstone/arch/ARM/ARMGenDisassemblerTables.inc +15185 -0
  47. package/deps/capstone/arch/ARM/ARMGenInstrInfo.inc +6632 -0
  48. package/deps/capstone/arch/ARM/ARMGenRegisterInfo.inc +2102 -0
  49. package/deps/capstone/arch/ARM/ARMGenRegisterName.inc +231 -0
  50. package/deps/capstone/arch/ARM/ARMGenRegisterName_digit.inc +231 -0
  51. package/deps/capstone/arch/ARM/ARMGenSubtargetInfo.inc +162 -0
  52. package/deps/capstone/arch/ARM/ARMGenSystemRegister.inc +270 -0
  53. package/deps/capstone/arch/ARM/ARMInstPrinter.c +3364 -0
  54. package/deps/capstone/arch/ARM/ARMInstPrinter.h +43 -0
  55. package/deps/capstone/arch/ARM/ARMMapping.c +551 -0
  56. package/deps/capstone/arch/ARM/ARMMapping.h +40 -0
  57. package/deps/capstone/arch/ARM/ARMMappingInsn.inc +18772 -0
  58. package/deps/capstone/arch/ARM/ARMMappingInsnName.inc +475 -0
  59. package/deps/capstone/arch/ARM/ARMMappingInsnOp.inc +10729 -0
  60. package/deps/capstone/arch/ARM/ARMModule.c +63 -0
  61. package/deps/capstone/arch/ARM/ARMModule.h +12 -0
  62. package/deps/capstone/arch/BPF/BPFConstants.h +88 -0
  63. package/deps/capstone/arch/BPF/BPFDisassembler.c +464 -0
  64. package/deps/capstone/arch/BPF/BPFDisassembler.h +27 -0
  65. package/deps/capstone/arch/BPF/BPFInstPrinter.c +285 -0
  66. package/deps/capstone/arch/BPF/BPFInstPrinter.h +16 -0
  67. package/deps/capstone/arch/BPF/BPFMapping.c +513 -0
  68. package/deps/capstone/arch/BPF/BPFMapping.h +21 -0
  69. package/deps/capstone/arch/BPF/BPFModule.c +34 -0
  70. package/deps/capstone/arch/BPF/BPFModule.h +12 -0
  71. package/deps/capstone/arch/EVM/EVMDisassembler.c +379 -0
  72. package/deps/capstone/arch/EVM/EVMDisassembler.h +12 -0
  73. package/deps/capstone/arch/EVM/EVMInstPrinter.c +20 -0
  74. package/deps/capstone/arch/EVM/EVMInstPrinter.h +17 -0
  75. package/deps/capstone/arch/EVM/EVMMapping.c +344 -0
  76. package/deps/capstone/arch/EVM/EVMMapping.h +8 -0
  77. package/deps/capstone/arch/EVM/EVMMappingInsn.inc +259 -0
  78. package/deps/capstone/arch/EVM/EVMModule.c +33 -0
  79. package/deps/capstone/arch/EVM/EVMModule.h +12 -0
  80. package/deps/capstone/arch/M680X/M680XDisassembler.c +2307 -0
  81. package/deps/capstone/arch/M680X/M680XDisassembler.h +17 -0
  82. package/deps/capstone/arch/M680X/M680XDisassemblerInternals.h +57 -0
  83. package/deps/capstone/arch/M680X/M680XInstPrinter.c +360 -0
  84. package/deps/capstone/arch/M680X/M680XInstPrinter.h +25 -0
  85. package/deps/capstone/arch/M680X/M680XModule.c +77 -0
  86. package/deps/capstone/arch/M680X/M680XModule.h +12 -0
  87. package/deps/capstone/arch/M680X/cpu12.inc +335 -0
  88. package/deps/capstone/arch/M680X/hcs08.inc +60 -0
  89. package/deps/capstone/arch/M680X/hd6301.inc +15 -0
  90. package/deps/capstone/arch/M680X/hd6309.inc +259 -0
  91. package/deps/capstone/arch/M680X/insn_props.inc +367 -0
  92. package/deps/capstone/arch/M680X/m6800.inc +277 -0
  93. package/deps/capstone/arch/M680X/m6801.inc +39 -0
  94. package/deps/capstone/arch/M680X/m6805.inc +277 -0
  95. package/deps/capstone/arch/M680X/m6808.inc +91 -0
  96. package/deps/capstone/arch/M680X/m6809.inc +352 -0
  97. package/deps/capstone/arch/M680X/m6811.inc +105 -0
  98. package/deps/capstone/arch/M68K/M68KDisassembler.c +3668 -0
  99. package/deps/capstone/arch/M68K/M68KDisassembler.h +30 -0
  100. package/deps/capstone/arch/M68K/M68KInstPrinter.c +387 -0
  101. package/deps/capstone/arch/M68K/M68KInstPrinter.h +21 -0
  102. package/deps/capstone/arch/M68K/M68KInstructionTable.inc +65540 -0
  103. package/deps/capstone/arch/M68K/M68KModule.c +42 -0
  104. package/deps/capstone/arch/M68K/M68KModule.h +12 -0
  105. package/deps/capstone/arch/MOS65XX/MOS65XXDisassembler.c +544 -0
  106. package/deps/capstone/arch/MOS65XX/MOS65XXDisassembler.h +22 -0
  107. package/deps/capstone/arch/MOS65XX/MOS65XXDisassemblerInternals.h +23 -0
  108. package/deps/capstone/arch/MOS65XX/MOS65XXModule.c +79 -0
  109. package/deps/capstone/arch/MOS65XX/MOS65XXModule.h +12 -0
  110. package/deps/capstone/arch/MOS65XX/instruction_info.inc +106 -0
  111. package/deps/capstone/arch/MOS65XX/m6502.inc +256 -0
  112. package/deps/capstone/arch/MOS65XX/m65816.inc +256 -0
  113. package/deps/capstone/arch/MOS65XX/m65c02.inc +256 -0
  114. package/deps/capstone/arch/MOS65XX/mw65c02.inc +256 -0
  115. package/deps/capstone/arch/Mips/MipsDisassembler.c +1794 -0
  116. package/deps/capstone/arch/Mips/MipsDisassembler.h +16 -0
  117. package/deps/capstone/arch/Mips/MipsGenAsmWriter.inc +5725 -0
  118. package/deps/capstone/arch/Mips/MipsGenDisassemblerTables.inc +6942 -0
  119. package/deps/capstone/arch/Mips/MipsGenInstrInfo.inc +1805 -0
  120. package/deps/capstone/arch/Mips/MipsGenRegisterInfo.inc +1679 -0
  121. package/deps/capstone/arch/Mips/MipsGenSubtargetInfo.inc +52 -0
  122. package/deps/capstone/arch/Mips/MipsInstPrinter.c +424 -0
  123. package/deps/capstone/arch/Mips/MipsInstPrinter.h +25 -0
  124. package/deps/capstone/arch/Mips/MipsMapping.c +1070 -0
  125. package/deps/capstone/arch/Mips/MipsMapping.h +25 -0
  126. package/deps/capstone/arch/Mips/MipsMappingInsn.inc +9315 -0
  127. package/deps/capstone/arch/Mips/MipsModule.c +52 -0
  128. package/deps/capstone/arch/Mips/MipsModule.h +12 -0
  129. package/deps/capstone/arch/PowerPC/PPCDisassembler.c +627 -0
  130. package/deps/capstone/arch/PowerPC/PPCDisassembler.h +17 -0
  131. package/deps/capstone/arch/PowerPC/PPCGenAsmWriter.inc +11451 -0
  132. package/deps/capstone/arch/PowerPC/PPCGenDisassemblerTables.inc +6886 -0
  133. package/deps/capstone/arch/PowerPC/PPCGenInstrInfo.inc +4772 -0
  134. package/deps/capstone/arch/PowerPC/PPCGenRegisterInfo.inc +1122 -0
  135. package/deps/capstone/arch/PowerPC/PPCGenRegisterName.inc +278 -0
  136. package/deps/capstone/arch/PowerPC/PPCGenSubtargetInfo.inc +90 -0
  137. package/deps/capstone/arch/PowerPC/PPCInstPrinter.c +1238 -0
  138. package/deps/capstone/arch/PowerPC/PPCInstPrinter.h +15 -0
  139. package/deps/capstone/arch/PowerPC/PPCMapping.c +570 -0
  140. package/deps/capstone/arch/PowerPC/PPCMapping.h +40 -0
  141. package/deps/capstone/arch/PowerPC/PPCMappingInsn.inc +13220 -0
  142. package/deps/capstone/arch/PowerPC/PPCMappingInsnName.inc +1731 -0
  143. package/deps/capstone/arch/PowerPC/PPCModule.c +45 -0
  144. package/deps/capstone/arch/PowerPC/PPCModule.h +12 -0
  145. package/deps/capstone/arch/PowerPC/PPCPredicates.h +62 -0
  146. package/deps/capstone/arch/RISCV/RISCVBaseInfo.h +106 -0
  147. package/deps/capstone/arch/RISCV/RISCVDisassembler.c +433 -0
  148. package/deps/capstone/arch/RISCV/RISCVDisassembler.h +18 -0
  149. package/deps/capstone/arch/RISCV/RISCVGenAsmWriter.inc +2651 -0
  150. package/deps/capstone/arch/RISCV/RISCVGenDisassemblerTables.inc +1776 -0
  151. package/deps/capstone/arch/RISCV/RISCVGenInsnNameMaps.inc +275 -0
  152. package/deps/capstone/arch/RISCV/RISCVGenInstrInfo.inc +470 -0
  153. package/deps/capstone/arch/RISCV/RISCVGenRegisterInfo.inc +426 -0
  154. package/deps/capstone/arch/RISCV/RISCVGenSubtargetInfo.inc +33 -0
  155. package/deps/capstone/arch/RISCV/RISCVInstPrinter.c +447 -0
  156. package/deps/capstone/arch/RISCV/RISCVInstPrinter.h +24 -0
  157. package/deps/capstone/arch/RISCV/RISCVMapping.c +366 -0
  158. package/deps/capstone/arch/RISCV/RISCVMapping.h +22 -0
  159. package/deps/capstone/arch/RISCV/RISCVMappingInsn.inc +1635 -0
  160. package/deps/capstone/arch/RISCV/RISCVModule.c +42 -0
  161. package/deps/capstone/arch/RISCV/RISCVModule.h +12 -0
  162. package/deps/capstone/arch/SH/SHDisassembler.c +2221 -0
  163. package/deps/capstone/arch/SH/SHDisassembler.h +19 -0
  164. package/deps/capstone/arch/SH/SHInsnTable.inc +66 -0
  165. package/deps/capstone/arch/SH/SHInstPrinter.c +438 -0
  166. package/deps/capstone/arch/SH/SHInstPrinter.h +23 -0
  167. package/deps/capstone/arch/SH/SHModule.c +39 -0
  168. package/deps/capstone/arch/SH/SHModule.h +12 -0
  169. package/deps/capstone/arch/SH/mktable.rb +390 -0
  170. package/deps/capstone/arch/Sparc/Sparc.h +63 -0
  171. package/deps/capstone/arch/Sparc/SparcDisassembler.c +500 -0
  172. package/deps/capstone/arch/Sparc/SparcDisassembler.h +17 -0
  173. package/deps/capstone/arch/Sparc/SparcGenAsmWriter.inc +5709 -0
  174. package/deps/capstone/arch/Sparc/SparcGenDisassemblerTables.inc +2028 -0
  175. package/deps/capstone/arch/Sparc/SparcGenInstrInfo.inc +514 -0
  176. package/deps/capstone/arch/Sparc/SparcGenRegisterInfo.inc +451 -0
  177. package/deps/capstone/arch/Sparc/SparcGenSubtargetInfo.inc +27 -0
  178. package/deps/capstone/arch/Sparc/SparcInstPrinter.c +446 -0
  179. package/deps/capstone/arch/Sparc/SparcInstPrinter.h +17 -0
  180. package/deps/capstone/arch/Sparc/SparcMapping.c +665 -0
  181. package/deps/capstone/arch/Sparc/SparcMapping.h +34 -0
  182. package/deps/capstone/arch/Sparc/SparcMappingInsn.inc +2643 -0
  183. package/deps/capstone/arch/Sparc/SparcModule.c +45 -0
  184. package/deps/capstone/arch/Sparc/SparcModule.h +12 -0
  185. package/deps/capstone/arch/SystemZ/SystemZDisassembler.c +484 -0
  186. package/deps/capstone/arch/SystemZ/SystemZDisassembler.h +17 -0
  187. package/deps/capstone/arch/SystemZ/SystemZGenAsmWriter.inc +11575 -0
  188. package/deps/capstone/arch/SystemZ/SystemZGenDisassemblerTables.inc +10262 -0
  189. package/deps/capstone/arch/SystemZ/SystemZGenInsnNameMaps.inc +2348 -0
  190. package/deps/capstone/arch/SystemZ/SystemZGenInstrInfo.inc +2820 -0
  191. package/deps/capstone/arch/SystemZ/SystemZGenRegisterInfo.inc +741 -0
  192. package/deps/capstone/arch/SystemZ/SystemZGenSubtargetInfo.inc +49 -0
  193. package/deps/capstone/arch/SystemZ/SystemZInstPrinter.c +433 -0
  194. package/deps/capstone/arch/SystemZ/SystemZInstPrinter.h +15 -0
  195. package/deps/capstone/arch/SystemZ/SystemZMCTargetDesc.c +195 -0
  196. package/deps/capstone/arch/SystemZ/SystemZMCTargetDesc.h +51 -0
  197. package/deps/capstone/arch/SystemZ/SystemZMapping.c +479 -0
  198. package/deps/capstone/arch/SystemZ/SystemZMapping.h +23 -0
  199. package/deps/capstone/arch/SystemZ/SystemZMappingInsn.inc +14175 -0
  200. package/deps/capstone/arch/SystemZ/SystemZModule.c +44 -0
  201. package/deps/capstone/arch/SystemZ/SystemZModule.h +12 -0
  202. package/deps/capstone/arch/TMS320C64x/TMS320C64xDisassembler.c +628 -0
  203. package/deps/capstone/arch/TMS320C64x/TMS320C64xDisassembler.h +19 -0
  204. package/deps/capstone/arch/TMS320C64x/TMS320C64xGenAsmWriter.inc +684 -0
  205. package/deps/capstone/arch/TMS320C64x/TMS320C64xGenDisassemblerTables.inc +1352 -0
  206. package/deps/capstone/arch/TMS320C64x/TMS320C64xGenInstrInfo.inc +298 -0
  207. package/deps/capstone/arch/TMS320C64x/TMS320C64xGenRegisterInfo.inc +277 -0
  208. package/deps/capstone/arch/TMS320C64x/TMS320C64xInstPrinter.c +572 -0
  209. package/deps/capstone/arch/TMS320C64x/TMS320C64xInstPrinter.h +15 -0
  210. package/deps/capstone/arch/TMS320C64x/TMS320C64xMapping.c +1926 -0
  211. package/deps/capstone/arch/TMS320C64x/TMS320C64xMapping.h +26 -0
  212. package/deps/capstone/arch/TMS320C64x/TMS320C64xModule.c +39 -0
  213. package/deps/capstone/arch/TMS320C64x/TMS320C64xModule.h +12 -0
  214. package/deps/capstone/arch/TriCore/TriCore.td +134 -0
  215. package/deps/capstone/arch/TriCore/TriCoreCallingConv.td +61 -0
  216. package/deps/capstone/arch/TriCore/TriCoreDisassembler.c +1655 -0
  217. package/deps/capstone/arch/TriCore/TriCoreDisassembler.h +18 -0
  218. package/deps/capstone/arch/TriCore/TriCoreGenAsmWriter.inc +3691 -0
  219. package/deps/capstone/arch/TriCore/TriCoreGenCSFeatureName.inc +22 -0
  220. package/deps/capstone/arch/TriCore/TriCoreGenCSMappingInsn.inc +8938 -0
  221. package/deps/capstone/arch/TriCore/TriCoreGenCSMappingInsnName.inc +404 -0
  222. package/deps/capstone/arch/TriCore/TriCoreGenCSMappingInsnOp.inc +7994 -0
  223. package/deps/capstone/arch/TriCore/TriCoreGenCSOpGroup.inc +32 -0
  224. package/deps/capstone/arch/TriCore/TriCoreGenDisassemblerTables.inc +4044 -0
  225. package/deps/capstone/arch/TriCore/TriCoreGenInstrInfo.inc +2693 -0
  226. package/deps/capstone/arch/TriCore/TriCoreGenRegisterInfo.inc +295 -0
  227. package/deps/capstone/arch/TriCore/TriCoreGenSubtargetInfo.inc +40 -0
  228. package/deps/capstone/arch/TriCore/TriCoreInstPrinter.c +488 -0
  229. package/deps/capstone/arch/TriCore/TriCoreInstrFormats.td +773 -0
  230. package/deps/capstone/arch/TriCore/TriCoreInstrInfo.td +1873 -0
  231. package/deps/capstone/arch/TriCore/TriCoreLinkage.h +21 -0
  232. package/deps/capstone/arch/TriCore/TriCoreMapping.c +241 -0
  233. package/deps/capstone/arch/TriCore/TriCoreMapping.h +32 -0
  234. package/deps/capstone/arch/TriCore/TriCoreModule.c +44 -0
  235. package/deps/capstone/arch/TriCore/TriCoreModule.h +11 -0
  236. package/deps/capstone/arch/TriCore/TriCoreRegisterInfo.td +153 -0
  237. package/deps/capstone/arch/WASM/WASMDisassembler.c +1009 -0
  238. package/deps/capstone/arch/WASM/WASMDisassembler.h +12 -0
  239. package/deps/capstone/arch/WASM/WASMInstPrinter.c +47 -0
  240. package/deps/capstone/arch/WASM/WASMInstPrinter.h +18 -0
  241. package/deps/capstone/arch/WASM/WASMMapping.c +333 -0
  242. package/deps/capstone/arch/WASM/WASMMapping.h +9 -0
  243. package/deps/capstone/arch/WASM/WASMModule.c +33 -0
  244. package/deps/capstone/arch/WASM/WASMModule.h +12 -0
  245. package/deps/capstone/arch/X86/X86ATTInstPrinter.c +997 -0
  246. package/deps/capstone/arch/X86/X86BaseInfo.h +50 -0
  247. package/deps/capstone/arch/X86/X86Disassembler.c +1033 -0
  248. package/deps/capstone/arch/X86/X86Disassembler.h +28 -0
  249. package/deps/capstone/arch/X86/X86DisassemblerDecoder.c +2358 -0
  250. package/deps/capstone/arch/X86/X86DisassemblerDecoder.h +725 -0
  251. package/deps/capstone/arch/X86/X86DisassemblerDecoderCommon.h +483 -0
  252. package/deps/capstone/arch/X86/X86GenAsmWriter.inc +49199 -0
  253. package/deps/capstone/arch/X86/X86GenAsmWriter1.inc +33196 -0
  254. package/deps/capstone/arch/X86/X86GenAsmWriter1_reduce.inc +2531 -0
  255. package/deps/capstone/arch/X86/X86GenAsmWriter_reduce.inc +2855 -0
  256. package/deps/capstone/arch/X86/X86GenDisassemblerTables.inc +112961 -0
  257. package/deps/capstone/arch/X86/X86GenDisassemblerTables2.inc +102151 -0
  258. package/deps/capstone/arch/X86/X86GenDisassemblerTables_reduce.inc +28047 -0
  259. package/deps/capstone/arch/X86/X86GenDisassemblerTables_reduce2.inc +18827 -0
  260. package/deps/capstone/arch/X86/X86GenInstrInfo.inc +15158 -0
  261. package/deps/capstone/arch/X86/X86GenInstrInfo_reduce.inc +1564 -0
  262. package/deps/capstone/arch/X86/X86GenRegisterInfo.inc +1549 -0
  263. package/deps/capstone/arch/X86/X86GenRegisterName.inc +292 -0
  264. package/deps/capstone/arch/X86/X86GenRegisterName1.inc +291 -0
  265. package/deps/capstone/arch/X86/X86ImmSize.inc +335 -0
  266. package/deps/capstone/arch/X86/X86InstPrinter.h +26 -0
  267. package/deps/capstone/arch/X86/X86InstPrinterCommon.c +116 -0
  268. package/deps/capstone/arch/X86/X86InstPrinterCommon.h +16 -0
  269. package/deps/capstone/arch/X86/X86IntelInstPrinter.c +1061 -0
  270. package/deps/capstone/arch/X86/X86Lookup16.inc +16874 -0
  271. package/deps/capstone/arch/X86/X86Lookup16_reduce.inc +2308 -0
  272. package/deps/capstone/arch/X86/X86Mapping.c +2266 -0
  273. package/deps/capstone/arch/X86/X86Mapping.h +96 -0
  274. package/deps/capstone/arch/X86/X86MappingInsn.inc +105977 -0
  275. package/deps/capstone/arch/X86/X86MappingInsnName.inc +1527 -0
  276. package/deps/capstone/arch/X86/X86MappingInsnName_reduce.inc +348 -0
  277. package/deps/capstone/arch/X86/X86MappingInsnOp.inc +75700 -0
  278. package/deps/capstone/arch/X86/X86MappingInsnOp_reduce.inc +7729 -0
  279. package/deps/capstone/arch/X86/X86MappingInsn_reduce.inc +10819 -0
  280. package/deps/capstone/arch/X86/X86MappingReg.inc +280 -0
  281. package/deps/capstone/arch/X86/X86Module.c +94 -0
  282. package/deps/capstone/arch/X86/X86Module.h +12 -0
  283. package/deps/capstone/arch/XCore/XCoreDisassembler.c +794 -0
  284. package/deps/capstone/arch/XCore/XCoreDisassembler.h +17 -0
  285. package/deps/capstone/arch/XCore/XCoreGenAsmWriter.inc +772 -0
  286. package/deps/capstone/arch/XCore/XCoreGenDisassemblerTables.inc +853 -0
  287. package/deps/capstone/arch/XCore/XCoreGenInstrInfo.inc +267 -0
  288. package/deps/capstone/arch/XCore/XCoreGenRegisterInfo.inc +110 -0
  289. package/deps/capstone/arch/XCore/XCoreInstPrinter.c +250 -0
  290. package/deps/capstone/arch/XCore/XCoreInstPrinter.h +18 -0
  291. package/deps/capstone/arch/XCore/XCoreMapping.c +297 -0
  292. package/deps/capstone/arch/XCore/XCoreMapping.h +26 -0
  293. package/deps/capstone/arch/XCore/XCoreMappingInsn.inc +1287 -0
  294. package/deps/capstone/arch/XCore/XCoreModule.c +41 -0
  295. package/deps/capstone/arch/XCore/XCoreModule.h +12 -0
  296. package/deps/capstone/cs.c +1664 -0
  297. package/deps/capstone/cs_priv.h +101 -0
  298. package/deps/capstone/cs_simple_types.h +886 -0
  299. package/deps/capstone/include/capstone/arm.h +991 -0
  300. package/deps/capstone/include/capstone/arm64.h +3159 -0
  301. package/deps/capstone/include/capstone/bpf.h +209 -0
  302. package/deps/capstone/include/capstone/capstone.h +875 -0
  303. package/deps/capstone/include/capstone/evm.h +188 -0
  304. package/deps/capstone/include/capstone/m680x.h +537 -0
  305. package/deps/capstone/include/capstone/m68k.h +613 -0
  306. package/deps/capstone/include/capstone/mips.h +956 -0
  307. package/deps/capstone/include/capstone/mos65xx.h +204 -0
  308. package/deps/capstone/include/capstone/platform.h +122 -0
  309. package/deps/capstone/include/capstone/ppc.h +2108 -0
  310. package/deps/capstone/include/capstone/riscv.h +531 -0
  311. package/deps/capstone/include/capstone/sh.h +465 -0
  312. package/deps/capstone/include/capstone/sparc.h +520 -0
  313. package/deps/capstone/include/capstone/systemz.h +2601 -0
  314. package/deps/capstone/include/capstone/tms320c64x.h +359 -0
  315. package/deps/capstone/include/capstone/tricore.h +567 -0
  316. package/deps/capstone/include/capstone/wasm.h +250 -0
  317. package/deps/capstone/include/capstone/x86.h +1986 -0
  318. package/deps/capstone/include/capstone/xcore.h +235 -0
  319. package/deps/capstone/include/platform.h +110 -0
  320. package/deps/capstone/include/windowsce/intrin.h +12 -0
  321. package/deps/capstone/include/windowsce/stdint.h +133 -0
  322. package/deps/capstone/utils.c +140 -0
  323. package/deps/capstone/utils.h +54 -0
  324. package/index.d.ts +448 -0
  325. package/index.js +64 -0
  326. package/index.mjs +25 -0
  327. package/package.json +82 -0
  328. package/prebuilds/win32-x64/hexcore-capstone.node +0 -0
  329. package/src/capstone_wrapper.cpp +910 -0
  330. package/src/capstone_wrapper.h +147 -0
  331. package/src/disasm_async_worker.h +215 -0
  332. package/src/main.cpp +145 -0
@@ -0,0 +1,44 @@
1
+ /* Capstone Disassembly Engine */
2
+ /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */
3
+
4
+ #ifdef CAPSTONE_HAS_SYSZ
5
+
6
+ #include "../../utils.h"
7
+ #include "../../MCRegisterInfo.h"
8
+ #include "SystemZDisassembler.h"
9
+ #include "SystemZInstPrinter.h"
10
+ #include "SystemZMapping.h"
11
+ #include "SystemZModule.h"
12
+
13
+ cs_err SystemZ_global_init(cs_struct *ud)
14
+ {
15
+ MCRegisterInfo *mri;
16
+ mri = cs_mem_malloc(sizeof(*mri));
17
+
18
+ SystemZ_init(mri);
19
+ ud->printer = SystemZ_printInst;
20
+ ud->printer_info = mri;
21
+ ud->getinsn_info = mri;
22
+ ud->disasm = SystemZ_getInstruction;
23
+ ud->post_printer = SystemZ_post_printer;
24
+
25
+ ud->reg_name = SystemZ_reg_name;
26
+ ud->insn_id = SystemZ_get_insn_id;
27
+ ud->insn_name = SystemZ_insn_name;
28
+ ud->group_name = SystemZ_group_name;
29
+
30
+ return CS_ERR_OK;
31
+ }
32
+
33
+ cs_err SystemZ_option(cs_struct *handle, cs_opt_type type, size_t value)
34
+ {
35
+ if (type == CS_OPT_SYNTAX)
36
+ handle->syntax = (int) value;
37
+
38
+ // Do not set mode because only CS_MODE_BIG_ENDIAN is valid; we cannot
39
+ // test for CS_MODE_LITTLE_ENDIAN because it is 0
40
+
41
+ return CS_ERR_OK;
42
+ }
43
+
44
+ #endif
@@ -0,0 +1,12 @@
1
+ /* Capstone Disassembly Engine */
2
+ /* By Travis Finkenauer <tmfinken@gmail.com>, 2018 */
3
+
4
+ #ifndef CS_SYSTEMZ_MODULE_H
5
+ #define CS_SYSTEMZ_MODULE_H
6
+
7
+ #include "../../utils.h"
8
+
9
+ cs_err SystemZ_global_init(cs_struct *ud);
10
+ cs_err SystemZ_option(cs_struct *handle, cs_opt_type type, size_t value);
11
+
12
+ #endif
@@ -0,0 +1,628 @@
1
+ /* Capstone Disassembly Engine */
2
+ /* TMS320C64x Backend by Fotis Loukos <me@fotisl.com> 2016 */
3
+
4
+ #ifdef CAPSTONE_HAS_TMS320C64X
5
+
6
+ #include <string.h>
7
+
8
+ #include "../../cs_priv.h"
9
+ #include "../../utils.h"
10
+
11
+ #include "TMS320C64xDisassembler.h"
12
+
13
+ #include "../../MCInst.h"
14
+ #include "../../MCInstrDesc.h"
15
+ #include "../../MCFixedLenDisassembler.h"
16
+ #include "../../MCRegisterInfo.h"
17
+ #include "../../MCDisassembler.h"
18
+ #include "../../MathExtras.h"
19
+
20
+ static uint64_t getFeatureBits(int mode);
21
+
22
+ static DecodeStatus DecodeGPRegsRegisterClass(MCInst *Inst, unsigned RegNo,
23
+ uint64_t Address, void *Decoder);
24
+
25
+ static DecodeStatus DecodeControlRegsRegisterClass(MCInst *Inst, unsigned RegNo,
26
+ uint64_t Address, void *Decoder);
27
+
28
+ static DecodeStatus DecodeScst5(MCInst *Inst, unsigned Val,
29
+ uint64_t Address, void *Decoder);
30
+
31
+ static DecodeStatus DecodeScst16(MCInst *Inst, unsigned Val,
32
+ uint64_t Address, void *Decoder);
33
+
34
+ static DecodeStatus DecodePCRelScst7(MCInst *Inst, unsigned Val,
35
+ uint64_t Address, void *Decoder);
36
+
37
+ static DecodeStatus DecodePCRelScst10(MCInst *Inst, unsigned Val,
38
+ uint64_t Address, void *Decoder);
39
+
40
+ static DecodeStatus DecodePCRelScst12(MCInst *Inst, unsigned Val,
41
+ uint64_t Address, void *Decoder);
42
+
43
+ static DecodeStatus DecodePCRelScst21(MCInst *Inst, unsigned Val,
44
+ uint64_t Address, void *Decoder);
45
+
46
+ static DecodeStatus DecodeMemOperand(MCInst *Inst, unsigned Val,
47
+ uint64_t Address, void *Decoder);
48
+
49
+ static DecodeStatus DecodeMemOperandSc(MCInst *Inst, unsigned Val,
50
+ uint64_t Address, void *Decoder);
51
+
52
+ static DecodeStatus DecodeMemOperand2(MCInst *Inst, unsigned Val,
53
+ uint64_t Address, void *Decoder);
54
+
55
+ static DecodeStatus DecodeRegPair5(MCInst *Inst, unsigned RegNo,
56
+ uint64_t Address, void *Decoder);
57
+
58
+ static DecodeStatus DecodeRegPair4(MCInst *Inst, unsigned RegNo,
59
+ uint64_t Address, void *Decoder);
60
+
61
+ static DecodeStatus DecodeCondRegister(MCInst *Inst, unsigned Val,
62
+ uint64_t Address, void *Decoder);
63
+
64
+ static DecodeStatus DecodeCondRegisterZero(MCInst *Inst, unsigned Val,
65
+ uint64_t Address, void *Decoder);
66
+
67
+ static DecodeStatus DecodeSide(MCInst *Inst, unsigned Val,
68
+ uint64_t Address, void *Decoder);
69
+
70
+ static DecodeStatus DecodeParallel(MCInst *Inst, unsigned Val,
71
+ uint64_t Address, void *Decoder);
72
+
73
+ static DecodeStatus DecodeCrosspathX1(MCInst *Inst, unsigned Val,
74
+ uint64_t Address, void *Decoder);
75
+
76
+ static DecodeStatus DecodeCrosspathX2(MCInst *Inst, unsigned Val,
77
+ uint64_t Address, void *Decoder);
78
+
79
+ static DecodeStatus DecodeCrosspathX3(MCInst *Inst, unsigned Val,
80
+ uint64_t Address, void *Decoder);
81
+
82
+ static DecodeStatus DecodeNop(MCInst *Inst, unsigned Val,
83
+ uint64_t Address, void *Decoder);
84
+
85
+ #include "TMS320C64xGenDisassemblerTables.inc"
86
+
87
+ #define GET_REGINFO_ENUM
88
+ #define GET_REGINFO_MC_DESC
89
+ #include "TMS320C64xGenRegisterInfo.inc"
90
+
91
+ static const unsigned GPRegsDecoderTable[] = {
92
+ TMS320C64x_A0, TMS320C64x_A1, TMS320C64x_A2, TMS320C64x_A3,
93
+ TMS320C64x_A4, TMS320C64x_A5, TMS320C64x_A6, TMS320C64x_A7,
94
+ TMS320C64x_A8, TMS320C64x_A9, TMS320C64x_A10, TMS320C64x_A11,
95
+ TMS320C64x_A12, TMS320C64x_A13, TMS320C64x_A14, TMS320C64x_A15,
96
+ TMS320C64x_A16, TMS320C64x_A17, TMS320C64x_A18, TMS320C64x_A19,
97
+ TMS320C64x_A20, TMS320C64x_A21, TMS320C64x_A22, TMS320C64x_A23,
98
+ TMS320C64x_A24, TMS320C64x_A25, TMS320C64x_A26, TMS320C64x_A27,
99
+ TMS320C64x_A28, TMS320C64x_A29, TMS320C64x_A30, TMS320C64x_A31
100
+ };
101
+
102
+ static const unsigned ControlRegsDecoderTable[] = {
103
+ TMS320C64x_AMR, TMS320C64x_CSR, TMS320C64x_ISR, TMS320C64x_ICR,
104
+ TMS320C64x_IER, TMS320C64x_ISTP, TMS320C64x_IRP, TMS320C64x_NRP,
105
+ ~0U, ~0U, TMS320C64x_TSCL, TMS320C64x_TSCH,
106
+ ~0U, TMS320C64x_ILC, TMS320C64x_RILC, TMS320C64x_REP,
107
+ TMS320C64x_PCE1, TMS320C64x_DNUM, ~0U, ~0U,
108
+ ~0U, TMS320C64x_SSR, TMS320C64x_GPLYA, TMS320C64x_GPLYB,
109
+ TMS320C64x_GFPGFR, TMS320C64x_DIER, TMS320C64x_TSR, TMS320C64x_ITSR,
110
+ TMS320C64x_NTSR, TMS320C64x_ECR, ~0U, TMS320C64x_IERR
111
+ };
112
+
113
+ static uint64_t getFeatureBits(int mode)
114
+ {
115
+ // support everything
116
+ return (uint64_t)-1;
117
+ }
118
+
119
+ static unsigned getReg(const unsigned *RegTable, unsigned RegNo)
120
+ {
121
+ if(RegNo > 31)
122
+ return ~0U;
123
+ return RegTable[RegNo];
124
+ }
125
+
126
+ static DecodeStatus DecodeGPRegsRegisterClass(MCInst *Inst, unsigned RegNo,
127
+ uint64_t Address, void *Decoder)
128
+ {
129
+ unsigned Reg;
130
+
131
+ if(RegNo > 31)
132
+ return MCDisassembler_Fail;
133
+
134
+ Reg = getReg(GPRegsDecoderTable, RegNo);
135
+ if(Reg == ~0U)
136
+ return MCDisassembler_Fail;
137
+ MCOperand_CreateReg0(Inst, Reg);
138
+
139
+ return MCDisassembler_Success;
140
+ }
141
+
142
+ static DecodeStatus DecodeControlRegsRegisterClass(MCInst *Inst, unsigned RegNo,
143
+ uint64_t Address, void *Decoder)
144
+ {
145
+ unsigned Reg;
146
+
147
+ if(RegNo > 31)
148
+ return MCDisassembler_Fail;
149
+
150
+ Reg = getReg(ControlRegsDecoderTable, RegNo);
151
+ if(Reg == ~0U)
152
+ return MCDisassembler_Fail;
153
+ MCOperand_CreateReg0(Inst, Reg);
154
+
155
+ return MCDisassembler_Success;
156
+ }
157
+
158
+ static DecodeStatus DecodeScst5(MCInst *Inst, unsigned Val,
159
+ uint64_t Address, void *Decoder)
160
+ {
161
+ int32_t imm;
162
+
163
+ imm = Val;
164
+ /* Sign extend 5 bit value */
165
+ if(imm & (1 << (5 - 1)))
166
+ imm |= ~((1 << 5) - 1);
167
+
168
+ MCOperand_CreateImm0(Inst, imm);
169
+
170
+ return MCDisassembler_Success;
171
+ }
172
+
173
+ static DecodeStatus DecodeScst16(MCInst *Inst, unsigned Val,
174
+ uint64_t Address, void *Decoder)
175
+ {
176
+ int32_t imm;
177
+
178
+ imm = Val;
179
+ /* Sign extend 16 bit value */
180
+ if(imm & (1 << (16 - 1)))
181
+ imm |= ~((1 << 16) - 1);
182
+
183
+ MCOperand_CreateImm0(Inst, imm);
184
+
185
+ return MCDisassembler_Success;
186
+ }
187
+
188
+ static DecodeStatus DecodePCRelScst7(MCInst *Inst, unsigned Val,
189
+ uint64_t Address, void *Decoder)
190
+ {
191
+ int32_t imm;
192
+
193
+ imm = Val;
194
+ /* Sign extend 7 bit value */
195
+ if(imm & (1 << (7 - 1)))
196
+ imm |= ~((1 << 7) - 1);
197
+
198
+ /* Address is relative to the address of the first instruction in the fetch packet */
199
+ MCOperand_CreateImm0(Inst, (Address & ~31) + (imm * 4));
200
+
201
+ return MCDisassembler_Success;
202
+ }
203
+
204
+ static DecodeStatus DecodePCRelScst10(MCInst *Inst, unsigned Val,
205
+ uint64_t Address, void *Decoder)
206
+ {
207
+ int32_t imm;
208
+
209
+ imm = Val;
210
+ /* Sign extend 10 bit value */
211
+ if(imm & (1 << (10 - 1)))
212
+ imm |= ~((1 << 10) - 1);
213
+
214
+ /* Address is relative to the address of the first instruction in the fetch packet */
215
+ MCOperand_CreateImm0(Inst, (Address & ~31) + (imm * 4));
216
+
217
+ return MCDisassembler_Success;
218
+ }
219
+
220
+ static DecodeStatus DecodePCRelScst12(MCInst *Inst, unsigned Val,
221
+ uint64_t Address, void *Decoder)
222
+ {
223
+ int32_t imm;
224
+
225
+ imm = Val;
226
+ /* Sign extend 12 bit value */
227
+ if(imm & (1 << (12 - 1)))
228
+ imm |= ~((1 << 12) - 1);
229
+
230
+ /* Address is relative to the address of the first instruction in the fetch packet */
231
+ MCOperand_CreateImm0(Inst, (Address & ~31) + (imm * 4));
232
+
233
+ return MCDisassembler_Success;
234
+ }
235
+
236
+ static DecodeStatus DecodePCRelScst21(MCInst *Inst, unsigned Val,
237
+ uint64_t Address, void *Decoder)
238
+ {
239
+ int32_t imm;
240
+
241
+ imm = Val;
242
+ /* Sign extend 21 bit value */
243
+ if(imm & (1 << (21 - 1)))
244
+ imm |= ~((1 << 21) - 1);
245
+
246
+ /* Address is relative to the address of the first instruction in the fetch packet */
247
+ MCOperand_CreateImm0(Inst, (Address & ~31) + (imm * 4));
248
+
249
+ return MCDisassembler_Success;
250
+ }
251
+
252
+ static DecodeStatus DecodeMemOperand(MCInst *Inst, unsigned Val,
253
+ uint64_t Address, void *Decoder)
254
+ {
255
+ return DecodeMemOperandSc(Inst, Val | (1 << 15), Address, Decoder);
256
+ }
257
+
258
+ static DecodeStatus DecodeMemOperandSc(MCInst *Inst, unsigned Val,
259
+ uint64_t Address, void *Decoder)
260
+ {
261
+ uint8_t scaled, base, offset, mode, unit;
262
+ unsigned basereg, offsetreg;
263
+
264
+ scaled = (Val >> 15) & 1;
265
+ base = (Val >> 10) & 0x1f;
266
+ offset = (Val >> 5) & 0x1f;
267
+ mode = (Val >> 1) & 0xf;
268
+ unit = Val & 1;
269
+
270
+ if((base >= TMS320C64X_REG_A0) && (base <= TMS320C64X_REG_A31))
271
+ base = (base - TMS320C64X_REG_A0 + TMS320C64X_REG_B0);
272
+ else if((base >= TMS320C64X_REG_B0) && (base <= TMS320C64X_REG_B31))
273
+ base = (base - TMS320C64X_REG_B0 + TMS320C64X_REG_A0);
274
+ basereg = getReg(GPRegsDecoderTable, base);
275
+ if (basereg == ~0U)
276
+ return MCDisassembler_Fail;
277
+
278
+ switch(mode) {
279
+ case 0:
280
+ case 1:
281
+ case 8:
282
+ case 9:
283
+ case 10:
284
+ case 11:
285
+ MCOperand_CreateImm0(Inst, (scaled << 19) | (basereg << 12) | (offset << 5) | (mode << 1) | unit);
286
+ break;
287
+ case 4:
288
+ case 5:
289
+ case 12:
290
+ case 13:
291
+ case 14:
292
+ case 15:
293
+ if((offset >= TMS320C64X_REG_A0) && (offset <= TMS320C64X_REG_A31))
294
+ offset = (offset - TMS320C64X_REG_A0 + TMS320C64X_REG_B0);
295
+ else if((offset >= TMS320C64X_REG_B0) && (offset <= TMS320C64X_REG_B31))
296
+ offset = (offset - TMS320C64X_REG_B0 + TMS320C64X_REG_A0);
297
+ offsetreg = getReg(GPRegsDecoderTable, offset);
298
+ if (offsetreg == ~0U)
299
+ return MCDisassembler_Fail;
300
+ MCOperand_CreateImm0(Inst, (scaled << 19) | (basereg << 12) | (offsetreg << 5) | (mode << 1) | unit);
301
+ break;
302
+ default:
303
+ return MCDisassembler_Fail;
304
+ }
305
+
306
+ return MCDisassembler_Success;
307
+ }
308
+
309
+ static DecodeStatus DecodeMemOperand2(MCInst *Inst, unsigned Val,
310
+ uint64_t Address, void *Decoder)
311
+ {
312
+ uint16_t offset;
313
+ unsigned basereg;
314
+
315
+ if(Val & 1)
316
+ basereg = TMS320C64X_REG_B15;
317
+ else
318
+ basereg = TMS320C64X_REG_B14;
319
+
320
+ offset = (Val >> 1) & 0x7fff;
321
+ MCOperand_CreateImm0(Inst, (offset << 7) | basereg);
322
+
323
+ return MCDisassembler_Success;
324
+ }
325
+
326
+ static DecodeStatus DecodeRegPair5(MCInst *Inst, unsigned RegNo,
327
+ uint64_t Address, void *Decoder)
328
+ {
329
+ unsigned Reg;
330
+
331
+ if(RegNo > 31)
332
+ return MCDisassembler_Fail;
333
+
334
+ Reg = getReg(GPRegsDecoderTable, RegNo);
335
+ MCOperand_CreateReg0(Inst, Reg);
336
+
337
+ return MCDisassembler_Success;
338
+ }
339
+
340
+ static DecodeStatus DecodeRegPair4(MCInst *Inst, unsigned RegNo,
341
+ uint64_t Address, void *Decoder)
342
+ {
343
+ unsigned Reg;
344
+
345
+ if(RegNo > 15)
346
+ return MCDisassembler_Fail;
347
+
348
+ Reg = getReg(GPRegsDecoderTable, RegNo << 1);
349
+ MCOperand_CreateReg0(Inst, Reg);
350
+
351
+ return MCDisassembler_Success;
352
+ }
353
+
354
+ static DecodeStatus DecodeCondRegister(MCInst *Inst, unsigned Val,
355
+ uint64_t Address, void *Decoder)
356
+ {
357
+ DecodeStatus ret = MCDisassembler_Success;
358
+
359
+ if(!Inst->flat_insn->detail)
360
+ return MCDisassembler_Success;
361
+
362
+ switch(Val) {
363
+ case 0:
364
+ case 7:
365
+ Inst->flat_insn->detail->tms320c64x.condition.reg = TMS320C64X_REG_INVALID;
366
+ break;
367
+ case 1:
368
+ Inst->flat_insn->detail->tms320c64x.condition.reg = TMS320C64X_REG_B0;
369
+ break;
370
+ case 2:
371
+ Inst->flat_insn->detail->tms320c64x.condition.reg = TMS320C64X_REG_B1;
372
+ break;
373
+ case 3:
374
+ Inst->flat_insn->detail->tms320c64x.condition.reg = TMS320C64X_REG_B2;
375
+ break;
376
+ case 4:
377
+ Inst->flat_insn->detail->tms320c64x.condition.reg = TMS320C64X_REG_A1;
378
+ break;
379
+ case 5:
380
+ Inst->flat_insn->detail->tms320c64x.condition.reg = TMS320C64X_REG_A2;
381
+ break;
382
+ case 6:
383
+ Inst->flat_insn->detail->tms320c64x.condition.reg = TMS320C64X_REG_A0;
384
+ break;
385
+ default:
386
+ Inst->flat_insn->detail->tms320c64x.condition.reg = TMS320C64X_REG_INVALID;
387
+ ret = MCDisassembler_Fail;
388
+ break;
389
+ }
390
+
391
+ return ret;
392
+ }
393
+
394
+ static DecodeStatus DecodeCondRegisterZero(MCInst *Inst, unsigned Val,
395
+ uint64_t Address, void *Decoder)
396
+ {
397
+ DecodeStatus ret = MCDisassembler_Success;
398
+
399
+ if(!Inst->flat_insn->detail)
400
+ return MCDisassembler_Success;
401
+
402
+ switch(Val) {
403
+ case 0:
404
+ Inst->flat_insn->detail->tms320c64x.condition.zero = 0;
405
+ break;
406
+ case 1:
407
+ Inst->flat_insn->detail->tms320c64x.condition.zero = 1;
408
+ break;
409
+ default:
410
+ Inst->flat_insn->detail->tms320c64x.condition.zero = 0;
411
+ ret = MCDisassembler_Fail;
412
+ break;
413
+ }
414
+
415
+ return ret;
416
+ }
417
+
418
+ static DecodeStatus DecodeSide(MCInst *Inst, unsigned Val,
419
+ uint64_t Address, void *Decoder)
420
+ {
421
+ DecodeStatus ret = MCDisassembler_Success;
422
+ MCOperand *op;
423
+ int i;
424
+
425
+ /* This is pretty messy, probably we should find a better way */
426
+ if(Val == 1) {
427
+ for(i = 0; i < Inst->size; i++) {
428
+ op = &Inst->Operands[i];
429
+ if(op->Kind == kRegister) {
430
+ if((op->RegVal >= TMS320C64X_REG_A0) && (op->RegVal <= TMS320C64X_REG_A31))
431
+ op->RegVal = (op->RegVal - TMS320C64X_REG_A0 + TMS320C64X_REG_B0);
432
+ else if((op->RegVal >= TMS320C64X_REG_B0) && (op->RegVal <= TMS320C64X_REG_B31))
433
+ op->RegVal = (op->RegVal - TMS320C64X_REG_B0 + TMS320C64X_REG_A0);
434
+ }
435
+ }
436
+ }
437
+
438
+ if(!Inst->flat_insn->detail)
439
+ return MCDisassembler_Success;
440
+
441
+ switch(Val) {
442
+ case 0:
443
+ Inst->flat_insn->detail->tms320c64x.funit.side = 1;
444
+ break;
445
+ case 1:
446
+ Inst->flat_insn->detail->tms320c64x.funit.side = 2;
447
+ break;
448
+ default:
449
+ Inst->flat_insn->detail->tms320c64x.funit.side = 0;
450
+ ret = MCDisassembler_Fail;
451
+ break;
452
+ }
453
+
454
+ return ret;
455
+ }
456
+
457
+ static DecodeStatus DecodeParallel(MCInst *Inst, unsigned Val,
458
+ uint64_t Address, void *Decoder)
459
+ {
460
+ DecodeStatus ret = MCDisassembler_Success;
461
+
462
+ if(!Inst->flat_insn->detail)
463
+ return MCDisassembler_Success;
464
+
465
+ switch(Val) {
466
+ case 0:
467
+ Inst->flat_insn->detail->tms320c64x.parallel = 0;
468
+ break;
469
+ case 1:
470
+ Inst->flat_insn->detail->tms320c64x.parallel = 1;
471
+ break;
472
+ default:
473
+ Inst->flat_insn->detail->tms320c64x.parallel = -1;
474
+ ret = MCDisassembler_Fail;
475
+ break;
476
+ }
477
+
478
+ return ret;
479
+ }
480
+
481
+ static DecodeStatus DecodeCrosspathX1(MCInst *Inst, unsigned Val,
482
+ uint64_t Address, void *Decoder)
483
+ {
484
+ DecodeStatus ret = MCDisassembler_Success;
485
+ MCOperand *op;
486
+
487
+ if(!Inst->flat_insn->detail)
488
+ return MCDisassembler_Success;
489
+
490
+ switch(Val) {
491
+ case 0:
492
+ Inst->flat_insn->detail->tms320c64x.funit.crosspath = 0;
493
+ break;
494
+ case 1:
495
+ Inst->flat_insn->detail->tms320c64x.funit.crosspath = 1;
496
+ op = &Inst->Operands[0];
497
+ if(op->Kind == kRegister) {
498
+ if((op->RegVal >= TMS320C64X_REG_A0) && (op->RegVal <= TMS320C64X_REG_A31))
499
+ op->RegVal = (op->RegVal - TMS320C64X_REG_A0 + TMS320C64X_REG_B0);
500
+ else if((op->RegVal >= TMS320C64X_REG_B0) && (op->RegVal <= TMS320C64X_REG_B31))
501
+ op->RegVal = (op->RegVal - TMS320C64X_REG_B0 + TMS320C64X_REG_A0);
502
+ }
503
+ break;
504
+ default:
505
+ Inst->flat_insn->detail->tms320c64x.funit.crosspath = -1;
506
+ ret = MCDisassembler_Fail;
507
+ break;
508
+ }
509
+
510
+ return ret;
511
+ }
512
+
513
+ static DecodeStatus DecodeCrosspathX2(MCInst *Inst, unsigned Val,
514
+ uint64_t Address, void *Decoder)
515
+ {
516
+ DecodeStatus ret = MCDisassembler_Success;
517
+ MCOperand *op;
518
+
519
+ if(!Inst->flat_insn->detail)
520
+ return MCDisassembler_Success;
521
+
522
+ switch(Val) {
523
+ case 0:
524
+ Inst->flat_insn->detail->tms320c64x.funit.crosspath = 0;
525
+ break;
526
+ case 1:
527
+ Inst->flat_insn->detail->tms320c64x.funit.crosspath = 1;
528
+ op = &Inst->Operands[1];
529
+ if(op->Kind == kRegister) {
530
+ if((op->RegVal >= TMS320C64X_REG_A0) && (op->RegVal <= TMS320C64X_REG_A31))
531
+ op->RegVal = (op->RegVal - TMS320C64X_REG_A0 + TMS320C64X_REG_B0);
532
+ else if((op->RegVal >= TMS320C64X_REG_B0) && (op->RegVal <= TMS320C64X_REG_B31))
533
+ op->RegVal = (op->RegVal - TMS320C64X_REG_B0 + TMS320C64X_REG_A0);
534
+ }
535
+ break;
536
+ default:
537
+ Inst->flat_insn->detail->tms320c64x.funit.crosspath = -1;
538
+ ret = MCDisassembler_Fail;
539
+ break;
540
+ }
541
+
542
+ return ret;
543
+ }
544
+
545
+ static DecodeStatus DecodeCrosspathX3(MCInst *Inst, unsigned Val,
546
+ uint64_t Address, void *Decoder)
547
+ {
548
+ DecodeStatus ret = MCDisassembler_Success;
549
+ MCOperand *op;
550
+
551
+ if(!Inst->flat_insn->detail)
552
+ return MCDisassembler_Success;
553
+
554
+ switch(Val) {
555
+ case 0:
556
+ Inst->flat_insn->detail->tms320c64x.funit.crosspath = 0;
557
+ break;
558
+ case 1:
559
+ Inst->flat_insn->detail->tms320c64x.funit.crosspath = 2;
560
+ op = &Inst->Operands[2];
561
+ if(op->Kind == kRegister) {
562
+ if((op->RegVal >= TMS320C64X_REG_A0) && (op->RegVal <= TMS320C64X_REG_A31))
563
+ op->RegVal = (op->RegVal - TMS320C64X_REG_A0 + TMS320C64X_REG_B0);
564
+ else if((op->RegVal >= TMS320C64X_REG_B0) && (op->RegVal <= TMS320C64X_REG_B31))
565
+ op->RegVal = (op->RegVal - TMS320C64X_REG_B0 + TMS320C64X_REG_A0);
566
+ }
567
+ break;
568
+ default:
569
+ Inst->flat_insn->detail->tms320c64x.funit.crosspath = -1;
570
+ ret = MCDisassembler_Fail;
571
+ break;
572
+ }
573
+
574
+ return ret;
575
+ }
576
+
577
+
578
+ static DecodeStatus DecodeNop(MCInst *Inst, unsigned Val,
579
+ uint64_t Address, void *Decoder)
580
+ {
581
+ MCOperand_CreateImm0(Inst, Val + 1);
582
+
583
+ return MCDisassembler_Success;
584
+ }
585
+
586
+ #define GET_INSTRINFO_ENUM
587
+ #include "TMS320C64xGenInstrInfo.inc"
588
+
589
+ bool TMS320C64x_getInstruction(csh ud, const uint8_t *code, size_t code_len,
590
+ MCInst *MI, uint16_t *size, uint64_t address, void *info)
591
+ {
592
+ uint32_t insn;
593
+ DecodeStatus result;
594
+
595
+ if(code_len < 4) {
596
+ *size = 0;
597
+ return MCDisassembler_Fail;
598
+ }
599
+
600
+ if(MI->flat_insn->detail)
601
+ memset(MI->flat_insn->detail, 0, offsetof(cs_detail, tms320c64x)+sizeof(cs_tms320c64x));
602
+
603
+ insn = (code[3] << 0) | (code[2] << 8) | (code[1] << 16) | ((uint32_t) code[0] << 24);
604
+ result = decodeInstruction_4(DecoderTable32, MI, insn, address, info, 0);
605
+
606
+ if(result == MCDisassembler_Success) {
607
+ *size = 4;
608
+ return true;
609
+ }
610
+
611
+ MCInst_clear(MI);
612
+ *size = 0;
613
+ return false;
614
+ }
615
+
616
+ void TMS320C64x_init(MCRegisterInfo *MRI)
617
+ {
618
+ MCRegisterInfo_InitMCRegisterInfo(MRI, TMS320C64xRegDesc, 90,
619
+ 0, 0,
620
+ TMS320C64xMCRegisterClasses, 7,
621
+ 0, 0,
622
+ TMS320C64xRegDiffLists,
623
+ 0,
624
+ TMS320C64xSubRegIdxLists, 1,
625
+ 0);
626
+ }
627
+
628
+ #endif
@@ -0,0 +1,19 @@
1
+ /* Capstone Disassembly Engine */
2
+ /* TMS320C64x Backend by Fotis Loukos <me@fotisl.com> 2016 */
3
+
4
+ #ifndef CS_TMS320C64XDISASSEMBLER_H
5
+ #define CS_TMS320C64XDISASSEMBLER_H
6
+
7
+ #include <stdint.h>
8
+
9
+ #include "capstone/capstone.h"
10
+ #include "../../MCRegisterInfo.h"
11
+ #include "../../MCInst.h"
12
+
13
+ void TMS320C64x_init(MCRegisterInfo *MRI);
14
+
15
+ bool TMS320C64x_getInstruction(csh ud, const uint8_t *code, size_t code_len,
16
+ MCInst *instr, uint16_t *size, uint64_t address, void *info);
17
+
18
+ #endif
19
+