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,794 @@
1
+ //===------ XCoreDisassembler.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_XCORE
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 "XCoreDisassembler.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
+ static uint64_t getFeatureBits(int mode)
32
+ {
33
+ // support everything
34
+ return (uint64_t)-1;
35
+ }
36
+
37
+ static bool readInstruction16(const uint8_t *code, size_t code_len, uint16_t *insn)
38
+ {
39
+ if (code_len < 2)
40
+ // insufficient data
41
+ return false;
42
+
43
+ // Encoded as a little-endian 16-bit word in the stream.
44
+ *insn = (code[0] << 0) | (code[1] << 8);
45
+ return true;
46
+ }
47
+
48
+ static bool readInstruction32(const uint8_t *code, size_t code_len, uint32_t *insn)
49
+ {
50
+ if (code_len < 4)
51
+ // insufficient data
52
+ return false;
53
+
54
+ // Encoded as a little-endian 32-bit word in the stream.
55
+ *insn = (code[0] << 0) | (code[1] << 8) | (code[2] << 16) | ((uint32_t) code[3] << 24);
56
+
57
+ return true;
58
+ }
59
+
60
+ static unsigned getReg(const MCRegisterInfo *MRI, unsigned RC, unsigned RegNo)
61
+ {
62
+ const MCRegisterClass *rc = MCRegisterInfo_getRegClass(MRI, RC);
63
+ return rc->RegsBegin[RegNo];
64
+ }
65
+
66
+ static DecodeStatus DecodeGRRegsRegisterClass(MCInst *Inst, unsigned RegNo,
67
+ uint64_t Address, const void *Decoder);
68
+
69
+ static DecodeStatus DecodeRRegsRegisterClass(MCInst *Inst, unsigned RegNo,
70
+ uint64_t Address, const void *Decoder);
71
+
72
+ static DecodeStatus DecodeBitpOperand(MCInst *Inst, unsigned Val,
73
+ uint64_t Address, const void *Decoder);
74
+
75
+ static DecodeStatus DecodeNegImmOperand(MCInst *Inst, unsigned Val,
76
+ uint64_t Address, const void *Decoder);
77
+
78
+ static DecodeStatus Decode2RInstruction(MCInst *Inst, unsigned Insn,
79
+ uint64_t Address, const void *Decoder);
80
+
81
+ static DecodeStatus Decode2RImmInstruction(MCInst *Inst, unsigned Insn,
82
+ uint64_t Address, const void *Decoder);
83
+
84
+ static DecodeStatus DecodeR2RInstruction(MCInst *Inst, unsigned Insn,
85
+ uint64_t Address, const void *Decoder);
86
+
87
+ static DecodeStatus Decode2RSrcDstInstruction(MCInst *Inst, unsigned Insn,
88
+ uint64_t Address, const void *Decoder);
89
+
90
+ static DecodeStatus DecodeRUSInstruction(MCInst *Inst, unsigned Insn,
91
+ uint64_t Address, const void *Decoder);
92
+
93
+ static DecodeStatus DecodeRUSBitpInstruction(MCInst *Inst, unsigned Insn,
94
+ uint64_t Address, const void *Decoder);
95
+
96
+ static DecodeStatus DecodeRUSSrcDstBitpInstruction(MCInst *Inst, unsigned Insn,
97
+ uint64_t Address, const void *Decoder);
98
+
99
+ static DecodeStatus DecodeL2RInstruction(MCInst *Inst, unsigned Insn,
100
+ uint64_t Address, const void *Decoder);
101
+
102
+ static DecodeStatus DecodeLR2RInstruction(MCInst *Inst, unsigned Insn,
103
+ uint64_t Address, const void *Decoder);
104
+
105
+ static DecodeStatus Decode3RInstruction(MCInst *Inst, unsigned Insn,
106
+ uint64_t Address, const void *Decoder);
107
+
108
+ static DecodeStatus Decode3RImmInstruction(MCInst *Inst, unsigned Insn,
109
+ uint64_t Address, const void *Decoder);
110
+
111
+ static DecodeStatus Decode2RUSInstruction(MCInst *Inst, unsigned Insn,
112
+ uint64_t Address, const void *Decoder);
113
+
114
+ static DecodeStatus Decode2RUSBitpInstruction(MCInst *Inst, unsigned Insn,
115
+ uint64_t Address, const void *Decoder);
116
+
117
+ static DecodeStatus DecodeL3RInstruction(MCInst *Inst, unsigned Insn,
118
+ uint64_t Address, const void *Decoder);
119
+
120
+ static DecodeStatus DecodeL3RSrcDstInstruction(MCInst *Inst, unsigned Insn,
121
+ uint64_t Address, const void *Decoder);
122
+
123
+ static DecodeStatus DecodeL2RUSInstruction(MCInst *Inst, unsigned Insn,
124
+ uint64_t Address, const void *Decoder);
125
+
126
+ static DecodeStatus DecodeL2RUSBitpInstruction(MCInst *Inst, unsigned Insn,
127
+ uint64_t Address, const void *Decoder);
128
+
129
+ static DecodeStatus DecodeL6RInstruction(MCInst *Inst, unsigned Insn,
130
+ uint64_t Address, const void *Decoder);
131
+
132
+ static DecodeStatus DecodeL5RInstruction(MCInst *Inst, unsigned Insn,
133
+ uint64_t Address, const void *Decoder);
134
+
135
+ static DecodeStatus DecodeL4RSrcDstInstruction(MCInst *Inst, unsigned Insn,
136
+ uint64_t Address, const void *Decoder);
137
+
138
+ static DecodeStatus DecodeL4RSrcDstSrcDstInstruction(MCInst *Inst, unsigned Insn,
139
+ uint64_t Address, const void *Decoder);
140
+
141
+ #include "XCoreGenDisassemblerTables.inc"
142
+
143
+ #define GET_REGINFO_ENUM
144
+ #define GET_REGINFO_MC_DESC
145
+ #include "XCoreGenRegisterInfo.inc"
146
+
147
+ static DecodeStatus DecodeGRRegsRegisterClass(MCInst *Inst, unsigned RegNo,
148
+ uint64_t Address, const void *Decoder)
149
+ {
150
+ unsigned Reg;
151
+
152
+ if (RegNo > 11)
153
+ return MCDisassembler_Fail;
154
+
155
+ Reg = getReg(Decoder, XCore_GRRegsRegClassID, RegNo);
156
+ MCOperand_CreateReg0(Inst, Reg);
157
+
158
+ return MCDisassembler_Success;
159
+ }
160
+
161
+ static DecodeStatus DecodeRRegsRegisterClass(MCInst *Inst, unsigned RegNo,
162
+ uint64_t Address, const void *Decoder)
163
+ {
164
+ unsigned Reg;
165
+ if (RegNo > 15)
166
+ return MCDisassembler_Fail;
167
+
168
+ Reg = getReg(Decoder, XCore_RRegsRegClassID, RegNo);
169
+ MCOperand_CreateReg0(Inst, Reg);
170
+
171
+ return MCDisassembler_Success;
172
+ }
173
+
174
+ static DecodeStatus DecodeBitpOperand(MCInst *Inst, unsigned Val,
175
+ uint64_t Address, const void *Decoder)
176
+ {
177
+ static const unsigned Values[] = {
178
+ 32 /*bpw*/, 1, 2, 3, 4, 5, 6, 7, 8, 16, 24, 32
179
+ };
180
+
181
+ if (Val > 11)
182
+ return MCDisassembler_Fail;
183
+
184
+ MCOperand_CreateImm0(Inst, Values[Val]);
185
+ return MCDisassembler_Success;
186
+ }
187
+
188
+ static DecodeStatus DecodeNegImmOperand(MCInst *Inst, unsigned Val,
189
+ uint64_t Address, const void *Decoder)
190
+ {
191
+ MCOperand_CreateImm0(Inst, -(int64_t)Val);
192
+ return MCDisassembler_Success;
193
+ }
194
+
195
+ static DecodeStatus Decode2OpInstruction(unsigned Insn, unsigned *Op1, unsigned *Op2)
196
+ {
197
+ unsigned Op1High, Op2High;
198
+ unsigned Combined = fieldFromInstruction_4(Insn, 6, 5);
199
+
200
+ if (Combined < 27)
201
+ return MCDisassembler_Fail;
202
+
203
+ if (fieldFromInstruction_4(Insn, 5, 1)) {
204
+ if (Combined == 31)
205
+ return MCDisassembler_Fail;
206
+ Combined += 5;
207
+ }
208
+
209
+ Combined -= 27;
210
+ Op1High = Combined % 3;
211
+ Op2High = Combined / 3;
212
+ *Op1 = (Op1High << 2) | fieldFromInstruction_4(Insn, 2, 2);
213
+ *Op2 = (Op2High << 2) | fieldFromInstruction_4(Insn, 0, 2);
214
+
215
+ return MCDisassembler_Success;
216
+ }
217
+
218
+ static DecodeStatus Decode3OpInstruction(unsigned Insn,
219
+ unsigned *Op1, unsigned *Op2, unsigned *Op3)
220
+ {
221
+ unsigned Op1High, Op2High, Op3High;
222
+ unsigned Combined = fieldFromInstruction_4(Insn, 6, 5);
223
+ if (Combined >= 27)
224
+ return MCDisassembler_Fail;
225
+
226
+ Op1High = Combined % 3;
227
+ Op2High = (Combined / 3) % 3;
228
+ Op3High = Combined / 9;
229
+ *Op1 = (Op1High << 2) | fieldFromInstruction_4(Insn, 4, 2);
230
+ *Op2 = (Op2High << 2) | fieldFromInstruction_4(Insn, 2, 2);
231
+ *Op3 = (Op3High << 2) | fieldFromInstruction_4(Insn, 0, 2);
232
+
233
+ return MCDisassembler_Success;
234
+ }
235
+
236
+ #define GET_INSTRINFO_ENUM
237
+ #include "XCoreGenInstrInfo.inc"
238
+ static DecodeStatus Decode2OpInstructionFail(MCInst *Inst, unsigned Insn, uint64_t Address,
239
+ const void *Decoder)
240
+ {
241
+ // Try and decode as a 3R instruction.
242
+ unsigned Opcode = fieldFromInstruction_4(Insn, 11, 5);
243
+ switch (Opcode) {
244
+ case 0x0:
245
+ MCInst_setOpcode(Inst, XCore_STW_2rus);
246
+ return Decode2RUSInstruction(Inst, Insn, Address, Decoder);
247
+ case 0x1:
248
+ MCInst_setOpcode(Inst, XCore_LDW_2rus);
249
+ return Decode2RUSInstruction(Inst, Insn, Address, Decoder);
250
+ case 0x2:
251
+ MCInst_setOpcode(Inst, XCore_ADD_3r);
252
+ return Decode3RInstruction(Inst, Insn, Address, Decoder);
253
+ case 0x3:
254
+ MCInst_setOpcode(Inst, XCore_SUB_3r);
255
+ return Decode3RInstruction(Inst, Insn, Address, Decoder);
256
+ case 0x4:
257
+ MCInst_setOpcode(Inst, XCore_SHL_3r);
258
+ return Decode3RInstruction(Inst, Insn, Address, Decoder);
259
+ case 0x5:
260
+ MCInst_setOpcode(Inst, XCore_SHR_3r);
261
+ return Decode3RInstruction(Inst, Insn, Address, Decoder);
262
+ case 0x6:
263
+ MCInst_setOpcode(Inst, XCore_EQ_3r);
264
+ return Decode3RInstruction(Inst, Insn, Address, Decoder);
265
+ case 0x7:
266
+ MCInst_setOpcode(Inst, XCore_AND_3r);
267
+ return Decode3RInstruction(Inst, Insn, Address, Decoder);
268
+ case 0x8:
269
+ MCInst_setOpcode(Inst, XCore_OR_3r);
270
+ return Decode3RInstruction(Inst, Insn, Address, Decoder);
271
+ case 0x9:
272
+ MCInst_setOpcode(Inst, XCore_LDW_3r);
273
+ return Decode3RInstruction(Inst, Insn, Address, Decoder);
274
+ case 0x10:
275
+ MCInst_setOpcode(Inst, XCore_LD16S_3r);
276
+ return Decode3RInstruction(Inst, Insn, Address, Decoder);
277
+ case 0x11:
278
+ MCInst_setOpcode(Inst, XCore_LD8U_3r);
279
+ return Decode3RInstruction(Inst, Insn, Address, Decoder);
280
+ case 0x12:
281
+ MCInst_setOpcode(Inst, XCore_ADD_2rus);
282
+ return Decode2RUSInstruction(Inst, Insn, Address, Decoder);
283
+ case 0x13:
284
+ MCInst_setOpcode(Inst, XCore_SUB_2rus);
285
+ return Decode2RUSInstruction(Inst, Insn, Address, Decoder);
286
+ case 0x14:
287
+ MCInst_setOpcode(Inst, XCore_SHL_2rus);
288
+ return Decode2RUSBitpInstruction(Inst, Insn, Address, Decoder);
289
+ case 0x15:
290
+ MCInst_setOpcode(Inst, XCore_SHR_2rus);
291
+ return Decode2RUSBitpInstruction(Inst, Insn, Address, Decoder);
292
+ case 0x16:
293
+ MCInst_setOpcode(Inst, XCore_EQ_2rus);
294
+ return Decode2RUSInstruction(Inst, Insn, Address, Decoder);
295
+ case 0x17:
296
+ MCInst_setOpcode(Inst, XCore_TSETR_3r);
297
+ return Decode3RImmInstruction(Inst, Insn, Address, Decoder);
298
+ case 0x18:
299
+ MCInst_setOpcode(Inst, XCore_LSS_3r);
300
+ return Decode3RInstruction(Inst, Insn, Address, Decoder);
301
+ case 0x19:
302
+ MCInst_setOpcode(Inst, XCore_LSU_3r);
303
+ return Decode3RInstruction(Inst, Insn, Address, Decoder);
304
+ }
305
+
306
+ return MCDisassembler_Fail;
307
+ }
308
+
309
+ static DecodeStatus Decode2RInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
310
+ const void *Decoder)
311
+ {
312
+ unsigned Op1, Op2;
313
+ DecodeStatus S = Decode2OpInstruction(Insn, &Op1, &Op2);
314
+ if (S != MCDisassembler_Success)
315
+ return Decode2OpInstructionFail(Inst, Insn, Address, Decoder);
316
+
317
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
318
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
319
+
320
+ return S;
321
+ }
322
+
323
+ static DecodeStatus Decode2RImmInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
324
+ const void *Decoder)
325
+ {
326
+ unsigned Op1, Op2;
327
+ DecodeStatus S = Decode2OpInstruction(Insn, &Op1, &Op2);
328
+ if (S != MCDisassembler_Success)
329
+ return Decode2OpInstructionFail(Inst, Insn, Address, Decoder);
330
+
331
+ MCOperand_CreateImm0(Inst, Op1);
332
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
333
+
334
+ return S;
335
+ }
336
+
337
+ static DecodeStatus DecodeR2RInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
338
+ const void *Decoder)
339
+ {
340
+ unsigned Op1, Op2;
341
+ DecodeStatus S = Decode2OpInstruction(Insn, &Op2, &Op1);
342
+ if (S != MCDisassembler_Success)
343
+ return Decode2OpInstructionFail(Inst, Insn, Address, Decoder);
344
+
345
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
346
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
347
+
348
+ return S;
349
+ }
350
+
351
+ static DecodeStatus Decode2RSrcDstInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
352
+ const void *Decoder)
353
+ {
354
+ unsigned Op1, Op2;
355
+ DecodeStatus S = Decode2OpInstruction(Insn, &Op1, &Op2);
356
+ if (S != MCDisassembler_Success)
357
+ return Decode2OpInstructionFail(Inst, Insn, Address, Decoder);
358
+
359
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
360
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
361
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
362
+
363
+ return S;
364
+ }
365
+
366
+ static DecodeStatus DecodeRUSInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
367
+ const void *Decoder)
368
+ {
369
+ unsigned Op1, Op2;
370
+ DecodeStatus S = Decode2OpInstruction(Insn, &Op1, &Op2);
371
+ if (S != MCDisassembler_Success)
372
+ return Decode2OpInstructionFail(Inst, Insn, Address, Decoder);
373
+
374
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
375
+ MCOperand_CreateImm0(Inst, Op2);
376
+
377
+ return S;
378
+ }
379
+
380
+ static DecodeStatus DecodeRUSBitpInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
381
+ const void *Decoder)
382
+ {
383
+ unsigned Op1, Op2;
384
+ DecodeStatus S = Decode2OpInstruction(Insn, &Op1, &Op2);
385
+ if (S != MCDisassembler_Success)
386
+ return Decode2OpInstructionFail(Inst, Insn, Address, Decoder);
387
+
388
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
389
+ DecodeBitpOperand(Inst, Op2, Address, Decoder);
390
+
391
+ return S;
392
+ }
393
+
394
+ static DecodeStatus DecodeRUSSrcDstBitpInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
395
+ const void *Decoder)
396
+ {
397
+ unsigned Op1, Op2;
398
+ DecodeStatus S = Decode2OpInstruction(Insn, &Op1, &Op2);
399
+ if (S != MCDisassembler_Success)
400
+ return Decode2OpInstructionFail(Inst, Insn, Address, Decoder);
401
+
402
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
403
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
404
+ DecodeBitpOperand(Inst, Op2, Address, Decoder);
405
+
406
+ return S;
407
+ }
408
+
409
+ static DecodeStatus DecodeL2OpInstructionFail(MCInst *Inst, unsigned Insn, uint64_t Address,
410
+ const void *Decoder)
411
+ {
412
+ // Try and decode as a L3R / L2RUS instruction.
413
+ unsigned Opcode = fieldFromInstruction_4(Insn, 16, 4) |
414
+ fieldFromInstruction_4(Insn, 27, 5) << 4;
415
+ switch (Opcode) {
416
+ case 0x0c:
417
+ MCInst_setOpcode(Inst, XCore_STW_l3r);
418
+ return DecodeL3RInstruction(Inst, Insn, Address, Decoder);
419
+ case 0x1c:
420
+ MCInst_setOpcode(Inst, XCore_XOR_l3r);
421
+ return DecodeL3RInstruction(Inst, Insn, Address, Decoder);
422
+ case 0x2c:
423
+ MCInst_setOpcode(Inst, XCore_ASHR_l3r);
424
+ return DecodeL3RInstruction(Inst, Insn, Address, Decoder);
425
+ case 0x3c:
426
+ MCInst_setOpcode(Inst, XCore_LDAWF_l3r);
427
+ return DecodeL3RInstruction(Inst, Insn, Address, Decoder);
428
+ case 0x4c:
429
+ MCInst_setOpcode(Inst, XCore_LDAWB_l3r);
430
+ return DecodeL3RInstruction(Inst, Insn, Address, Decoder);
431
+ case 0x5c:
432
+ MCInst_setOpcode(Inst, XCore_LDA16F_l3r);
433
+ return DecodeL3RInstruction(Inst, Insn, Address, Decoder);
434
+ case 0x6c:
435
+ MCInst_setOpcode(Inst, XCore_LDA16B_l3r);
436
+ return DecodeL3RInstruction(Inst, Insn, Address, Decoder);
437
+ case 0x7c:
438
+ MCInst_setOpcode(Inst, XCore_MUL_l3r);
439
+ return DecodeL3RInstruction(Inst, Insn, Address, Decoder);
440
+ case 0x8c:
441
+ MCInst_setOpcode(Inst, XCore_DIVS_l3r);
442
+ return DecodeL3RInstruction(Inst, Insn, Address, Decoder);
443
+ case 0x9c:
444
+ MCInst_setOpcode(Inst, XCore_DIVU_l3r);
445
+ return DecodeL3RInstruction(Inst, Insn, Address, Decoder);
446
+ case 0x10c:
447
+ MCInst_setOpcode(Inst, XCore_ST16_l3r);
448
+ return DecodeL3RInstruction(Inst, Insn, Address, Decoder);
449
+ case 0x11c:
450
+ MCInst_setOpcode(Inst, XCore_ST8_l3r);
451
+ return DecodeL3RInstruction(Inst, Insn, Address, Decoder);
452
+ case 0x12c:
453
+ MCInst_setOpcode(Inst, XCore_ASHR_l2rus);
454
+ return DecodeL2RUSBitpInstruction(Inst, Insn, Address, Decoder);
455
+ case 0x12d:
456
+ MCInst_setOpcode(Inst, XCore_OUTPW_l2rus);
457
+ return DecodeL2RUSBitpInstruction(Inst, Insn, Address, Decoder);
458
+ case 0x12e:
459
+ MCInst_setOpcode(Inst, XCore_INPW_l2rus);
460
+ return DecodeL2RUSBitpInstruction(Inst, Insn, Address, Decoder);
461
+ case 0x13c:
462
+ MCInst_setOpcode(Inst, XCore_LDAWF_l2rus);
463
+ return DecodeL2RUSInstruction(Inst, Insn, Address, Decoder);
464
+ case 0x14c:
465
+ MCInst_setOpcode(Inst, XCore_LDAWB_l2rus);
466
+ return DecodeL2RUSInstruction(Inst, Insn, Address, Decoder);
467
+ case 0x15c:
468
+ MCInst_setOpcode(Inst, XCore_CRC_l3r);
469
+ return DecodeL3RSrcDstInstruction(Inst, Insn, Address, Decoder);
470
+ case 0x18c:
471
+ MCInst_setOpcode(Inst, XCore_REMS_l3r);
472
+ return DecodeL3RInstruction(Inst, Insn, Address, Decoder);
473
+ case 0x19c:
474
+ MCInst_setOpcode(Inst, XCore_REMU_l3r);
475
+ return DecodeL3RInstruction(Inst, Insn, Address, Decoder);
476
+ }
477
+
478
+ return MCDisassembler_Fail;
479
+ }
480
+
481
+ static DecodeStatus DecodeL2RInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
482
+ const void *Decoder)
483
+ {
484
+ unsigned Op1, Op2;
485
+ DecodeStatus S = Decode2OpInstruction(fieldFromInstruction_4(Insn, 0, 16), &Op1, &Op2);
486
+ if (S != MCDisassembler_Success)
487
+ return DecodeL2OpInstructionFail(Inst, Insn, Address, Decoder);
488
+
489
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
490
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
491
+
492
+ return S;
493
+ }
494
+
495
+ static DecodeStatus DecodeLR2RInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
496
+ const void *Decoder)
497
+ {
498
+ unsigned Op1, Op2;
499
+ DecodeStatus S = Decode2OpInstruction(fieldFromInstruction_4(Insn, 0, 16), &Op1, &Op2);
500
+ if (S != MCDisassembler_Success)
501
+ return DecodeL2OpInstructionFail(Inst, Insn, Address, Decoder);
502
+
503
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
504
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
505
+
506
+ return S;
507
+ }
508
+
509
+ static DecodeStatus Decode3RInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
510
+ const void *Decoder)
511
+ {
512
+ unsigned Op1, Op2, Op3;
513
+ DecodeStatus S = Decode3OpInstruction(Insn, &Op1, &Op2, &Op3);
514
+ if (S == MCDisassembler_Success) {
515
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
516
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
517
+ DecodeGRRegsRegisterClass(Inst, Op3, Address, Decoder);
518
+ }
519
+
520
+ return S;
521
+ }
522
+
523
+ static DecodeStatus Decode3RImmInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
524
+ const void *Decoder)
525
+ {
526
+ unsigned Op1, Op2, Op3;
527
+ DecodeStatus S = Decode3OpInstruction(Insn, &Op1, &Op2, &Op3);
528
+ if (S == MCDisassembler_Success) {
529
+ MCOperand_CreateImm0(Inst, Op1);
530
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
531
+ DecodeGRRegsRegisterClass(Inst, Op3, Address, Decoder);
532
+ }
533
+
534
+ return S;
535
+ }
536
+
537
+ static DecodeStatus Decode2RUSInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
538
+ const void *Decoder)
539
+ {
540
+ unsigned Op1, Op2, Op3;
541
+ DecodeStatus S = Decode3OpInstruction(Insn, &Op1, &Op2, &Op3);
542
+ if (S == MCDisassembler_Success) {
543
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
544
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
545
+ MCOperand_CreateImm0(Inst, Op3);
546
+ }
547
+
548
+ return S;
549
+ }
550
+
551
+ static DecodeStatus Decode2RUSBitpInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
552
+ const void *Decoder)
553
+ {
554
+ unsigned Op1, Op2, Op3;
555
+ DecodeStatus S = Decode3OpInstruction(Insn, &Op1, &Op2, &Op3);
556
+ if (S == MCDisassembler_Success) {
557
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
558
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
559
+ DecodeBitpOperand(Inst, Op3, Address, Decoder);
560
+ }
561
+
562
+ return S;
563
+ }
564
+
565
+ static DecodeStatus DecodeL3RInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
566
+ const void *Decoder)
567
+ {
568
+ unsigned Op1, Op2, Op3;
569
+ DecodeStatus S =
570
+ Decode3OpInstruction(fieldFromInstruction_4(Insn, 0, 16), &Op1, &Op2, &Op3);
571
+ if (S == MCDisassembler_Success) {
572
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
573
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
574
+ DecodeGRRegsRegisterClass(Inst, Op3, Address, Decoder);
575
+ }
576
+
577
+ return S;
578
+ }
579
+
580
+ static DecodeStatus DecodeL3RSrcDstInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
581
+ const void *Decoder)
582
+ {
583
+ unsigned Op1, Op2, Op3;
584
+ DecodeStatus S =
585
+ Decode3OpInstruction(fieldFromInstruction_4(Insn, 0, 16), &Op1, &Op2, &Op3);
586
+ if (S == MCDisassembler_Success) {
587
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
588
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
589
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
590
+ DecodeGRRegsRegisterClass(Inst, Op3, Address, Decoder);
591
+ }
592
+
593
+ return S;
594
+ }
595
+
596
+ static DecodeStatus DecodeL2RUSInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
597
+ const void *Decoder)
598
+ {
599
+ unsigned Op1, Op2, Op3;
600
+ DecodeStatus S =
601
+ Decode3OpInstruction(fieldFromInstruction_4(Insn, 0, 16), &Op1, &Op2, &Op3);
602
+ if (S == MCDisassembler_Success) {
603
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
604
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
605
+ MCOperand_CreateImm0(Inst, Op3);
606
+ }
607
+
608
+ return S;
609
+ }
610
+
611
+ static DecodeStatus DecodeL2RUSBitpInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
612
+ const void *Decoder)
613
+ {
614
+ unsigned Op1, Op2, Op3;
615
+ DecodeStatus S =
616
+ Decode3OpInstruction(fieldFromInstruction_4(Insn, 0, 16), &Op1, &Op2, &Op3);
617
+ if (S == MCDisassembler_Success) {
618
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
619
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
620
+ DecodeBitpOperand(Inst, Op3, Address, Decoder);
621
+ }
622
+
623
+ return S;
624
+ }
625
+
626
+ static DecodeStatus DecodeL6RInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
627
+ const void *Decoder)
628
+ {
629
+ unsigned Op1, Op2, Op3, Op4, Op5, Op6;
630
+ DecodeStatus S =
631
+ Decode3OpInstruction(fieldFromInstruction_4(Insn, 0, 16), &Op1, &Op2, &Op3);
632
+ if (S != MCDisassembler_Success)
633
+ return S;
634
+
635
+ S = Decode3OpInstruction(fieldFromInstruction_4(Insn, 16, 16), &Op4, &Op5, &Op6);
636
+ if (S != MCDisassembler_Success)
637
+ return S;
638
+
639
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
640
+ DecodeGRRegsRegisterClass(Inst, Op4, Address, Decoder);
641
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
642
+ DecodeGRRegsRegisterClass(Inst, Op3, Address, Decoder);
643
+ DecodeGRRegsRegisterClass(Inst, Op5, Address, Decoder);
644
+ DecodeGRRegsRegisterClass(Inst, Op6, Address, Decoder);
645
+ return S;
646
+ }
647
+
648
+ static DecodeStatus DecodeL5RInstructionFail(MCInst *Inst, unsigned Insn, uint64_t Address,
649
+ const void *Decoder)
650
+ {
651
+ unsigned Opcode;
652
+
653
+ // Try and decode as a L6R instruction.
654
+ MCInst_clear(Inst);
655
+ Opcode = fieldFromInstruction_4(Insn, 27, 5);
656
+ switch (Opcode) {
657
+ default:
658
+ break;
659
+ case 0x00:
660
+ MCInst_setOpcode(Inst, XCore_LMUL_l6r);
661
+ return DecodeL6RInstruction(Inst, Insn, Address, Decoder);
662
+ }
663
+
664
+ return MCDisassembler_Fail;
665
+ }
666
+
667
+ static DecodeStatus DecodeL5RInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
668
+ const void *Decoder)
669
+ {
670
+ unsigned Op1, Op2, Op3, Op4, Op5;
671
+ DecodeStatus S =
672
+ Decode3OpInstruction(fieldFromInstruction_4(Insn, 0, 16), &Op1, &Op2, &Op3);
673
+ if (S != MCDisassembler_Success)
674
+ return DecodeL5RInstructionFail(Inst, Insn, Address, Decoder);
675
+
676
+ S = Decode2OpInstruction(fieldFromInstruction_4(Insn, 16, 16), &Op4, &Op5);
677
+ if (S != MCDisassembler_Success)
678
+ return DecodeL5RInstructionFail(Inst, Insn, Address, Decoder);
679
+
680
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
681
+ DecodeGRRegsRegisterClass(Inst, Op4, Address, Decoder);
682
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
683
+ DecodeGRRegsRegisterClass(Inst, Op3, Address, Decoder);
684
+ DecodeGRRegsRegisterClass(Inst, Op5, Address, Decoder);
685
+ return S;
686
+ }
687
+
688
+ static DecodeStatus DecodeL4RSrcDstInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
689
+ const void *Decoder)
690
+ {
691
+ unsigned Op1, Op2, Op3;
692
+ unsigned Op4 = fieldFromInstruction_4(Insn, 16, 4);
693
+ DecodeStatus S =
694
+ Decode3OpInstruction(fieldFromInstruction_4(Insn, 0, 16), &Op1, &Op2, &Op3);
695
+ if (S == MCDisassembler_Success) {
696
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
697
+ S = DecodeGRRegsRegisterClass(Inst, Op4, Address, Decoder);
698
+ }
699
+
700
+ if (S == MCDisassembler_Success) {
701
+ DecodeGRRegsRegisterClass(Inst, Op4, Address, Decoder);
702
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
703
+ DecodeGRRegsRegisterClass(Inst, Op3, Address, Decoder);
704
+ }
705
+ return S;
706
+ }
707
+
708
+ static DecodeStatus DecodeL4RSrcDstSrcDstInstruction(MCInst *Inst, unsigned Insn, uint64_t Address,
709
+ const void *Decoder)
710
+ {
711
+ unsigned Op1, Op2, Op3;
712
+ unsigned Op4 = fieldFromInstruction_4(Insn, 16, 4);
713
+ DecodeStatus S =
714
+ Decode3OpInstruction(fieldFromInstruction_4(Insn, 0, 16), &Op1, &Op2, &Op3);
715
+ if (S == MCDisassembler_Success) {
716
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
717
+ S = DecodeGRRegsRegisterClass(Inst, Op4, Address, Decoder);
718
+ }
719
+
720
+ if (S == MCDisassembler_Success) {
721
+ DecodeGRRegsRegisterClass(Inst, Op1, Address, Decoder);
722
+ DecodeGRRegsRegisterClass(Inst, Op4, Address, Decoder);
723
+ DecodeGRRegsRegisterClass(Inst, Op2, Address, Decoder);
724
+ DecodeGRRegsRegisterClass(Inst, Op3, Address, Decoder);
725
+ }
726
+
727
+ return S;
728
+ }
729
+
730
+ #define GET_SUBTARGETINFO_ENUM
731
+ #include "XCoreGenInstrInfo.inc"
732
+ bool XCore_getInstruction(csh ud, const uint8_t *code, size_t code_len, MCInst *MI,
733
+ uint16_t *size, uint64_t address, void *info)
734
+ {
735
+ uint16_t insn16;
736
+ uint32_t insn32;
737
+ DecodeStatus Result;
738
+
739
+ if (!readInstruction16(code, code_len, &insn16)) {
740
+ return false;
741
+ }
742
+
743
+ if (MI->flat_insn->detail) {
744
+ memset(MI->flat_insn->detail, 0, offsetof(cs_detail, xcore)+sizeof(cs_xcore));
745
+ }
746
+
747
+ // Calling the auto-generated decoder function.
748
+ Result = decodeInstruction_2(DecoderTable16, MI, insn16, address, info, 0);
749
+ if (Result != MCDisassembler_Fail) {
750
+ *size = 2;
751
+ return true;
752
+ }
753
+
754
+ if (!readInstruction32(code, code_len, &insn32)) {
755
+ return false;
756
+ }
757
+
758
+ // Calling the auto-generated decoder function.
759
+ Result = decodeInstruction_4(DecoderTable32, MI, insn32, address, info, 0);
760
+ if (Result != MCDisassembler_Fail) {
761
+ *size = 4;
762
+ return true;
763
+ }
764
+
765
+ return false;
766
+ }
767
+
768
+ void XCore_init(MCRegisterInfo *MRI)
769
+ {
770
+ /*
771
+ InitMCRegisterInfo(XCoreRegDesc, 17, RA, PC,
772
+ XCoreMCRegisterClasses, 2,
773
+ XCoreRegUnitRoots,
774
+ 16,
775
+ XCoreRegDiffLists,
776
+ XCoreRegStrings,
777
+ XCoreSubRegIdxLists,
778
+ 1,
779
+ XCoreSubRegIdxRanges,
780
+ XCoreRegEncodingTable);
781
+ */
782
+
783
+
784
+ MCRegisterInfo_InitMCRegisterInfo(MRI, XCoreRegDesc, 17,
785
+ 0, 0,
786
+ XCoreMCRegisterClasses, 2,
787
+ 0, 0,
788
+ XCoreRegDiffLists,
789
+ 0,
790
+ XCoreSubRegIdxLists, 1,
791
+ 0);
792
+ }
793
+
794
+ #endif