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,1061 @@
1
+ //===-- X86IntelInstPrinter.cpp - Intel assembly instruction printing -----===//
2
+ //
3
+ // The LLVM Compiler Infrastructure
4
+ //
5
+ // This file is distributed under the University of Illinois Open Source
6
+ // License. See LICENSE.TXT for details.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+ //
10
+ // This file includes code for rendering MCInst instances as Intel-style
11
+ // assembly.
12
+ //
13
+ //===----------------------------------------------------------------------===//
14
+
15
+ /* Capstone Disassembly Engine */
16
+ /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
17
+
18
+ #ifdef CAPSTONE_HAS_X86
19
+
20
+ #if defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64)
21
+ #pragma warning(disable:4996) // disable MSVC's warning on strncpy()
22
+ #pragma warning(disable:28719) // disable MSVC's warning on strncpy()
23
+ #endif
24
+
25
+ #if !defined(CAPSTONE_HAS_OSXKERNEL)
26
+ #include <ctype.h>
27
+ #endif
28
+ #include <capstone/platform.h>
29
+
30
+ #if defined(CAPSTONE_HAS_OSXKERNEL)
31
+ #include <Availability.h>
32
+ #include <libkern/libkern.h>
33
+ #else
34
+ #include <stdio.h>
35
+ #include <stdlib.h>
36
+ #endif
37
+ #include <string.h>
38
+
39
+ #include "../../utils.h"
40
+ #include "../../MCInst.h"
41
+ #include "../../SStream.h"
42
+ #include "../../MCRegisterInfo.h"
43
+
44
+ #include "X86InstPrinter.h"
45
+ #include "X86Mapping.h"
46
+ #include "X86InstPrinterCommon.h"
47
+
48
+ #define GET_INSTRINFO_ENUM
49
+ #ifdef CAPSTONE_X86_REDUCE
50
+ #include "X86GenInstrInfo_reduce.inc"
51
+ #else
52
+ #include "X86GenInstrInfo.inc"
53
+ #endif
54
+
55
+ #define GET_REGINFO_ENUM
56
+ #include "X86GenRegisterInfo.inc"
57
+
58
+ #include "X86BaseInfo.h"
59
+
60
+ static void printMemReference(MCInst *MI, unsigned Op, SStream *O);
61
+ static void printOperand(MCInst *MI, unsigned OpNo, SStream *O);
62
+
63
+
64
+ static void set_mem_access(MCInst *MI, bool status)
65
+ {
66
+ if (MI->csh->detail != CS_OPT_ON)
67
+ return;
68
+
69
+ MI->csh->doing_mem = status;
70
+ if (!status)
71
+ // done, create the next operand slot
72
+ MI->flat_insn->detail->x86.op_count++;
73
+
74
+ }
75
+
76
+ static void printopaquemem(MCInst *MI, unsigned OpNo, SStream *O)
77
+ {
78
+ // FIXME: do this with autogen
79
+ // printf(">>> ID = %u\n", MI->flat_insn->id);
80
+ switch(MI->flat_insn->id) {
81
+ default:
82
+ SStream_concat0(O, "ptr ");
83
+ break;
84
+ case X86_INS_SGDT:
85
+ case X86_INS_SIDT:
86
+ case X86_INS_LGDT:
87
+ case X86_INS_LIDT:
88
+ case X86_INS_FXRSTOR:
89
+ case X86_INS_FXSAVE:
90
+ case X86_INS_LJMP:
91
+ case X86_INS_LCALL:
92
+ // do not print "ptr"
93
+ break;
94
+ }
95
+
96
+ switch(MI->csh->mode) {
97
+ case CS_MODE_16:
98
+ switch(MI->flat_insn->id) {
99
+ default:
100
+ MI->x86opsize = 2;
101
+ break;
102
+ case X86_INS_LJMP:
103
+ case X86_INS_LCALL:
104
+ MI->x86opsize = 4;
105
+ break;
106
+ case X86_INS_SGDT:
107
+ case X86_INS_SIDT:
108
+ case X86_INS_LGDT:
109
+ case X86_INS_LIDT:
110
+ MI->x86opsize = 6;
111
+ break;
112
+ }
113
+ break;
114
+ case CS_MODE_32:
115
+ switch(MI->flat_insn->id) {
116
+ default:
117
+ MI->x86opsize = 4;
118
+ break;
119
+ case X86_INS_LJMP:
120
+ case X86_INS_JMP:
121
+ case X86_INS_LCALL:
122
+ case X86_INS_SGDT:
123
+ case X86_INS_SIDT:
124
+ case X86_INS_LGDT:
125
+ case X86_INS_LIDT:
126
+ MI->x86opsize = 6;
127
+ break;
128
+ }
129
+ break;
130
+ case CS_MODE_64:
131
+ switch(MI->flat_insn->id) {
132
+ default:
133
+ MI->x86opsize = 8;
134
+ break;
135
+ case X86_INS_LJMP:
136
+ case X86_INS_LCALL:
137
+ case X86_INS_SGDT:
138
+ case X86_INS_SIDT:
139
+ case X86_INS_LGDT:
140
+ case X86_INS_LIDT:
141
+ MI->x86opsize = 10;
142
+ break;
143
+ }
144
+ break;
145
+ default: // never reach
146
+ break;
147
+ }
148
+
149
+ printMemReference(MI, OpNo, O);
150
+ }
151
+
152
+ static void printi8mem(MCInst *MI, unsigned OpNo, SStream *O)
153
+ {
154
+ SStream_concat0(O, "byte ptr ");
155
+ MI->x86opsize = 1;
156
+ printMemReference(MI, OpNo, O);
157
+ }
158
+
159
+ static void printi16mem(MCInst *MI, unsigned OpNo, SStream *O)
160
+ {
161
+ MI->x86opsize = 2;
162
+ SStream_concat0(O, "word ptr ");
163
+ printMemReference(MI, OpNo, O);
164
+ }
165
+
166
+ static void printi32mem(MCInst *MI, unsigned OpNo, SStream *O)
167
+ {
168
+ MI->x86opsize = 4;
169
+ SStream_concat0(O, "dword ptr ");
170
+ printMemReference(MI, OpNo, O);
171
+ }
172
+
173
+ static void printi64mem(MCInst *MI, unsigned OpNo, SStream *O)
174
+ {
175
+ SStream_concat0(O, "qword ptr ");
176
+ MI->x86opsize = 8;
177
+ printMemReference(MI, OpNo, O);
178
+ }
179
+
180
+ static void printi128mem(MCInst *MI, unsigned OpNo, SStream *O)
181
+ {
182
+ SStream_concat0(O, "xmmword ptr ");
183
+ MI->x86opsize = 16;
184
+ printMemReference(MI, OpNo, O);
185
+ }
186
+
187
+ static void printi512mem(MCInst *MI, unsigned OpNo, SStream *O)
188
+ {
189
+ SStream_concat0(O, "zmmword ptr ");
190
+ MI->x86opsize = 64;
191
+ printMemReference(MI, OpNo, O);
192
+ }
193
+
194
+ #ifndef CAPSTONE_X86_REDUCE
195
+ static void printi256mem(MCInst *MI, unsigned OpNo, SStream *O)
196
+ {
197
+ SStream_concat0(O, "ymmword ptr ");
198
+ MI->x86opsize = 32;
199
+ printMemReference(MI, OpNo, O);
200
+ }
201
+
202
+ static void printf32mem(MCInst *MI, unsigned OpNo, SStream *O)
203
+ {
204
+ switch(MCInst_getOpcode(MI)) {
205
+ default:
206
+ SStream_concat0(O, "dword ptr ");
207
+ MI->x86opsize = 4;
208
+ break;
209
+ case X86_FSTENVm:
210
+ case X86_FLDENVm:
211
+ // TODO: fix this in tablegen instead
212
+ switch(MI->csh->mode) {
213
+ default: // never reach
214
+ break;
215
+ case CS_MODE_16:
216
+ MI->x86opsize = 14;
217
+ break;
218
+ case CS_MODE_32:
219
+ case CS_MODE_64:
220
+ MI->x86opsize = 28;
221
+ break;
222
+ }
223
+ break;
224
+ }
225
+
226
+ printMemReference(MI, OpNo, O);
227
+ }
228
+
229
+ static void printf64mem(MCInst *MI, unsigned OpNo, SStream *O)
230
+ {
231
+ // TODO: fix COMISD in Tablegen instead (#1456)
232
+ if (MI->op1_size == 16) {
233
+ // printf("printf64mem id = %u\n", MCInst_getOpcode(MI));
234
+ switch(MCInst_getOpcode(MI)) {
235
+ default:
236
+ SStream_concat0(O, "qword ptr ");
237
+ MI->x86opsize = 8;
238
+ break;
239
+ case X86_MOVPQI2QImr:
240
+ case X86_COMISDrm:
241
+ SStream_concat0(O, "xmmword ptr ");
242
+ MI->x86opsize = 16;
243
+ break;
244
+ }
245
+ } else {
246
+ SStream_concat0(O, "qword ptr ");
247
+ MI->x86opsize = 8;
248
+ }
249
+
250
+ printMemReference(MI, OpNo, O);
251
+ }
252
+
253
+ static void printf80mem(MCInst *MI, unsigned OpNo, SStream *O)
254
+ {
255
+ switch(MCInst_getOpcode(MI)) {
256
+ default:
257
+ SStream_concat0(O, "xword ptr ");
258
+ break;
259
+ case X86_FBLDm:
260
+ case X86_FBSTPm:
261
+ break;
262
+ }
263
+
264
+ MI->x86opsize = 10;
265
+ printMemReference(MI, OpNo, O);
266
+ }
267
+
268
+ static void printf128mem(MCInst *MI, unsigned OpNo, SStream *O)
269
+ {
270
+ SStream_concat0(O, "xmmword ptr ");
271
+ MI->x86opsize = 16;
272
+ printMemReference(MI, OpNo, O);
273
+ }
274
+
275
+ static void printf256mem(MCInst *MI, unsigned OpNo, SStream *O)
276
+ {
277
+ SStream_concat0(O, "ymmword ptr ");
278
+ MI->x86opsize = 32;
279
+ printMemReference(MI, OpNo, O);
280
+ }
281
+
282
+ static void printf512mem(MCInst *MI, unsigned OpNo, SStream *O)
283
+ {
284
+ SStream_concat0(O, "zmmword ptr ");
285
+ MI->x86opsize = 64;
286
+ printMemReference(MI, OpNo, O);
287
+ }
288
+ #endif
289
+
290
+ static const char *getRegisterName(unsigned RegNo);
291
+ static void printRegName(SStream *OS, unsigned RegNo)
292
+ {
293
+ SStream_concat0(OS, getRegisterName(RegNo));
294
+ }
295
+
296
+ // for MASM syntax, 0x123 = 123h, 0xA123 = 0A123h
297
+ // this function tell us if we need to have prefix 0 in front of a number
298
+ static bool need_zero_prefix(uint64_t imm)
299
+ {
300
+ // find the first hex letter representing imm
301
+ while(imm >= 0x10)
302
+ imm >>= 4;
303
+
304
+ if (imm < 0xa)
305
+ return false;
306
+ else // this need 0 prefix
307
+ return true;
308
+ }
309
+
310
+ static void printImm(MCInst *MI, SStream *O, int64_t imm, bool positive)
311
+ {
312
+ if (positive) {
313
+ // always print this number in positive form
314
+ if (MI->csh->syntax == CS_OPT_SYNTAX_MASM) {
315
+ if (imm < 0) {
316
+ if (MI->op1_size) {
317
+ switch(MI->op1_size) {
318
+ default:
319
+ break;
320
+ case 1:
321
+ imm &= 0xff;
322
+ break;
323
+ case 2:
324
+ imm &= 0xffff;
325
+ break;
326
+ case 4:
327
+ imm &= 0xffffffff;
328
+ break;
329
+ }
330
+ }
331
+
332
+ if (imm == 0x8000000000000000LL) // imm == -imm
333
+ SStream_concat0(O, "8000000000000000h");
334
+ else if (need_zero_prefix(imm))
335
+ SStream_concat(O, "0%"PRIx64"h", imm);
336
+ else
337
+ SStream_concat(O, "%"PRIx64"h", imm);
338
+ } else {
339
+ if (imm > HEX_THRESHOLD) {
340
+ if (need_zero_prefix(imm))
341
+ SStream_concat(O, "0%"PRIx64"h", imm);
342
+ else
343
+ SStream_concat(O, "%"PRIx64"h", imm);
344
+ } else
345
+ SStream_concat(O, "%"PRIu64, imm);
346
+ }
347
+ } else { // Intel syntax
348
+ if (imm < 0) {
349
+ if (MI->op1_size) {
350
+ switch(MI->op1_size) {
351
+ default:
352
+ break;
353
+ case 1:
354
+ imm &= 0xff;
355
+ break;
356
+ case 2:
357
+ imm &= 0xffff;
358
+ break;
359
+ case 4:
360
+ imm &= 0xffffffff;
361
+ break;
362
+ }
363
+ }
364
+
365
+ SStream_concat(O, "0x%"PRIx64, imm);
366
+ } else {
367
+ if (imm > HEX_THRESHOLD)
368
+ SStream_concat(O, "0x%"PRIx64, imm);
369
+ else
370
+ SStream_concat(O, "%"PRIu64, imm);
371
+ }
372
+ }
373
+ } else {
374
+ if (MI->csh->syntax == CS_OPT_SYNTAX_MASM) {
375
+ if (imm < 0) {
376
+ if (imm == 0x8000000000000000LL) // imm == -imm
377
+ SStream_concat0(O, "8000000000000000h");
378
+ else if (imm < -HEX_THRESHOLD) {
379
+ if (need_zero_prefix(imm))
380
+ SStream_concat(O, "-0%"PRIx64"h", -imm);
381
+ else
382
+ SStream_concat(O, "-%"PRIx64"h", -imm);
383
+ } else
384
+ SStream_concat(O, "-%"PRIu64, -imm);
385
+ } else {
386
+ if (imm > HEX_THRESHOLD) {
387
+ if (need_zero_prefix(imm))
388
+ SStream_concat(O, "0%"PRIx64"h", imm);
389
+ else
390
+ SStream_concat(O, "%"PRIx64"h", imm);
391
+ } else
392
+ SStream_concat(O, "%"PRIu64, imm);
393
+ }
394
+ } else { // Intel syntax
395
+ if (imm < 0) {
396
+ if (imm == 0x8000000000000000LL) // imm == -imm
397
+ SStream_concat0(O, "0x8000000000000000");
398
+ else if (imm < -HEX_THRESHOLD)
399
+ SStream_concat(O, "-0x%"PRIx64, -imm);
400
+ else
401
+ SStream_concat(O, "-%"PRIu64, -imm);
402
+
403
+ } else {
404
+ if (imm > HEX_THRESHOLD)
405
+ SStream_concat(O, "0x%"PRIx64, imm);
406
+ else
407
+ SStream_concat(O, "%"PRIu64, imm);
408
+ }
409
+ }
410
+ }
411
+ }
412
+
413
+ // local printOperand, without updating public operands
414
+ static void _printOperand(MCInst *MI, unsigned OpNo, SStream *O)
415
+ {
416
+ MCOperand *Op = MCInst_getOperand(MI, OpNo);
417
+ if (MCOperand_isReg(Op)) {
418
+ printRegName(O, MCOperand_getReg(Op));
419
+ } else if (MCOperand_isImm(Op)) {
420
+ int64_t imm = MCOperand_getImm(Op);
421
+ printImm(MI, O, imm, MI->csh->imm_unsigned);
422
+ }
423
+ }
424
+
425
+ #ifndef CAPSTONE_DIET
426
+ // copy & normalize access info
427
+ static void get_op_access(cs_struct *h, unsigned int id, uint8_t *access, uint64_t *eflags)
428
+ {
429
+ #ifndef CAPSTONE_DIET
430
+ uint8_t i;
431
+ const uint8_t *arr = X86_get_op_access(h, id, eflags);
432
+
433
+ if (!arr) {
434
+ access[0] = 0;
435
+ return;
436
+ }
437
+
438
+ // copy to access but zero out CS_AC_IGNORE
439
+ for(i = 0; arr[i]; i++) {
440
+ if (arr[i] != CS_AC_IGNORE)
441
+ access[i] = arr[i];
442
+ else
443
+ access[i] = 0;
444
+ }
445
+
446
+ // mark the end of array
447
+ access[i] = 0;
448
+ #endif
449
+ }
450
+ #endif
451
+
452
+ static void printSrcIdx(MCInst *MI, unsigned Op, SStream *O)
453
+ {
454
+ MCOperand *SegReg;
455
+ int reg;
456
+
457
+ if (MI->csh->detail) {
458
+ #ifndef CAPSTONE_DIET
459
+ uint8_t access[6];
460
+ #endif
461
+
462
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].type = X86_OP_MEM;
463
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = MI->x86opsize;
464
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.segment = X86_REG_INVALID;
465
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.base = X86_REG_INVALID;
466
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.index = X86_REG_INVALID;
467
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.scale = 1;
468
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.disp = 0;
469
+
470
+ #ifndef CAPSTONE_DIET
471
+ get_op_access(MI->csh, MCInst_getOpcode(MI), access, &MI->flat_insn->detail->x86.eflags);
472
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].access = access[MI->flat_insn->detail->x86.op_count];
473
+ #endif
474
+ }
475
+
476
+ SegReg = MCInst_getOperand(MI, Op + 1);
477
+ reg = MCOperand_getReg(SegReg);
478
+
479
+ // If this has a segment register, print it.
480
+ if (reg) {
481
+ _printOperand(MI, Op + 1, O);
482
+ if (MI->csh->detail) {
483
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.segment = X86_register_map(reg);
484
+ }
485
+ SStream_concat0(O, ":");
486
+ }
487
+
488
+ SStream_concat0(O, "[");
489
+ set_mem_access(MI, true);
490
+ printOperand(MI, Op, O);
491
+ SStream_concat0(O, "]");
492
+ set_mem_access(MI, false);
493
+ }
494
+
495
+ static void printDstIdx(MCInst *MI, unsigned Op, SStream *O)
496
+ {
497
+ if (MI->csh->detail) {
498
+ #ifndef CAPSTONE_DIET
499
+ uint8_t access[6];
500
+ #endif
501
+
502
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].type = X86_OP_MEM;
503
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = MI->x86opsize;
504
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.segment = X86_REG_INVALID;
505
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.base = X86_REG_INVALID;
506
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.index = X86_REG_INVALID;
507
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.scale = 1;
508
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.disp = 0;
509
+
510
+ #ifndef CAPSTONE_DIET
511
+ get_op_access(MI->csh, MCInst_getOpcode(MI), access, &MI->flat_insn->detail->x86.eflags);
512
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].access = access[MI->flat_insn->detail->x86.op_count];
513
+ #endif
514
+ }
515
+
516
+ // DI accesses are always ES-based on non-64bit mode
517
+ if (MI->csh->mode != CS_MODE_64) {
518
+ SStream_concat0(O, "es:[");
519
+ if (MI->csh->detail) {
520
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.segment = X86_REG_ES;
521
+ }
522
+ } else
523
+ SStream_concat0(O, "[");
524
+
525
+ set_mem_access(MI, true);
526
+ printOperand(MI, Op, O);
527
+ SStream_concat0(O, "]");
528
+ set_mem_access(MI, false);
529
+ }
530
+
531
+ static void printSrcIdx8(MCInst *MI, unsigned OpNo, SStream *O)
532
+ {
533
+ SStream_concat0(O, "byte ptr ");
534
+ MI->x86opsize = 1;
535
+ printSrcIdx(MI, OpNo, O);
536
+ }
537
+
538
+ static void printSrcIdx16(MCInst *MI, unsigned OpNo, SStream *O)
539
+ {
540
+ SStream_concat0(O, "word ptr ");
541
+ MI->x86opsize = 2;
542
+ printSrcIdx(MI, OpNo, O);
543
+ }
544
+
545
+ static void printSrcIdx32(MCInst *MI, unsigned OpNo, SStream *O)
546
+ {
547
+ SStream_concat0(O, "dword ptr ");
548
+ MI->x86opsize = 4;
549
+ printSrcIdx(MI, OpNo, O);
550
+ }
551
+
552
+ static void printSrcIdx64(MCInst *MI, unsigned OpNo, SStream *O)
553
+ {
554
+ SStream_concat0(O, "qword ptr ");
555
+ MI->x86opsize = 8;
556
+ printSrcIdx(MI, OpNo, O);
557
+ }
558
+
559
+ static void printDstIdx8(MCInst *MI, unsigned OpNo, SStream *O)
560
+ {
561
+ SStream_concat0(O, "byte ptr ");
562
+ MI->x86opsize = 1;
563
+ printDstIdx(MI, OpNo, O);
564
+ }
565
+
566
+ static void printDstIdx16(MCInst *MI, unsigned OpNo, SStream *O)
567
+ {
568
+ SStream_concat0(O, "word ptr ");
569
+ MI->x86opsize = 2;
570
+ printDstIdx(MI, OpNo, O);
571
+ }
572
+
573
+ static void printDstIdx32(MCInst *MI, unsigned OpNo, SStream *O)
574
+ {
575
+ SStream_concat0(O, "dword ptr ");
576
+ MI->x86opsize = 4;
577
+ printDstIdx(MI, OpNo, O);
578
+ }
579
+
580
+ static void printDstIdx64(MCInst *MI, unsigned OpNo, SStream *O)
581
+ {
582
+ SStream_concat0(O, "qword ptr ");
583
+ MI->x86opsize = 8;
584
+ printDstIdx(MI, OpNo, O);
585
+ }
586
+
587
+ static void printMemOffset(MCInst *MI, unsigned Op, SStream *O)
588
+ {
589
+ MCOperand *DispSpec = MCInst_getOperand(MI, Op);
590
+ MCOperand *SegReg = MCInst_getOperand(MI, Op + 1);
591
+ int reg;
592
+
593
+ if (MI->csh->detail) {
594
+ #ifndef CAPSTONE_DIET
595
+ uint8_t access[6];
596
+ #endif
597
+
598
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].type = X86_OP_MEM;
599
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = MI->x86opsize;
600
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.segment = X86_REG_INVALID;
601
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.base = X86_REG_INVALID;
602
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.index = X86_REG_INVALID;
603
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.scale = 1;
604
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.disp = 0;
605
+
606
+ #ifndef CAPSTONE_DIET
607
+ get_op_access(MI->csh, MCInst_getOpcode(MI), access, &MI->flat_insn->detail->x86.eflags);
608
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].access = access[MI->flat_insn->detail->x86.op_count];
609
+ #endif
610
+ }
611
+
612
+ // If this has a segment register, print it.
613
+ reg = MCOperand_getReg(SegReg);
614
+ if (reg) {
615
+ _printOperand(MI, Op + 1, O);
616
+ SStream_concat0(O, ":");
617
+ if (MI->csh->detail) {
618
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.segment = X86_register_map(reg);
619
+ }
620
+ }
621
+
622
+ SStream_concat0(O, "[");
623
+
624
+ if (MCOperand_isImm(DispSpec)) {
625
+ int64_t imm = MCOperand_getImm(DispSpec);
626
+ if (MI->csh->detail)
627
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.disp = imm;
628
+
629
+ if (imm < 0)
630
+ printImm(MI, O, arch_masks[MI->csh->mode] & imm, true);
631
+ else
632
+ printImm(MI, O, imm, true);
633
+ }
634
+
635
+ SStream_concat0(O, "]");
636
+
637
+ if (MI->csh->detail)
638
+ MI->flat_insn->detail->x86.op_count++;
639
+
640
+ if (MI->op1_size == 0)
641
+ MI->op1_size = MI->x86opsize;
642
+ }
643
+
644
+ static void printU8Imm(MCInst *MI, unsigned Op, SStream *O)
645
+ {
646
+ uint8_t val = MCOperand_getImm(MCInst_getOperand(MI, Op)) & 0xff;
647
+
648
+ printImm(MI, O, val, true);
649
+
650
+ if (MI->csh->detail) {
651
+ #ifndef CAPSTONE_DIET
652
+ uint8_t access[6];
653
+ #endif
654
+
655
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].type = X86_OP_IMM;
656
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].imm = val;
657
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = 1;
658
+
659
+ #ifndef CAPSTONE_DIET
660
+ get_op_access(MI->csh, MCInst_getOpcode(MI), access, &MI->flat_insn->detail->x86.eflags);
661
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].access = access[MI->flat_insn->detail->x86.op_count];
662
+ #endif
663
+
664
+ MI->flat_insn->detail->x86.op_count++;
665
+ }
666
+ }
667
+
668
+ static void printMemOffs8(MCInst *MI, unsigned OpNo, SStream *O)
669
+ {
670
+ SStream_concat0(O, "byte ptr ");
671
+ MI->x86opsize = 1;
672
+ printMemOffset(MI, OpNo, O);
673
+ }
674
+
675
+ static void printMemOffs16(MCInst *MI, unsigned OpNo, SStream *O)
676
+ {
677
+ SStream_concat0(O, "word ptr ");
678
+ MI->x86opsize = 2;
679
+ printMemOffset(MI, OpNo, O);
680
+ }
681
+
682
+ static void printMemOffs32(MCInst *MI, unsigned OpNo, SStream *O)
683
+ {
684
+ SStream_concat0(O, "dword ptr ");
685
+ MI->x86opsize = 4;
686
+ printMemOffset(MI, OpNo, O);
687
+ }
688
+
689
+ static void printMemOffs64(MCInst *MI, unsigned OpNo, SStream *O)
690
+ {
691
+ SStream_concat0(O, "qword ptr ");
692
+ MI->x86opsize = 8;
693
+ printMemOffset(MI, OpNo, O);
694
+ }
695
+
696
+ static void printInstruction(MCInst *MI, SStream *O);
697
+
698
+ void X86_Intel_printInst(MCInst *MI, SStream *O, void *Info)
699
+ {
700
+ x86_reg reg, reg2;
701
+ enum cs_ac_type access1, access2;
702
+
703
+ // printf("opcode = %u\n", MCInst_getOpcode(MI));
704
+
705
+ // perhaps this instruction does not need printer
706
+ if (MI->assembly[0]) {
707
+ strncpy(O->buffer, MI->assembly, sizeof(O->buffer));
708
+ return;
709
+ }
710
+
711
+ X86_lockrep(MI, O);
712
+ printInstruction(MI, O);
713
+
714
+ reg = X86_insn_reg_intel(MCInst_getOpcode(MI), &access1);
715
+ if (MI->csh->detail) {
716
+ #ifndef CAPSTONE_DIET
717
+ uint8_t access[6] = {0};
718
+ #endif
719
+
720
+ // first op can be embedded in the asm by llvm.
721
+ // so we have to add the missing register as the first operand
722
+ if (reg) {
723
+ // shift all the ops right to leave 1st slot for this new register op
724
+ memmove(&(MI->flat_insn->detail->x86.operands[1]), &(MI->flat_insn->detail->x86.operands[0]),
725
+ sizeof(MI->flat_insn->detail->x86.operands[0]) * (ARR_SIZE(MI->flat_insn->detail->x86.operands) - 1));
726
+ MI->flat_insn->detail->x86.operands[0].type = X86_OP_REG;
727
+ MI->flat_insn->detail->x86.operands[0].reg = reg;
728
+ MI->flat_insn->detail->x86.operands[0].size = MI->csh->regsize_map[reg];
729
+ MI->flat_insn->detail->x86.operands[0].access = access1;
730
+ MI->flat_insn->detail->x86.op_count++;
731
+ } else {
732
+ if (X86_insn_reg_intel2(MCInst_getOpcode(MI), &reg, &access1, &reg2, &access2)) {
733
+ MI->flat_insn->detail->x86.operands[0].type = X86_OP_REG;
734
+ MI->flat_insn->detail->x86.operands[0].reg = reg;
735
+ MI->flat_insn->detail->x86.operands[0].size = MI->csh->regsize_map[reg];
736
+ MI->flat_insn->detail->x86.operands[0].access = access1;
737
+ MI->flat_insn->detail->x86.operands[1].type = X86_OP_REG;
738
+ MI->flat_insn->detail->x86.operands[1].reg = reg2;
739
+ MI->flat_insn->detail->x86.operands[1].size = MI->csh->regsize_map[reg2];
740
+ MI->flat_insn->detail->x86.operands[1].access = access2;
741
+ MI->flat_insn->detail->x86.op_count = 2;
742
+ }
743
+ }
744
+
745
+ #ifndef CAPSTONE_DIET
746
+ get_op_access(MI->csh, MCInst_getOpcode(MI), access, &MI->flat_insn->detail->x86.eflags);
747
+ MI->flat_insn->detail->x86.operands[0].access = access[0];
748
+ MI->flat_insn->detail->x86.operands[1].access = access[1];
749
+ #endif
750
+ }
751
+
752
+ if (MI->op1_size == 0 && reg)
753
+ MI->op1_size = MI->csh->regsize_map[reg];
754
+ }
755
+
756
+ /// printPCRelImm - This is used to print an immediate value that ends up
757
+ /// being encoded as a pc-relative value.
758
+ static void printPCRelImm(MCInst *MI, unsigned OpNo, SStream *O)
759
+ {
760
+ MCOperand *Op = MCInst_getOperand(MI, OpNo);
761
+ if (MCOperand_isImm(Op)) {
762
+ int64_t imm = MCOperand_getImm(Op) + MI->flat_insn->size + MI->address;
763
+ uint8_t opsize = X86_immediate_size(MI->Opcode, NULL);
764
+
765
+ // truncat imm for non-64bit
766
+ if (MI->csh->mode != CS_MODE_64) {
767
+ imm = imm & 0xffffffff;
768
+ }
769
+
770
+ printImm(MI, O, imm, true);
771
+
772
+ if (MI->csh->detail) {
773
+ #ifndef CAPSTONE_DIET
774
+ uint8_t access[6];
775
+ #endif
776
+
777
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].type = X86_OP_IMM;
778
+ // if op_count > 0, then this operand's size is taken from the destination op
779
+ if (MI->flat_insn->detail->x86.op_count > 0)
780
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = MI->flat_insn->detail->x86.operands[0].size;
781
+ else if (opsize > 0)
782
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = opsize;
783
+ else
784
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = MI->imm_size;
785
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].imm = imm;
786
+
787
+ #ifndef CAPSTONE_DIET
788
+ get_op_access(MI->csh, MCInst_getOpcode(MI), access, &MI->flat_insn->detail->x86.eflags);
789
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].access = access[MI->flat_insn->detail->x86.op_count];
790
+ #endif
791
+
792
+ MI->flat_insn->detail->x86.op_count++;
793
+ }
794
+
795
+ if (MI->op1_size == 0)
796
+ MI->op1_size = MI->imm_size;
797
+ }
798
+ }
799
+
800
+ static void printOperand(MCInst *MI, unsigned OpNo, SStream *O)
801
+ {
802
+ MCOperand *Op = MCInst_getOperand(MI, OpNo);
803
+
804
+ if (MCOperand_isReg(Op)) {
805
+ unsigned int reg = MCOperand_getReg(Op);
806
+
807
+ printRegName(O, reg);
808
+ if (MI->csh->detail) {
809
+ if (MI->csh->doing_mem) {
810
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.base = X86_register_map(reg);
811
+ } else {
812
+ #ifndef CAPSTONE_DIET
813
+ uint8_t access[6];
814
+ #endif
815
+
816
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].type = X86_OP_REG;
817
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].reg = X86_register_map(reg);
818
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = MI->csh->regsize_map[X86_register_map(reg)];
819
+
820
+ #ifndef CAPSTONE_DIET
821
+ get_op_access(MI->csh, MCInst_getOpcode(MI), access, &MI->flat_insn->detail->x86.eflags);
822
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].access = access[MI->flat_insn->detail->x86.op_count];
823
+ #endif
824
+
825
+ MI->flat_insn->detail->x86.op_count++;
826
+ }
827
+ }
828
+
829
+ if (MI->op1_size == 0)
830
+ MI->op1_size = MI->csh->regsize_map[X86_register_map(reg)];
831
+ } else if (MCOperand_isImm(Op)) {
832
+ uint8_t encsize;
833
+ int64_t imm = MCOperand_getImm(Op);
834
+ uint8_t opsize = X86_immediate_size(MCInst_getOpcode(MI), &encsize);
835
+
836
+ if (opsize == 1) // print 1 byte immediate in positive form
837
+ imm = imm & 0xff;
838
+
839
+ // printf(">>> id = %u\n", MI->flat_insn->id);
840
+ switch(MI->flat_insn->id) {
841
+ default:
842
+ printImm(MI, O, imm, MI->csh->imm_unsigned);
843
+ break;
844
+
845
+ case X86_INS_MOVABS:
846
+ case X86_INS_MOV:
847
+ // do not print number in negative form
848
+ printImm(MI, O, imm, true);
849
+ break;
850
+
851
+ case X86_INS_IN:
852
+ case X86_INS_OUT:
853
+ case X86_INS_INT:
854
+ // do not print number in negative form
855
+ imm = imm & 0xff;
856
+ printImm(MI, O, imm, true);
857
+ break;
858
+
859
+ case X86_INS_LCALL:
860
+ case X86_INS_LJMP:
861
+ case X86_INS_JMP:
862
+ // always print address in positive form
863
+ if (OpNo == 1) { // ptr16 part
864
+ imm = imm & 0xffff;
865
+ opsize = 2;
866
+ } else
867
+ opsize = 4;
868
+ printImm(MI, O, imm, true);
869
+ break;
870
+
871
+ case X86_INS_AND:
872
+ case X86_INS_OR:
873
+ case X86_INS_XOR:
874
+ // do not print number in negative form
875
+ if (imm >= 0 && imm <= HEX_THRESHOLD)
876
+ printImm(MI, O, imm, true);
877
+ else {
878
+ imm = arch_masks[opsize? opsize : MI->imm_size] & imm;
879
+ printImm(MI, O, imm, true);
880
+ }
881
+ break;
882
+
883
+ case X86_INS_RET:
884
+ case X86_INS_RETF:
885
+ // RET imm16
886
+ if (imm >= 0 && imm <= HEX_THRESHOLD)
887
+ printImm(MI, O, imm, true);
888
+ else {
889
+ imm = 0xffff & imm;
890
+ printImm(MI, O, imm, true);
891
+ }
892
+ break;
893
+ }
894
+
895
+ if (MI->csh->detail) {
896
+ if (MI->csh->doing_mem) {
897
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.disp = imm;
898
+ } else {
899
+ #ifndef CAPSTONE_DIET
900
+ uint8_t access[6];
901
+ #endif
902
+
903
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].type = X86_OP_IMM;
904
+ if (opsize > 0) {
905
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = opsize;
906
+ MI->flat_insn->detail->x86.encoding.imm_size = encsize;
907
+ } else if (MI->flat_insn->detail->x86.op_count > 0) {
908
+ if (MI->flat_insn->id != X86_INS_LCALL && MI->flat_insn->id != X86_INS_LJMP) {
909
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size =
910
+ MI->flat_insn->detail->x86.operands[0].size;
911
+ } else
912
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = MI->imm_size;
913
+ } else
914
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = MI->imm_size;
915
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].imm = imm;
916
+
917
+ #ifndef CAPSTONE_DIET
918
+ get_op_access(MI->csh, MCInst_getOpcode(MI), access, &MI->flat_insn->detail->x86.eflags);
919
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].access = access[MI->flat_insn->detail->x86.op_count];
920
+ #endif
921
+
922
+ MI->flat_insn->detail->x86.op_count++;
923
+ }
924
+ }
925
+ }
926
+ }
927
+
928
+ static void printMemReference(MCInst *MI, unsigned Op, SStream *O)
929
+ {
930
+ bool NeedPlus = false;
931
+ MCOperand *BaseReg = MCInst_getOperand(MI, Op + X86_AddrBaseReg);
932
+ uint64_t ScaleVal = MCOperand_getImm(MCInst_getOperand(MI, Op + X86_AddrScaleAmt));
933
+ MCOperand *IndexReg = MCInst_getOperand(MI, Op + X86_AddrIndexReg);
934
+ MCOperand *DispSpec = MCInst_getOperand(MI, Op + X86_AddrDisp);
935
+ MCOperand *SegReg = MCInst_getOperand(MI, Op + X86_AddrSegmentReg);
936
+ int reg;
937
+
938
+ if (MI->csh->detail) {
939
+ #ifndef CAPSTONE_DIET
940
+ uint8_t access[6];
941
+ #endif
942
+
943
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].type = X86_OP_MEM;
944
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = MI->x86opsize;
945
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.segment = X86_REG_INVALID;
946
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.base = X86_register_map(MCOperand_getReg(BaseReg));
947
+ if (MCOperand_getReg(IndexReg) != X86_EIZ) {
948
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.index = X86_register_map(MCOperand_getReg(IndexReg));
949
+ }
950
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.scale = (int)ScaleVal;
951
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.disp = 0;
952
+
953
+ #ifndef CAPSTONE_DIET
954
+ get_op_access(MI->csh, MCInst_getOpcode(MI), access, &MI->flat_insn->detail->x86.eflags);
955
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].access = access[MI->flat_insn->detail->x86.op_count];
956
+ #endif
957
+ }
958
+
959
+ // If this has a segment register, print it.
960
+ reg = MCOperand_getReg(SegReg);
961
+ if (reg) {
962
+ _printOperand(MI, Op + X86_AddrSegmentReg, O);
963
+ if (MI->csh->detail) {
964
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.segment = X86_register_map(reg);
965
+ }
966
+ SStream_concat0(O, ":");
967
+ }
968
+
969
+ SStream_concat0(O, "[");
970
+
971
+ if (MCOperand_getReg(BaseReg)) {
972
+ _printOperand(MI, Op + X86_AddrBaseReg, O);
973
+ NeedPlus = true;
974
+ }
975
+
976
+ if (MCOperand_getReg(IndexReg) && MCOperand_getReg(IndexReg) != X86_EIZ) {
977
+ if (NeedPlus) SStream_concat0(O, " + ");
978
+ _printOperand(MI, Op + X86_AddrIndexReg, O);
979
+ if (ScaleVal != 1)
980
+ SStream_concat(O, "*%u", ScaleVal);
981
+ NeedPlus = true;
982
+ }
983
+
984
+ if (MCOperand_isImm(DispSpec)) {
985
+ int64_t DispVal = MCOperand_getImm(DispSpec);
986
+ if (MI->csh->detail)
987
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.disp = DispVal;
988
+ if (DispVal) {
989
+ if (NeedPlus) {
990
+ if (DispVal < 0) {
991
+ SStream_concat0(O, " - ");
992
+ printImm(MI, O, -DispVal, true);
993
+ } else {
994
+ SStream_concat0(O, " + ");
995
+ printImm(MI, O, DispVal, true);
996
+ }
997
+ } else {
998
+ // memory reference to an immediate address
999
+ if (MI->csh->mode == CS_MODE_64)
1000
+ MI->op1_size = 8;
1001
+ if (DispVal < 0) {
1002
+ printImm(MI, O, arch_masks[MI->csh->mode] & DispVal, true);
1003
+ } else {
1004
+ printImm(MI, O, DispVal, true);
1005
+ }
1006
+ }
1007
+
1008
+ } else {
1009
+ // DispVal = 0
1010
+ if (!NeedPlus) // [0]
1011
+ SStream_concat0(O, "0");
1012
+ }
1013
+ }
1014
+
1015
+ SStream_concat0(O, "]");
1016
+
1017
+ if (MI->csh->detail)
1018
+ MI->flat_insn->detail->x86.op_count++;
1019
+
1020
+ if (MI->op1_size == 0)
1021
+ MI->op1_size = MI->x86opsize;
1022
+ }
1023
+
1024
+ static void printanymem(MCInst *MI, unsigned OpNo, SStream *O)
1025
+ {
1026
+ switch(MI->Opcode) {
1027
+ default: break;
1028
+ case X86_LEA16r:
1029
+ MI->x86opsize = 2;
1030
+ break;
1031
+ case X86_LEA32r:
1032
+ case X86_LEA64_32r:
1033
+ MI->x86opsize = 4;
1034
+ break;
1035
+ case X86_LEA64r:
1036
+ MI->x86opsize = 8;
1037
+ break;
1038
+ case X86_BNDCL32rm:
1039
+ case X86_BNDCN32rm:
1040
+ case X86_BNDCU32rm:
1041
+ case X86_BNDSTXmr:
1042
+ case X86_BNDLDXrm:
1043
+ case X86_BNDCL64rm:
1044
+ case X86_BNDCN64rm:
1045
+ case X86_BNDCU64rm:
1046
+ MI->x86opsize = 16;
1047
+ break;
1048
+ }
1049
+
1050
+ printMemReference(MI, OpNo, O);
1051
+ }
1052
+
1053
+ #ifdef CAPSTONE_X86_REDUCE
1054
+ #include "X86GenAsmWriter1_reduce.inc"
1055
+ #else
1056
+ #include "X86GenAsmWriter1.inc"
1057
+ #endif
1058
+
1059
+ #include "X86GenRegisterName1.inc"
1060
+
1061
+ #endif