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,15 @@
1
+ /* Capstone Disassembly Engine */
2
+ /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */
3
+
4
+ #ifndef CS_PPCINSTPRINTER_H
5
+ #define CS_PPCINSTPRINTER_H
6
+
7
+ #include "../../MCInst.h"
8
+ #include "../../MCRegisterInfo.h"
9
+ #include "../../SStream.h"
10
+
11
+ void PPC_printInst(MCInst *MI, SStream *O, void *Info);
12
+
13
+ void PPC_post_printer(csh ud, cs_insn *insn, char *insn_asm, MCInst *mci);
14
+
15
+ #endif
@@ -0,0 +1,570 @@
1
+ /* Capstone Disassembly Engine */
2
+ /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */
3
+
4
+ #ifdef CAPSTONE_HAS_POWERPC
5
+
6
+ #include <stdio.h> // debug
7
+ #include <string.h>
8
+
9
+ #include "../../utils.h"
10
+
11
+ #include "PPCMapping.h"
12
+
13
+ #define GET_INSTRINFO_ENUM
14
+ #include "PPCGenInstrInfo.inc"
15
+
16
+ // NOTE: this reg_name_maps[] reflects the order of registers in ppc_reg
17
+ static const name_map reg_name_maps[] = {
18
+ { PPC_REG_INVALID, NULL },
19
+
20
+ { PPC_REG_CARRY, "ca" },
21
+ { PPC_REG_CTR, "ctr" },
22
+ { PPC_REG_LR, "lr" },
23
+ { PPC_REG_RM, "rm" },
24
+ { PPC_REG_VRSAVE, "vrsave" },
25
+ { PPC_REG_XER, "xer" },
26
+ { PPC_REG_ZERO, "zero" },
27
+ { PPC_REG_CR0, "cr0" },
28
+ { PPC_REG_CR1, "cr1" },
29
+ { PPC_REG_CR2, "cr2" },
30
+ { PPC_REG_CR3, "cr3" },
31
+ { PPC_REG_CR4, "cr4" },
32
+ { PPC_REG_CR5, "cr5" },
33
+ { PPC_REG_CR6, "cr6" },
34
+ { PPC_REG_CR7, "cr7" },
35
+ { PPC_REG_CTR8, "ctr8" },
36
+ { PPC_REG_F0, "f0" },
37
+ { PPC_REG_F1, "f1" },
38
+ { PPC_REG_F2, "f2" },
39
+ { PPC_REG_F3, "f3" },
40
+ { PPC_REG_F4, "f4" },
41
+ { PPC_REG_F5, "f5" },
42
+ { PPC_REG_F6, "f6" },
43
+ { PPC_REG_F7, "f7" },
44
+ { PPC_REG_F8, "f8" },
45
+ { PPC_REG_F9, "f9" },
46
+ { PPC_REG_F10, "f10" },
47
+ { PPC_REG_F11, "f11" },
48
+ { PPC_REG_F12, "f12" },
49
+ { PPC_REG_F13, "f13" },
50
+ { PPC_REG_F14, "f14" },
51
+ { PPC_REG_F15, "f15" },
52
+ { PPC_REG_F16, "f16" },
53
+ { PPC_REG_F17, "f17" },
54
+ { PPC_REG_F18, "f18" },
55
+ { PPC_REG_F19, "f19" },
56
+ { PPC_REG_F20, "f20" },
57
+ { PPC_REG_F21, "f21" },
58
+ { PPC_REG_F22, "f22" },
59
+ { PPC_REG_F23, "f23" },
60
+ { PPC_REG_F24, "f24" },
61
+ { PPC_REG_F25, "f25" },
62
+ { PPC_REG_F26, "f26" },
63
+ { PPC_REG_F27, "f27" },
64
+ { PPC_REG_F28, "f28" },
65
+ { PPC_REG_F29, "f29" },
66
+ { PPC_REG_F30, "f30" },
67
+ { PPC_REG_F31, "f31" },
68
+ { PPC_REG_LR8, "lr8" },
69
+
70
+ { PPC_REG_Q0, "q0" },
71
+ { PPC_REG_Q1, "q1" },
72
+ { PPC_REG_Q2, "q2" },
73
+ { PPC_REG_Q3, "q3" },
74
+ { PPC_REG_Q4, "q4" },
75
+ { PPC_REG_Q5, "q5" },
76
+ { PPC_REG_Q6, "q6" },
77
+ { PPC_REG_Q7, "q7" },
78
+ { PPC_REG_Q8, "q8" },
79
+ { PPC_REG_Q9, "q9" },
80
+ { PPC_REG_Q10, "q10" },
81
+ { PPC_REG_Q11, "q11" },
82
+ { PPC_REG_Q12, "q12" },
83
+ { PPC_REG_Q13, "q13" },
84
+ { PPC_REG_Q14, "q14" },
85
+ { PPC_REG_Q15, "q15" },
86
+ { PPC_REG_Q16, "q16" },
87
+ { PPC_REG_Q17, "q17" },
88
+ { PPC_REG_Q18, "q18" },
89
+ { PPC_REG_Q19, "q19" },
90
+ { PPC_REG_Q20, "q20" },
91
+ { PPC_REG_Q21, "q21" },
92
+ { PPC_REG_Q22, "q22" },
93
+ { PPC_REG_Q23, "q23" },
94
+ { PPC_REG_Q24, "q24" },
95
+ { PPC_REG_Q25, "q25" },
96
+ { PPC_REG_Q26, "q26" },
97
+ { PPC_REG_Q27, "q27" },
98
+ { PPC_REG_Q28, "q28" },
99
+ { PPC_REG_Q29, "q29" },
100
+ { PPC_REG_Q30, "q30" },
101
+ { PPC_REG_Q31, "q31" },
102
+ { PPC_REG_R0, "r0" },
103
+ { PPC_REG_R1, "r1" },
104
+ { PPC_REG_R2, "r2" },
105
+ { PPC_REG_R3, "r3" },
106
+ { PPC_REG_R4, "r4" },
107
+ { PPC_REG_R5, "r5" },
108
+ { PPC_REG_R6, "r6" },
109
+ { PPC_REG_R7, "r7" },
110
+ { PPC_REG_R8, "r8" },
111
+ { PPC_REG_R9, "r9" },
112
+ { PPC_REG_R10, "r10" },
113
+ { PPC_REG_R11, "r11" },
114
+ { PPC_REG_R12, "r12" },
115
+ { PPC_REG_R13, "r13" },
116
+ { PPC_REG_R14, "r14" },
117
+ { PPC_REG_R15, "r15" },
118
+ { PPC_REG_R16, "r16" },
119
+ { PPC_REG_R17, "r17" },
120
+ { PPC_REG_R18, "r18" },
121
+ { PPC_REG_R19, "r19" },
122
+ { PPC_REG_R20, "r20" },
123
+ { PPC_REG_R21, "r21" },
124
+ { PPC_REG_R22, "r22" },
125
+ { PPC_REG_R23, "r23" },
126
+ { PPC_REG_R24, "r24" },
127
+ { PPC_REG_R25, "r25" },
128
+ { PPC_REG_R26, "r26" },
129
+ { PPC_REG_R27, "r27" },
130
+ { PPC_REG_R28, "r28" },
131
+ { PPC_REG_R29, "r29" },
132
+ { PPC_REG_R30, "r30" },
133
+ { PPC_REG_R31, "r31" },
134
+ { PPC_REG_V0, "v0" },
135
+ { PPC_REG_V1, "v1" },
136
+ { PPC_REG_V2, "v2" },
137
+ { PPC_REG_V3, "v3" },
138
+ { PPC_REG_V4, "v4" },
139
+ { PPC_REG_V5, "v5" },
140
+ { PPC_REG_V6, "v6" },
141
+ { PPC_REG_V7, "v7" },
142
+ { PPC_REG_V8, "v8" },
143
+ { PPC_REG_V9, "v9" },
144
+ { PPC_REG_V10, "v10" },
145
+ { PPC_REG_V11, "v11" },
146
+ { PPC_REG_V12, "v12" },
147
+ { PPC_REG_V13, "v13" },
148
+ { PPC_REG_V14, "v14" },
149
+ { PPC_REG_V15, "v15" },
150
+ { PPC_REG_V16, "v16" },
151
+ { PPC_REG_V17, "v17" },
152
+ { PPC_REG_V18, "v18" },
153
+ { PPC_REG_V19, "v19" },
154
+ { PPC_REG_V20, "v20" },
155
+ { PPC_REG_V21, "v21" },
156
+ { PPC_REG_V22, "v22" },
157
+ { PPC_REG_V23, "v23" },
158
+ { PPC_REG_V24, "v24" },
159
+ { PPC_REG_V25, "v25" },
160
+ { PPC_REG_V26, "v26" },
161
+ { PPC_REG_V27, "v27" },
162
+ { PPC_REG_V28, "v28" },
163
+ { PPC_REG_V29, "v29" },
164
+ { PPC_REG_V30, "v30" },
165
+ { PPC_REG_V31, "v31" },
166
+ { PPC_REG_VS0, "vs0" },
167
+ { PPC_REG_VS1, "vs1" },
168
+ { PPC_REG_VS2, "vs2" },
169
+ { PPC_REG_VS3, "vs3" },
170
+ { PPC_REG_VS4, "vs4" },
171
+ { PPC_REG_VS5, "vs5" },
172
+ { PPC_REG_VS6, "vs6" },
173
+ { PPC_REG_VS7, "vs7" },
174
+ { PPC_REG_VS8, "vs8" },
175
+ { PPC_REG_VS9, "vs9" },
176
+ { PPC_REG_VS10, "vs10" },
177
+ { PPC_REG_VS11, "vs11" },
178
+ { PPC_REG_VS12, "vs12" },
179
+ { PPC_REG_VS13, "vs13" },
180
+ { PPC_REG_VS14, "vs14" },
181
+ { PPC_REG_VS15, "vs15" },
182
+ { PPC_REG_VS16, "vs16" },
183
+ { PPC_REG_VS17, "vs17" },
184
+ { PPC_REG_VS18, "vs18" },
185
+ { PPC_REG_VS19, "vs19" },
186
+ { PPC_REG_VS20, "vs20" },
187
+ { PPC_REG_VS21, "vs21" },
188
+ { PPC_REG_VS22, "vs22" },
189
+ { PPC_REG_VS23, "vs23" },
190
+ { PPC_REG_VS24, "vs24" },
191
+ { PPC_REG_VS25, "vs25" },
192
+ { PPC_REG_VS26, "vs26" },
193
+ { PPC_REG_VS27, "vs27" },
194
+ { PPC_REG_VS28, "vs28" },
195
+ { PPC_REG_VS29, "vs29" },
196
+ { PPC_REG_VS30, "vs30" },
197
+ { PPC_REG_VS31, "vs31" },
198
+
199
+ { PPC_REG_VS32, "vs32" },
200
+ { PPC_REG_VS33, "vs33" },
201
+ { PPC_REG_VS34, "vs34" },
202
+ { PPC_REG_VS35, "vs35" },
203
+ { PPC_REG_VS36, "vs36" },
204
+ { PPC_REG_VS37, "vs37" },
205
+ { PPC_REG_VS38, "vs38" },
206
+ { PPC_REG_VS39, "vs39" },
207
+ { PPC_REG_VS40, "vs40" },
208
+ { PPC_REG_VS41, "vs41" },
209
+ { PPC_REG_VS42, "vs42" },
210
+ { PPC_REG_VS43, "vs43" },
211
+ { PPC_REG_VS44, "vs44" },
212
+ { PPC_REG_VS45, "vs45" },
213
+ { PPC_REG_VS46, "vs46" },
214
+ { PPC_REG_VS47, "vs47" },
215
+ { PPC_REG_VS48, "vs48" },
216
+ { PPC_REG_VS49, "vs49" },
217
+ { PPC_REG_VS50, "vs50" },
218
+ { PPC_REG_VS51, "vs51" },
219
+ { PPC_REG_VS52, "vs52" },
220
+ { PPC_REG_VS53, "vs53" },
221
+ { PPC_REG_VS54, "vs54" },
222
+ { PPC_REG_VS55, "vs55" },
223
+ { PPC_REG_VS56, "vs56" },
224
+ { PPC_REG_VS57, "vs57" },
225
+ { PPC_REG_VS58, "vs58" },
226
+ { PPC_REG_VS59, "vs59" },
227
+ { PPC_REG_VS60, "vs60" },
228
+ { PPC_REG_VS61, "vs61" },
229
+ { PPC_REG_VS62, "vs62" },
230
+ { PPC_REG_VS63, "vs63" },
231
+
232
+ { PPC_REG_CR0EQ, "cr0eq" },
233
+ { PPC_REG_CR1EQ, "cr1eq" },
234
+ { PPC_REG_CR2EQ, "cr2eq" },
235
+ { PPC_REG_CR3EQ, "cr3eq" },
236
+ { PPC_REG_CR4EQ, "cr4eq" },
237
+ { PPC_REG_CR5EQ, "cr5eq" },
238
+ { PPC_REG_CR6EQ, "cr6eq" },
239
+ { PPC_REG_CR7EQ, "cr7eq" },
240
+ { PPC_REG_CR0GT, "cr0gt" },
241
+ { PPC_REG_CR1GT, "cr1gt" },
242
+ { PPC_REG_CR2GT, "cr2gt" },
243
+ { PPC_REG_CR3GT, "cr3gt" },
244
+ { PPC_REG_CR4GT, "cr4gt" },
245
+ { PPC_REG_CR5GT, "cr5gt" },
246
+ { PPC_REG_CR6GT, "cr6gt" },
247
+ { PPC_REG_CR7GT, "cr7gt" },
248
+ { PPC_REG_CR0LT, "cr0lt" },
249
+ { PPC_REG_CR1LT, "cr1lt" },
250
+ { PPC_REG_CR2LT, "cr2lt" },
251
+ { PPC_REG_CR3LT, "cr3lt" },
252
+ { PPC_REG_CR4LT, "cr4lt" },
253
+ { PPC_REG_CR5LT, "cr5lt" },
254
+ { PPC_REG_CR6LT, "cr6lt" },
255
+ { PPC_REG_CR7LT, "cr7lt" },
256
+ { PPC_REG_CR0UN, "cr0un" },
257
+ { PPC_REG_CR1UN, "cr1un" },
258
+ { PPC_REG_CR2UN, "cr2un" },
259
+ { PPC_REG_CR3UN, "cr3un" },
260
+ { PPC_REG_CR4UN, "cr4un" },
261
+ { PPC_REG_CR5UN, "cr5un" },
262
+ { PPC_REG_CR6UN, "cr6un" },
263
+ { PPC_REG_CR7UN, "cr7un" },
264
+ };
265
+
266
+ const char *PPC_reg_name(csh handle, unsigned int reg)
267
+ {
268
+ // binary searching since the IDs are sorted in order
269
+ unsigned int left, right, m;
270
+ unsigned int max = ARR_SIZE(reg_name_maps);
271
+
272
+ right = max - 1;
273
+
274
+ if (reg < reg_name_maps[0].id || reg > reg_name_maps[right].id)
275
+ // not found
276
+ return NULL;
277
+
278
+ left = 0;
279
+
280
+ while(left <= right) {
281
+ m = (left + right) / 2;
282
+ if (reg == reg_name_maps[m].id) {
283
+ return reg_name_maps[m].name;
284
+ }
285
+
286
+ if (reg < reg_name_maps[m].id)
287
+ right = m - 1;
288
+ else
289
+ left = m + 1;
290
+ }
291
+
292
+ // not found
293
+ return NULL;
294
+ }
295
+
296
+ ppc_reg PPC_name_reg(const char *name)
297
+ {
298
+ unsigned int i;
299
+
300
+ for(i = 1; i < ARR_SIZE(reg_name_maps); i++) {
301
+ if (!strcmp(name, reg_name_maps[i].name))
302
+ return reg_name_maps[i].id;
303
+ }
304
+
305
+ // not found
306
+ return 0;
307
+ }
308
+
309
+ static const insn_map insns[] = {
310
+ // dummy item
311
+ {
312
+ 0, 0,
313
+ #ifndef CAPSTONE_DIET
314
+ { 0 }, { 0 }, { 0 }, 0, 0
315
+ #endif
316
+ },
317
+
318
+ #include "PPCMappingInsn.inc"
319
+ };
320
+
321
+ // given internal insn id, return public instruction info
322
+ void PPC_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id)
323
+ {
324
+ int i;
325
+
326
+ i = insn_find(insns, ARR_SIZE(insns), id, &h->insn_cache);
327
+ if (i != 0) {
328
+ insn->id = insns[i].mapid;
329
+
330
+ if (h->detail) {
331
+ #ifndef CAPSTONE_DIET
332
+ cs_struct handle;
333
+ handle.detail = h->detail;
334
+
335
+ memcpy(insn->detail->regs_read, insns[i].regs_use, sizeof(insns[i].regs_use));
336
+ insn->detail->regs_read_count = (uint8_t)count_positive(insns[i].regs_use);
337
+
338
+ memcpy(insn->detail->regs_write, insns[i].regs_mod, sizeof(insns[i].regs_mod));
339
+ insn->detail->regs_write_count = (uint8_t)count_positive(insns[i].regs_mod);
340
+
341
+ memcpy(insn->detail->groups, insns[i].groups, sizeof(insns[i].groups));
342
+ insn->detail->groups_count = (uint8_t)count_positive8(insns[i].groups);
343
+
344
+ if (insns[i].branch || insns[i].indirect_branch) {
345
+ // this insn also belongs to JUMP group. add JUMP group
346
+ insn->detail->groups[insn->detail->groups_count] = PPC_GRP_JUMP;
347
+ insn->detail->groups_count++;
348
+ }
349
+
350
+ insn->detail->ppc.update_cr0 = cs_reg_write((csh)&handle, insn, PPC_REG_CR0);
351
+ #endif
352
+ }
353
+ }
354
+ }
355
+
356
+ static const char * const insn_name_maps[] = {
357
+ NULL, // PPC_INS_BCT
358
+ #include "PPCMappingInsnName.inc"
359
+ };
360
+
361
+ const char *PPC_insn_name(csh handle, unsigned int id)
362
+ {
363
+ #ifndef CAPSTONE_DIET
364
+ if (id >= PPC_INS_ENDING)
365
+ return NULL;
366
+
367
+ return insn_name_maps[id];
368
+ #else
369
+ return NULL;
370
+ #endif
371
+ }
372
+
373
+ // map instruction name to public instruction ID
374
+ ppc_insn PPC_map_insn(const char *name)
375
+ {
376
+ unsigned int i;
377
+
378
+ for(i = 1; i < ARR_SIZE(insn_name_maps); i++) {
379
+ if (!strcmp(name, insn_name_maps[i]))
380
+ return i;
381
+ }
382
+
383
+ // not found
384
+ return PPC_INS_INVALID;
385
+ }
386
+
387
+ #ifndef CAPSTONE_DIET
388
+ static const name_map group_name_maps[] = {
389
+ // generic groups
390
+ { PPC_GRP_INVALID, NULL },
391
+ { PPC_GRP_JUMP, "jump" },
392
+
393
+ // architecture-specific groups
394
+ { PPC_GRP_ALTIVEC, "altivec" },
395
+ { PPC_GRP_MODE32, "mode32" },
396
+ { PPC_GRP_MODE64, "mode64" },
397
+ { PPC_GRP_BOOKE, "booke" },
398
+ { PPC_GRP_NOTBOOKE, "notbooke" },
399
+ { PPC_GRP_SPE, "spe" },
400
+ { PPC_GRP_VSX, "vsx" },
401
+ { PPC_GRP_E500, "e500" },
402
+ { PPC_GRP_PPC4XX, "ppc4xx" },
403
+ { PPC_GRP_PPC6XX, "ppc6xx" },
404
+ { PPC_GRP_ICBT, "icbt" },
405
+ { PPC_GRP_P8ALTIVEC, "p8altivec" },
406
+ { PPC_GRP_P8VECTOR, "p8vector" },
407
+ { PPC_GRP_QPX, "qpx" },
408
+ { PPC_GRP_PS, "ps" },
409
+ };
410
+ #endif
411
+
412
+ const char *PPC_group_name(csh handle, unsigned int id)
413
+ {
414
+ #ifndef CAPSTONE_DIET
415
+ return id2name(group_name_maps, ARR_SIZE(group_name_maps), id);
416
+ #else
417
+ return NULL;
418
+ #endif
419
+ }
420
+
421
+ static const struct ppc_alias alias_insn_name_maps[] = {
422
+ //{ PPC_INS_BTA, "bta" },
423
+ { PPC_INS_B, PPC_BC_LT, "blt" },
424
+ { PPC_INS_B, PPC_BC_LE, "ble" },
425
+ { PPC_INS_B, PPC_BC_EQ, "beq" },
426
+ { PPC_INS_B, PPC_BC_GE, "bge" },
427
+ { PPC_INS_B, PPC_BC_GT, "bgt" },
428
+ { PPC_INS_B, PPC_BC_NE, "bne" },
429
+ { PPC_INS_B, PPC_BC_UN, "bun" },
430
+ { PPC_INS_B, PPC_BC_NU, "bnu" },
431
+ { PPC_INS_B, PPC_BC_SO, "bso" },
432
+ { PPC_INS_B, PPC_BC_NS, "bns" },
433
+
434
+ { PPC_INS_BA, PPC_BC_LT, "blta" },
435
+ { PPC_INS_BA, PPC_BC_LE, "blea" },
436
+ { PPC_INS_BA, PPC_BC_EQ, "beqa" },
437
+ { PPC_INS_BA, PPC_BC_GE, "bgea" },
438
+ { PPC_INS_BA, PPC_BC_GT, "bgta" },
439
+ { PPC_INS_BA, PPC_BC_NE, "bnea" },
440
+ { PPC_INS_BA, PPC_BC_UN, "buna" },
441
+ { PPC_INS_BA, PPC_BC_NU, "bnua" },
442
+ { PPC_INS_BA, PPC_BC_SO, "bsoa" },
443
+ { PPC_INS_BA, PPC_BC_NS, "bnsa" },
444
+
445
+ { PPC_INS_BCTR, PPC_BC_LT, "bltctr" },
446
+ { PPC_INS_BCTR, PPC_BC_LE, "blectr" },
447
+ { PPC_INS_BCTR, PPC_BC_EQ, "beqctr" },
448
+ { PPC_INS_BCTR, PPC_BC_GE, "bgectr" },
449
+ { PPC_INS_BCTR, PPC_BC_GT, "bgtctr" },
450
+ { PPC_INS_BCTR, PPC_BC_NE, "bnectr" },
451
+ { PPC_INS_BCTR, PPC_BC_UN, "bunctr" },
452
+ { PPC_INS_BCTR, PPC_BC_NU, "bnuctr" },
453
+ { PPC_INS_BCTR, PPC_BC_SO, "bsoctr" },
454
+ { PPC_INS_BCTR, PPC_BC_NS, "bnsctr" },
455
+
456
+ { PPC_INS_BCTRL, PPC_BC_LT, "bltctrl" },
457
+ { PPC_INS_BCTRL, PPC_BC_LE, "blectrl" },
458
+ { PPC_INS_BCTRL, PPC_BC_EQ, "beqctrl" },
459
+ { PPC_INS_BCTRL, PPC_BC_GE, "bgectrl" },
460
+ { PPC_INS_BCTRL, PPC_BC_GT, "bgtctrl" },
461
+ { PPC_INS_BCTRL, PPC_BC_NE, "bnectrl" },
462
+ { PPC_INS_BCTRL, PPC_BC_UN, "bunctrl" },
463
+ { PPC_INS_BCTRL, PPC_BC_NU, "bnuctrl" },
464
+ { PPC_INS_BCTRL, PPC_BC_SO, "bsoctrl" },
465
+ { PPC_INS_BCTRL, PPC_BC_NS, "bnsctrl" },
466
+
467
+ { PPC_INS_BL, PPC_BC_LT, "bltl" },
468
+ { PPC_INS_BL, PPC_BC_LE, "blel" },
469
+ { PPC_INS_BL, PPC_BC_EQ, "beql" },
470
+ { PPC_INS_BL, PPC_BC_GE, "bgel" },
471
+ { PPC_INS_BL, PPC_BC_GT, "bgtl" },
472
+ { PPC_INS_BL, PPC_BC_NE, "bnel" },
473
+ { PPC_INS_BL, PPC_BC_UN, "bunl" },
474
+ { PPC_INS_BL, PPC_BC_NU, "bnul" },
475
+ { PPC_INS_BL, PPC_BC_SO, "bsol" },
476
+ { PPC_INS_BL, PPC_BC_NS, "bnsl" },
477
+
478
+ { PPC_INS_BLA, PPC_BC_LT, "bltla" },
479
+ { PPC_INS_BLA, PPC_BC_LE, "blela" },
480
+ { PPC_INS_BLA, PPC_BC_EQ, "beqla" },
481
+ { PPC_INS_BLA, PPC_BC_GE, "bgela" },
482
+ { PPC_INS_BLA, PPC_BC_GT, "bgtla" },
483
+ { PPC_INS_BLA, PPC_BC_NE, "bnela" },
484
+ { PPC_INS_BLA, PPC_BC_UN, "bunla" },
485
+ { PPC_INS_BLA, PPC_BC_NU, "bnula" },
486
+ { PPC_INS_BLA, PPC_BC_SO, "bsola" },
487
+ { PPC_INS_BLA, PPC_BC_NS, "bnsla" },
488
+
489
+ { PPC_INS_BLR, PPC_BC_LT, "bltlr" },
490
+ { PPC_INS_BLR, PPC_BC_LE, "blelr" },
491
+ { PPC_INS_BLR, PPC_BC_EQ, "beqlr" },
492
+ { PPC_INS_BLR, PPC_BC_GE, "bgelr" },
493
+ { PPC_INS_BLR, PPC_BC_GT, "bgtlr" },
494
+ { PPC_INS_BLR, PPC_BC_NE, "bnelr" },
495
+ { PPC_INS_BLR, PPC_BC_UN, "bunlr" },
496
+ { PPC_INS_BLR, PPC_BC_NU, "bnulr" },
497
+ { PPC_INS_BLR, PPC_BC_SO, "bsolr" },
498
+ { PPC_INS_BLR, PPC_BC_NS, "bnslr" },
499
+
500
+ { PPC_INS_BLRL, PPC_BC_LT, "bltlrl" },
501
+ { PPC_INS_BLRL, PPC_BC_LE, "blelrl" },
502
+ { PPC_INS_BLRL, PPC_BC_EQ, "beqlrl" },
503
+ { PPC_INS_BLRL, PPC_BC_GE, "bgelrl" },
504
+ { PPC_INS_BLRL, PPC_BC_GT, "bgtlrl" },
505
+ { PPC_INS_BLRL, PPC_BC_NE, "bnelrl" },
506
+ { PPC_INS_BLRL, PPC_BC_UN, "bunlrl" },
507
+ { PPC_INS_BLRL, PPC_BC_NU, "bnulrl" },
508
+ { PPC_INS_BLRL, PPC_BC_SO, "bsolrl" },
509
+ { PPC_INS_BLRL, PPC_BC_NS, "bnslrl" },
510
+ };
511
+
512
+ // given alias mnemonic, return instruction ID & CC
513
+ bool PPC_alias_insn(const char *name, struct ppc_alias *alias)
514
+ {
515
+ size_t i;
516
+
517
+ alias->cc = PPC_BC_INVALID;
518
+
519
+ for(i = 0; i < ARR_SIZE(alias_insn_name_maps); i++) {
520
+ if (!strcmp(name, alias_insn_name_maps[i].mnem)) {
521
+ // alias->id = alias_insn_name_maps[i].id;
522
+ alias->cc = alias_insn_name_maps[i].cc;
523
+ return true;
524
+ }
525
+ }
526
+
527
+ // not found
528
+ return false;
529
+ }
530
+
531
+ // check if this insn is relative branch
532
+ bool PPC_abs_branch(cs_struct *h, unsigned int id)
533
+ {
534
+ unsigned int i;
535
+ // list all absolute branch instructions
536
+ static const unsigned int insn_abs[] = {
537
+ PPC_BA,
538
+ PPC_BCCA,
539
+ PPC_BCCLA,
540
+ PPC_BDNZA,
541
+ PPC_BDNZAm,
542
+ PPC_BDNZAp,
543
+ PPC_BDNZLA,
544
+ PPC_BDNZLAm,
545
+ PPC_BDNZLAp,
546
+ PPC_BDZA,
547
+ PPC_BDZAm,
548
+ PPC_BDZAp,
549
+ PPC_BDZLAm,
550
+ PPC_BDZLAp,
551
+ PPC_BLA,
552
+ PPC_gBCA,
553
+ PPC_gBCLA,
554
+ PPC_BDZLA,
555
+ 0
556
+ };
557
+
558
+ // printf("opcode: %u\n", id);
559
+
560
+ for (i = 0; insn_abs[i]; i++) {
561
+ if (id == insn_abs[i]) {
562
+ return true;
563
+ }
564
+ }
565
+
566
+ // not found
567
+ return false;
568
+ }
569
+
570
+ #endif
@@ -0,0 +1,40 @@
1
+ /* Capstone Disassembly Engine */
2
+ /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */
3
+
4
+ #ifndef CS_PPC_MAP_H
5
+ #define CS_PPC_MAP_H
6
+
7
+ #include "capstone/capstone.h"
8
+
9
+ // return name of regiser in friendly string
10
+ const char *PPC_reg_name(csh handle, unsigned int reg);
11
+
12
+ // return register id, given register name
13
+ ppc_reg PPC_name_reg(const char *name);
14
+
15
+ // given internal insn id, return public instruction info
16
+ void PPC_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id);
17
+
18
+ const char *PPC_insn_name(csh handle, unsigned int id);
19
+ const char *PPC_group_name(csh handle, unsigned int id);
20
+
21
+ struct ppc_alias {
22
+ unsigned int id; // instruction id
23
+ int cc; // code condition
24
+ const char *mnem;
25
+ };
26
+
27
+ // map instruction name to public instruction ID
28
+ ppc_insn PPC_map_insn(const char *name);
29
+
30
+ // check if this insn is relative branch
31
+ bool PPC_abs_branch(cs_struct *h, unsigned int id);
32
+
33
+ // map internal raw register to 'public' register
34
+ ppc_reg PPC_map_register(unsigned int r);
35
+
36
+ // given alias mnemonic, return instruction ID & CC
37
+ bool PPC_alias_insn(const char *name, struct ppc_alias *alias);
38
+
39
+ #endif
40
+