crabstone 3.0.3 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (347) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES.md +45 -42
  3. data/README.md +16 -33
  4. data/lib/crabstone.rb +5 -557
  5. data/lib/crabstone/arch.rb +37 -0
  6. data/lib/{arch → crabstone/arch/3}/arm.rb +28 -49
  7. data/lib/crabstone/arch/3/arm64.rb +124 -0
  8. data/lib/{arch → crabstone/arch/3}/arm64_const.rb +45 -86
  9. data/lib/{arch → crabstone/arch/3}/arm_const.rb +19 -47
  10. data/lib/crabstone/arch/3/mips.rb +57 -0
  11. data/lib/{arch → crabstone/arch/3}/mips_const.rb +18 -38
  12. data/lib/crabstone/arch/3/ppc.rb +73 -0
  13. data/lib/{arch → crabstone/arch/3}/ppc_const.rb +27 -43
  14. data/lib/crabstone/arch/3/sparc.rb +60 -0
  15. data/lib/{arch → crabstone/arch/3}/sparc_const.rb +49 -67
  16. data/lib/crabstone/arch/3/sysz.rb +67 -0
  17. data/lib/{arch → crabstone/arch/3}/sysz_const.rb +11 -25
  18. data/lib/crabstone/arch/3/x86.rb +82 -0
  19. data/lib/{arch → crabstone/arch/3}/x86_const.rb +15 -36
  20. data/lib/crabstone/arch/3/xcore.rb +59 -0
  21. data/lib/{arch → crabstone/arch/3}/xcore_const.rb +10 -22
  22. data/lib/crabstone/arch/4/arm.rb +110 -0
  23. data/lib/crabstone/arch/4/arm64.rb +125 -0
  24. data/lib/crabstone/arch/4/arm64_const.rb +1016 -0
  25. data/lib/crabstone/arch/4/arm_const.rb +785 -0
  26. data/lib/crabstone/arch/4/evm.rb +20 -0
  27. data/lib/crabstone/arch/4/evm_const.rb +161 -0
  28. data/lib/crabstone/arch/4/m680x.rb +106 -0
  29. data/lib/crabstone/arch/4/m680x_const.rb +426 -0
  30. data/lib/crabstone/arch/4/m68k.rb +129 -0
  31. data/lib/crabstone/arch/4/m68k_const.rb +496 -0
  32. data/lib/crabstone/arch/4/mips.rb +57 -0
  33. data/lib/crabstone/arch/4/mips_const.rb +869 -0
  34. data/lib/crabstone/arch/4/ppc.rb +73 -0
  35. data/lib/crabstone/arch/4/ppc_const.rb +1375 -0
  36. data/lib/crabstone/arch/4/sparc.rb +60 -0
  37. data/lib/crabstone/arch/4/sparc_const.rb +439 -0
  38. data/lib/crabstone/arch/4/sysz.rb +67 -0
  39. data/lib/crabstone/arch/4/sysz_const.rb +763 -0
  40. data/lib/crabstone/arch/4/tms320c64x.rb +87 -0
  41. data/lib/crabstone/arch/4/tms320c64x_const.rb +287 -0
  42. data/lib/crabstone/arch/4/x86.rb +91 -0
  43. data/lib/crabstone/arch/4/x86_const.rb +1972 -0
  44. data/lib/crabstone/arch/4/xcore.rb +59 -0
  45. data/lib/crabstone/arch/4/xcore_const.rb +171 -0
  46. data/lib/crabstone/arch/extension.rb +27 -0
  47. data/lib/crabstone/arch/register.rb +36 -0
  48. data/lib/crabstone/binding.rb +60 -0
  49. data/lib/crabstone/binding/3/detail.rb +36 -0
  50. data/lib/crabstone/binding/3/instruction.rb +23 -0
  51. data/lib/crabstone/binding/4/detail.rb +40 -0
  52. data/lib/crabstone/binding/4/instruction.rb +23 -0
  53. data/lib/crabstone/binding/structs.rb +32 -0
  54. data/lib/crabstone/constants.rb +110 -0
  55. data/lib/crabstone/cs_version.rb +49 -0
  56. data/lib/crabstone/disassembler.rb +153 -0
  57. data/lib/crabstone/error.rb +60 -0
  58. data/lib/crabstone/instruction.rb +183 -0
  59. data/lib/crabstone/version.rb +5 -0
  60. metadata +128 -324
  61. data/MANIFEST +0 -312
  62. data/Rakefile +0 -27
  63. data/bin/genconst +0 -66
  64. data/bin/genreg +0 -99
  65. data/crabstone.gemspec +0 -27
  66. data/examples/hello_world.rb +0 -43
  67. data/lib/arch/arm64.rb +0 -167
  68. data/lib/arch/arm64_registers.rb +0 -295
  69. data/lib/arch/arm_registers.rb +0 -149
  70. data/lib/arch/mips.rb +0 -78
  71. data/lib/arch/mips_registers.rb +0 -208
  72. data/lib/arch/ppc.rb +0 -90
  73. data/lib/arch/ppc_registers.rb +0 -209
  74. data/lib/arch/sparc.rb +0 -79
  75. data/lib/arch/sparc_registers.rb +0 -121
  76. data/lib/arch/systemz.rb +0 -79
  77. data/lib/arch/sysz_registers.rb +0 -66
  78. data/lib/arch/x86.rb +0 -107
  79. data/lib/arch/x86_registers.rb +0 -265
  80. data/lib/arch/xcore.rb +0 -78
  81. data/lib/arch/xcore_registers.rb +0 -57
  82. data/test/MC/AArch64/basic-a64-instructions.s.cs +0 -2014
  83. data/test/MC/AArch64/gicv3-regs.s.cs +0 -111
  84. data/test/MC/AArch64/neon-2velem.s.cs +0 -113
  85. data/test/MC/AArch64/neon-3vdiff.s.cs +0 -143
  86. data/test/MC/AArch64/neon-aba-abd.s.cs +0 -28
  87. data/test/MC/AArch64/neon-across.s.cs +0 -40
  88. data/test/MC/AArch64/neon-add-pairwise.s.cs +0 -11
  89. data/test/MC/AArch64/neon-add-sub-instructions.s.cs +0 -21
  90. data/test/MC/AArch64/neon-bitwise-instructions.s.cs +0 -17
  91. data/test/MC/AArch64/neon-compare-instructions.s.cs +0 -136
  92. data/test/MC/AArch64/neon-crypto.s.cs +0 -15
  93. data/test/MC/AArch64/neon-extract.s.cs +0 -3
  94. data/test/MC/AArch64/neon-facge-facgt.s.cs +0 -13
  95. data/test/MC/AArch64/neon-frsqrt-frecp.s.cs +0 -7
  96. data/test/MC/AArch64/neon-halving-add-sub.s.cs +0 -25
  97. data/test/MC/AArch64/neon-max-min-pairwise.s.cs +0 -37
  98. data/test/MC/AArch64/neon-max-min.s.cs +0 -37
  99. data/test/MC/AArch64/neon-mla-mls-instructions.s.cs +0 -19
  100. data/test/MC/AArch64/neon-mov.s.cs +0 -74
  101. data/test/MC/AArch64/neon-mul-div-instructions.s.cs +0 -24
  102. data/test/MC/AArch64/neon-perm.s.cs +0 -43
  103. data/test/MC/AArch64/neon-rounding-halving-add.s.cs +0 -13
  104. data/test/MC/AArch64/neon-rounding-shift.s.cs +0 -15
  105. data/test/MC/AArch64/neon-saturating-add-sub.s.cs +0 -29
  106. data/test/MC/AArch64/neon-saturating-rounding-shift.s.cs +0 -15
  107. data/test/MC/AArch64/neon-saturating-shift.s.cs +0 -15
  108. data/test/MC/AArch64/neon-scalar-abs.s.cs +0 -8
  109. data/test/MC/AArch64/neon-scalar-add-sub.s.cs +0 -3
  110. data/test/MC/AArch64/neon-scalar-by-elem-mla.s.cs +0 -13
  111. data/test/MC/AArch64/neon-scalar-by-elem-mul.s.cs +0 -13
  112. data/test/MC/AArch64/neon-scalar-by-elem-saturating-mla.s.cs +0 -15
  113. data/test/MC/AArch64/neon-scalar-by-elem-saturating-mul.s.cs +0 -18
  114. data/test/MC/AArch64/neon-scalar-compare.s.cs +0 -12
  115. data/test/MC/AArch64/neon-scalar-cvt.s.cs +0 -34
  116. data/test/MC/AArch64/neon-scalar-dup.s.cs +0 -23
  117. data/test/MC/AArch64/neon-scalar-extract-narrow.s.cs +0 -10
  118. data/test/MC/AArch64/neon-scalar-fp-compare.s.cs +0 -21
  119. data/test/MC/AArch64/neon-scalar-mul.s.cs +0 -13
  120. data/test/MC/AArch64/neon-scalar-neg.s.cs +0 -6
  121. data/test/MC/AArch64/neon-scalar-recip.s.cs +0 -11
  122. data/test/MC/AArch64/neon-scalar-reduce-pairwise.s.cs +0 -3
  123. data/test/MC/AArch64/neon-scalar-rounding-shift.s.cs +0 -3
  124. data/test/MC/AArch64/neon-scalar-saturating-add-sub.s.cs +0 -25
  125. data/test/MC/AArch64/neon-scalar-saturating-rounding-shift.s.cs +0 -9
  126. data/test/MC/AArch64/neon-scalar-saturating-shift.s.cs +0 -9
  127. data/test/MC/AArch64/neon-scalar-shift-imm.s.cs +0 -42
  128. data/test/MC/AArch64/neon-scalar-shift.s.cs +0 -3
  129. data/test/MC/AArch64/neon-shift-left-long.s.cs +0 -13
  130. data/test/MC/AArch64/neon-shift.s.cs +0 -22
  131. data/test/MC/AArch64/neon-simd-copy.s.cs +0 -42
  132. data/test/MC/AArch64/neon-simd-ldst-multi-elem.s.cs +0 -197
  133. data/test/MC/AArch64/neon-simd-ldst-one-elem.s.cs +0 -129
  134. data/test/MC/AArch64/neon-simd-misc.s.cs +0 -213
  135. data/test/MC/AArch64/neon-simd-post-ldst-multi-elem.s.cs +0 -107
  136. data/test/MC/AArch64/neon-simd-shift.s.cs +0 -151
  137. data/test/MC/AArch64/neon-tbl.s.cs +0 -21
  138. data/test/MC/AArch64/trace-regs.s.cs +0 -383
  139. data/test/MC/ARM/arm-aliases.s.cs +0 -7
  140. data/test/MC/ARM/arm-arithmetic-aliases.s.cs +0 -50
  141. data/test/MC/ARM/arm-it-block.s.cs +0 -2
  142. data/test/MC/ARM/arm-memory-instructions.s.cs +0 -138
  143. data/test/MC/ARM/arm-shift-encoding.s.cs +0 -50
  144. data/test/MC/ARM/arm-thumb-trustzone.s.cs +0 -3
  145. data/test/MC/ARM/arm-trustzone.s.cs +0 -3
  146. data/test/MC/ARM/arm_addrmode2.s.cs +0 -15
  147. data/test/MC/ARM/arm_addrmode3.s.cs +0 -9
  148. data/test/MC/ARM/arm_instructions.s.cs +0 -25
  149. data/test/MC/ARM/basic-arm-instructions-v8.s.cs +0 -10
  150. data/test/MC/ARM/basic-arm-instructions.s.cs +0 -997
  151. data/test/MC/ARM/basic-thumb-instructions.s.cs +0 -130
  152. data/test/MC/ARM/basic-thumb2-instructions-v8.s.cs +0 -1
  153. data/test/MC/ARM/basic-thumb2-instructions.s.cs +0 -1242
  154. data/test/MC/ARM/crc32-thumb.s.cs +0 -7
  155. data/test/MC/ARM/crc32.s.cs +0 -7
  156. data/test/MC/ARM/dot-req.s.cs +0 -3
  157. data/test/MC/ARM/fp-armv8.s.cs +0 -52
  158. data/test/MC/ARM/idiv-thumb.s.cs +0 -3
  159. data/test/MC/ARM/idiv.s.cs +0 -3
  160. data/test/MC/ARM/load-store-acquire-release-v8-thumb.s.cs +0 -15
  161. data/test/MC/ARM/load-store-acquire-release-v8.s.cs +0 -15
  162. data/test/MC/ARM/mode-switch.s.cs +0 -7
  163. data/test/MC/ARM/neon-abs-encoding.s.cs +0 -15
  164. data/test/MC/ARM/neon-absdiff-encoding.s.cs +0 -39
  165. data/test/MC/ARM/neon-add-encoding.s.cs +0 -119
  166. data/test/MC/ARM/neon-bitcount-encoding.s.cs +0 -15
  167. data/test/MC/ARM/neon-bitwise-encoding.s.cs +0 -126
  168. data/test/MC/ARM/neon-cmp-encoding.s.cs +0 -88
  169. data/test/MC/ARM/neon-convert-encoding.s.cs +0 -27
  170. data/test/MC/ARM/neon-crypto.s.cs +0 -16
  171. data/test/MC/ARM/neon-dup-encoding.s.cs +0 -13
  172. data/test/MC/ARM/neon-minmax-encoding.s.cs +0 -57
  173. data/test/MC/ARM/neon-mov-encoding.s.cs +0 -76
  174. data/test/MC/ARM/neon-mul-accum-encoding.s.cs +0 -39
  175. data/test/MC/ARM/neon-mul-encoding.s.cs +0 -72
  176. data/test/MC/ARM/neon-neg-encoding.s.cs +0 -15
  177. data/test/MC/ARM/neon-pairwise-encoding.s.cs +0 -47
  178. data/test/MC/ARM/neon-reciprocal-encoding.s.cs +0 -13
  179. data/test/MC/ARM/neon-reverse-encoding.s.cs +0 -13
  180. data/test/MC/ARM/neon-satshift-encoding.s.cs +0 -75
  181. data/test/MC/ARM/neon-shift-encoding.s.cs +0 -238
  182. data/test/MC/ARM/neon-shiftaccum-encoding.s.cs +0 -97
  183. data/test/MC/ARM/neon-shuffle-encoding.s.cs +0 -59
  184. data/test/MC/ARM/neon-sub-encoding.s.cs +0 -82
  185. data/test/MC/ARM/neon-table-encoding.s.cs +0 -9
  186. data/test/MC/ARM/neon-v8.s.cs +0 -38
  187. data/test/MC/ARM/neon-vld-encoding.s.cs +0 -213
  188. data/test/MC/ARM/neon-vst-encoding.s.cs +0 -120
  189. data/test/MC/ARM/neon-vswp.s.cs +0 -3
  190. data/test/MC/ARM/neont2-abs-encoding.s.cs +0 -15
  191. data/test/MC/ARM/neont2-absdiff-encoding.s.cs +0 -39
  192. data/test/MC/ARM/neont2-add-encoding.s.cs +0 -65
  193. data/test/MC/ARM/neont2-bitcount-encoding.s.cs +0 -15
  194. data/test/MC/ARM/neont2-bitwise-encoding.s.cs +0 -15
  195. data/test/MC/ARM/neont2-cmp-encoding.s.cs +0 -17
  196. data/test/MC/ARM/neont2-convert-encoding.s.cs +0 -19
  197. data/test/MC/ARM/neont2-dup-encoding.s.cs +0 -19
  198. data/test/MC/ARM/neont2-minmax-encoding.s.cs +0 -57
  199. data/test/MC/ARM/neont2-mov-encoding.s.cs +0 -58
  200. data/test/MC/ARM/neont2-mul-accum-encoding.s.cs +0 -41
  201. data/test/MC/ARM/neont2-mul-encoding.s.cs +0 -31
  202. data/test/MC/ARM/neont2-neg-encoding.s.cs +0 -15
  203. data/test/MC/ARM/neont2-pairwise-encoding.s.cs +0 -43
  204. data/test/MC/ARM/neont2-reciprocal-encoding.s.cs +0 -13
  205. data/test/MC/ARM/neont2-reverse-encoding.s.cs +0 -13
  206. data/test/MC/ARM/neont2-satshift-encoding.s.cs +0 -75
  207. data/test/MC/ARM/neont2-shift-encoding.s.cs +0 -80
  208. data/test/MC/ARM/neont2-shiftaccum-encoding.s.cs +0 -97
  209. data/test/MC/ARM/neont2-shuffle-encoding.s.cs +0 -23
  210. data/test/MC/ARM/neont2-sub-encoding.s.cs +0 -23
  211. data/test/MC/ARM/neont2-table-encoding.s.cs +0 -9
  212. data/test/MC/ARM/neont2-vld-encoding.s.cs +0 -51
  213. data/test/MC/ARM/neont2-vst-encoding.s.cs +0 -48
  214. data/test/MC/ARM/simple-fp-encoding.s.cs +0 -157
  215. data/test/MC/ARM/thumb-fp-armv8.s.cs +0 -51
  216. data/test/MC/ARM/thumb-hints.s.cs +0 -12
  217. data/test/MC/ARM/thumb-neon-crypto.s.cs +0 -16
  218. data/test/MC/ARM/thumb-neon-v8.s.cs +0 -38
  219. data/test/MC/ARM/thumb-shift-encoding.s.cs +0 -19
  220. data/test/MC/ARM/thumb.s.cs +0 -19
  221. data/test/MC/ARM/thumb2-b.w-encodingT4.s.cs +0 -2
  222. data/test/MC/ARM/thumb2-branches.s.cs +0 -85
  223. data/test/MC/ARM/thumb2-mclass.s.cs +0 -41
  224. data/test/MC/ARM/thumb2-narrow-dp.ll.cs +0 -379
  225. data/test/MC/ARM/thumb2-pldw.s.cs +0 -2
  226. data/test/MC/ARM/vfp4-thumb.s.cs +0 -13
  227. data/test/MC/ARM/vfp4.s.cs +0 -13
  228. data/test/MC/ARM/vpush-vpop-thumb.s.cs +0 -9
  229. data/test/MC/ARM/vpush-vpop.s.cs +0 -9
  230. data/test/MC/Mips/hilo-addressing.s.cs +0 -4
  231. data/test/MC/Mips/micromips-alu-instructions-EB.s.cs +0 -33
  232. data/test/MC/Mips/micromips-alu-instructions.s.cs +0 -33
  233. data/test/MC/Mips/micromips-branch-instructions-EB.s.cs +0 -11
  234. data/test/MC/Mips/micromips-branch-instructions.s.cs +0 -11
  235. data/test/MC/Mips/micromips-expansions.s.cs +0 -20
  236. data/test/MC/Mips/micromips-jump-instructions-EB.s.cs +0 -5
  237. data/test/MC/Mips/micromips-jump-instructions.s.cs +0 -6
  238. data/test/MC/Mips/micromips-loadstore-instructions-EB.s.cs +0 -9
  239. data/test/MC/Mips/micromips-loadstore-instructions.s.cs +0 -9
  240. data/test/MC/Mips/micromips-loadstore-unaligned-EB.s.cs +0 -5
  241. data/test/MC/Mips/micromips-loadstore-unaligned.s.cs +0 -5
  242. data/test/MC/Mips/micromips-movcond-instructions-EB.s.cs +0 -5
  243. data/test/MC/Mips/micromips-movcond-instructions.s.cs +0 -5
  244. data/test/MC/Mips/micromips-multiply-instructions-EB.s.cs +0 -5
  245. data/test/MC/Mips/micromips-multiply-instructions.s.cs +0 -5
  246. data/test/MC/Mips/micromips-shift-instructions-EB.s.cs +0 -9
  247. data/test/MC/Mips/micromips-shift-instructions.s.cs +0 -9
  248. data/test/MC/Mips/micromips-trap-instructions-EB.s.cs +0 -13
  249. data/test/MC/Mips/micromips-trap-instructions.s.cs +0 -13
  250. data/test/MC/Mips/mips-alu-instructions.s.cs +0 -53
  251. data/test/MC/Mips/mips-control-instructions-64.s.cs +0 -33
  252. data/test/MC/Mips/mips-control-instructions.s.cs +0 -33
  253. data/test/MC/Mips/mips-coprocessor-encodings.s.cs +0 -17
  254. data/test/MC/Mips/mips-dsp-instructions.s.cs +0 -43
  255. data/test/MC/Mips/mips-expansions.s.cs +0 -20
  256. data/test/MC/Mips/mips-fpu-instructions.s.cs +0 -93
  257. data/test/MC/Mips/mips-jump-instructions.s.cs +0 -1
  258. data/test/MC/Mips/mips-memory-instructions.s.cs +0 -17
  259. data/test/MC/Mips/mips-register-names.s.cs +0 -33
  260. data/test/MC/Mips/mips64-alu-instructions.s.cs +0 -47
  261. data/test/MC/Mips/mips64-instructions.s.cs +0 -3
  262. data/test/MC/Mips/mips64-register-names.s.cs +0 -33
  263. data/test/MC/Mips/mips_directives.s.cs +0 -12
  264. data/test/MC/Mips/nabi-regs.s.cs +0 -12
  265. data/test/MC/Mips/set-at-directive.s.cs +0 -6
  266. data/test/MC/Mips/test_2r.s.cs +0 -16
  267. data/test/MC/Mips/test_2rf.s.cs +0 -33
  268. data/test/MC/Mips/test_3r.s.cs +0 -243
  269. data/test/MC/Mips/test_3rf.s.cs +0 -83
  270. data/test/MC/Mips/test_bit.s.cs +0 -49
  271. data/test/MC/Mips/test_cbranch.s.cs +0 -11
  272. data/test/MC/Mips/test_ctrlregs.s.cs +0 -33
  273. data/test/MC/Mips/test_elm.s.cs +0 -16
  274. data/test/MC/Mips/test_elm_insert.s.cs +0 -4
  275. data/test/MC/Mips/test_elm_insve.s.cs +0 -5
  276. data/test/MC/Mips/test_i10.s.cs +0 -5
  277. data/test/MC/Mips/test_i5.s.cs +0 -45
  278. data/test/MC/Mips/test_i8.s.cs +0 -11
  279. data/test/MC/Mips/test_lsa.s.cs +0 -5
  280. data/test/MC/Mips/test_mi10.s.cs +0 -24
  281. data/test/MC/Mips/test_vec.s.cs +0 -8
  282. data/test/MC/PowerPC/ppc64-encoding-bookII.s.cs +0 -25
  283. data/test/MC/PowerPC/ppc64-encoding-bookIII.s.cs +0 -35
  284. data/test/MC/PowerPC/ppc64-encoding-ext.s.cs +0 -535
  285. data/test/MC/PowerPC/ppc64-encoding-fp.s.cs +0 -110
  286. data/test/MC/PowerPC/ppc64-encoding-vmx.s.cs +0 -170
  287. data/test/MC/PowerPC/ppc64-encoding.s.cs +0 -202
  288. data/test/MC/PowerPC/ppc64-operands.s.cs +0 -32
  289. data/test/MC/README +0 -6
  290. data/test/MC/Sparc/sparc-alu-instructions.s.cs +0 -47
  291. data/test/MC/Sparc/sparc-atomic-instructions.s.cs +0 -7
  292. data/test/MC/Sparc/sparc-ctrl-instructions.s.cs +0 -11
  293. data/test/MC/Sparc/sparc-fp-instructions.s.cs +0 -59
  294. data/test/MC/Sparc/sparc-mem-instructions.s.cs +0 -25
  295. data/test/MC/Sparc/sparc-vis.s.cs +0 -2
  296. data/test/MC/Sparc/sparc64-alu-instructions.s.cs +0 -13
  297. data/test/MC/Sparc/sparc64-ctrl-instructions.s.cs +0 -102
  298. data/test/MC/Sparc/sparcv8-instructions.s.cs +0 -7
  299. data/test/MC/Sparc/sparcv9-instructions.s.cs +0 -1
  300. data/test/MC/SystemZ/insn-good-z196.s.cs +0 -589
  301. data/test/MC/SystemZ/insn-good.s.cs +0 -2265
  302. data/test/MC/SystemZ/regs-good.s.cs +0 -45
  303. data/test/MC/X86/3DNow.s.cs +0 -29
  304. data/test/MC/X86/address-size.s.cs +0 -5
  305. data/test/MC/X86/avx512-encodings.s.cs +0 -12
  306. data/test/MC/X86/intel-syntax-encoding.s.cs +0 -30
  307. data/test/MC/X86/x86-32-avx.s.cs +0 -833
  308. data/test/MC/X86/x86-32-fma3.s.cs +0 -169
  309. data/test/MC/X86/x86-32-ms-inline-asm.s.cs +0 -27
  310. data/test/MC/X86/x86_64-avx-clmul-encoding.s.cs +0 -11
  311. data/test/MC/X86/x86_64-avx-encoding.s.cs +0 -1058
  312. data/test/MC/X86/x86_64-bmi-encoding.s.cs +0 -51
  313. data/test/MC/X86/x86_64-encoding.s.cs +0 -59
  314. data/test/MC/X86/x86_64-fma3-encoding.s.cs +0 -169
  315. data/test/MC/X86/x86_64-fma4-encoding.s.cs +0 -98
  316. data/test/MC/X86/x86_64-hle-encoding.s.cs +0 -3
  317. data/test/MC/X86/x86_64-imm-widths.s.cs +0 -27
  318. data/test/MC/X86/x86_64-rand-encoding.s.cs +0 -13
  319. data/test/MC/X86/x86_64-rtm-encoding.s.cs +0 -4
  320. data/test/MC/X86/x86_64-sse4a.s.cs +0 -1
  321. data/test/MC/X86/x86_64-tbm-encoding.s.cs +0 -40
  322. data/test/MC/X86/x86_64-xop-encoding.s.cs +0 -152
  323. data/test/README +0 -6
  324. data/test/test.rb +0 -205
  325. data/test/test.rb.SPEC +0 -235
  326. data/test/test_arm.rb +0 -202
  327. data/test/test_arm.rb.SPEC +0 -275
  328. data/test/test_arm64.rb +0 -150
  329. data/test/test_arm64.rb.SPEC +0 -116
  330. data/test/test_detail.rb +0 -228
  331. data/test/test_detail.rb.SPEC +0 -322
  332. data/test/test_exhaustive.rb +0 -80
  333. data/test/test_mips.rb +0 -118
  334. data/test/test_mips.rb.SPEC +0 -91
  335. data/test/test_ppc.rb +0 -137
  336. data/test/test_ppc.rb.SPEC +0 -84
  337. data/test/test_sanity.rb +0 -83
  338. data/test/test_skipdata.rb +0 -111
  339. data/test/test_skipdata.rb.SPEC +0 -58
  340. data/test/test_sparc.rb +0 -113
  341. data/test/test_sparc.rb.SPEC +0 -116
  342. data/test/test_sysz.rb +0 -111
  343. data/test/test_sysz.rb.SPEC +0 -61
  344. data/test/test_x86.rb +0 -189
  345. data/test/test_x86.rb.SPEC +0 -579
  346. data/test/test_xcore.rb +0 -100
  347. data/test/test_xcore.rb.SPEC +0 -75
@@ -1,27 +0,0 @@
1
- require 'rubygems'
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = 'crabstone'
5
- spec.version = '3.0.3'
6
- spec.author = 'Ben Nagy'
7
- spec.license = 'BSD'
8
- spec.email = 'crabstone@ben.iagu.net'
9
- spec.homepage = 'https://github.com/bnagy/crabstone'
10
- spec.summary = 'Ruby FFI bindings for the capstone disassembly engine'
11
- spec.test_files = Dir['test/*.rb']
12
- spec.files = Dir['**/*'].delete_if{ |item| item.include?('git') }
13
-
14
- spec.extra_rdoc_files = ['CHANGES.md', 'README.md', 'MANIFEST']
15
-
16
- spec.add_runtime_dependency 'ffi' unless RUBY_PLATFORM =~/java/
17
- spec.add_development_dependency 'test-unit'
18
-
19
- spec.description = <<-EOF
20
-
21
- Capstone is a disassembly engine written by Nguyen Anh Quynh, available here
22
- https://github.com/aquynh/capstone. This is the Ruby FFI binding. We test
23
- against MRI 2.0.0, 2.1.0 and JRuby 1.7.8. AFAIK it works with rubinius
24
- 2.2.1.
25
-
26
- EOF
27
- end
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # Library by Nguyen Anh Quynh
4
- # Original binding by Nguyen Anh Quynh and Tan Sheng Di
5
- # Additional binding work by Ben Nagy
6
- # (c) 2013 COSEINC. All Rights Reserved.
7
-
8
- require 'crabstone'
9
- include Crabstone
10
-
11
- arm = (
12
- "\xED\xFF\xFF\xEB\x04\xe0\x2d\xe5\x00\x00\x00\x00\xe0\x83\x22" <<
13
- "\xe5\xf1\x02\x03\x0e\x00\x00\xa0\xe3\x02\x30\xc1\xe7\x00\x00\x53\xe3"
14
- )
15
-
16
- begin
17
-
18
- cs = Disassembler.new(ARCH_ARM, MODE_ARM)
19
- puts "Hello from Capstone v #{cs.version.join('.')}!"
20
- puts "Disasm:"
21
-
22
- begin
23
- cs.decomposer = true
24
-
25
- # disasm is an array of Crabstone::Instruction objects
26
- disasm = cs.disasm(arm, 0x1000)
27
-
28
- disasm.each {|i|
29
- printf("0x%x:\t%s\t\t%s\n",i.address, i.mnemonic, i.op_str)
30
- }
31
-
32
- disasm = cs.disasm(arm, 0x1000)
33
- puts disasm.map {|i| "0x%x:\t%s\t\t%s\n" % [i.address, i.mnemonic, i.op_str]}
34
-
35
- rescue
36
- fail "Disassembly error: #{$!} #{$@}"
37
- ensure
38
- cs.close
39
- end
40
-
41
- rescue
42
- fail "Unable to open engine: #{$!}"
43
- end
@@ -1,167 +0,0 @@
1
- # Library by Nguyen Anh Quynh
2
- # Original binding by Nguyen Anh Quynh and Tan Sheng Di
3
- # Additional binding work by Ben Nagy
4
- # (c) 2013 COSEINC. All Rights Reserved.
5
-
6
- require 'ffi'
7
-
8
- require_relative 'arm64_const'
9
-
10
- module Crabstone
11
- module ARM64
12
-
13
-
14
- class OperandShift < FFI::Struct
15
- layout(
16
- :type, :uint,
17
- :value, :uint
18
- )
19
- end
20
-
21
- class MemoryOperand < FFI::Struct
22
- layout(
23
- :base, :uint,
24
- :index, :uint,
25
- :disp, :int32
26
- )
27
- end
28
-
29
- class OperandValue < FFI::Union
30
- layout(
31
- :reg, :uint,
32
- :imm, :int64,
33
- :fp, :double,
34
- :mem, MemoryOperand,
35
- :pstate, :int,
36
- :sys, :uint,
37
- :prefetch, :int,
38
- :barrier, :int
39
- )
40
- end
41
-
42
- class Operand < FFI::Struct
43
-
44
- layout(
45
- :vector_index, :int,
46
- :vas, :int,
47
- :vess, :int,
48
- :shift, OperandShift,
49
- :ext, :uint,
50
- :type, :uint,
51
- :value, OperandValue
52
- )
53
-
54
- def value
55
- case self[:type]
56
- when *[OP_REG, OP_REG_MRS, OP_REG_MSR] # Register operand.
57
- self[:value][:reg]
58
- when *[OP_IMM, OP_CIMM] # Immediate operand.
59
- self[:value][:imm]
60
- when OP_FP # Floating-Point immediate operand.
61
- self[:value][:fp]
62
- when OP_MEM # Memory operand
63
- self[:value][:mem]
64
- when OP_PSTATE # PState operand.
65
- self[:value][:pstate]
66
- when OP_SYS # SYS operand for IC/DC/AT/TLBI instructions.
67
- self[:value][:sys]
68
- when OP_PREFETCH # Prefetch operand (PRFM).
69
- self[:value][:prefetch]
70
- when OP_BARRIER # Memory barrier operand (ISB/DMB/DSB instructions).
71
- self[:value][:barrier]
72
- else
73
- nil
74
- end
75
- end
76
-
77
- def shift_type
78
- self[:shift][:type]
79
- end
80
-
81
- def shift_value
82
- self[:shift][:value]
83
- end
84
-
85
- def shift?
86
- self[:shift][:type] != SFT_INVALID
87
- end
88
-
89
- def ext?
90
- self[:ext] != EXT_INVALID
91
- end
92
-
93
- def reg?
94
- self[:type] == OP_REG
95
- end
96
-
97
- def imm?
98
- self[:type] == OP_IMM
99
- end
100
-
101
- def cimm?
102
- self[:type] == OP_CIMM
103
- end
104
-
105
- def mem?
106
- self[:type] == OP_MEM
107
- end
108
-
109
- def fp?
110
- self[:type] == OP_FP
111
- end
112
-
113
- def pstate?
114
- self[:type] == OP_PSTATE
115
- end
116
-
117
- def msr?
118
- self[:type] == OP_REG_MSR
119
- end
120
-
121
- def mrs?
122
- self[:type] == OP_REG_MRS
123
- end
124
-
125
- def barrier?
126
- self[:type] == OP_BARRIER
127
- end
128
-
129
- def prefetch?
130
- self[:type] == OP_PREFETCH
131
- end
132
-
133
- def valid?
134
- [
135
- OP_INVALID,
136
- OP_REG,
137
- OP_CIMM,
138
- OP_IMM,
139
- OP_FP,
140
- OP_MEM,
141
- OP_REG_MRS,
142
- OP_REG_MSR,
143
- OP_PSTATE,
144
- OP_SYS,
145
- OP_PREFETCH,
146
- OP_BARRIER
147
- ].include? self[:type]
148
- end
149
-
150
- end
151
-
152
- class Instruction < FFI::Struct
153
- layout(
154
- :cc, :uint,
155
- :update_flags, :bool,
156
- :writeback, :bool,
157
- :op_count, :uint8,
158
- :operands, [Operand, 8]
159
- )
160
-
161
- def operands
162
- self[:operands].take_while {|op| op[:type].nonzero?}
163
- end
164
-
165
- end
166
- end
167
- end
@@ -1,295 +0,0 @@
1
- # Library by Nguyen Anh Quynh
2
- # Original binding by Nguyen Anh Quynh and Tan Sheng Di
3
- # Additional binding work by Ben Nagy
4
- # (c) 2013 COSEINC. All Rights Reserved.
5
-
6
- # THIS FILE WAS AUTO-GENERATED -- DO NOT EDIT!
7
- # Command: ./genreg /Users/ben/src/capstone/bindings/python/capstone/
8
- # 2015-05-02T13:24:07+12:00
9
-
10
- module Crabstone
11
- module ARM64
12
- REG_LOOKUP = {
13
- 'INVALID' => 0,
14
- 'X29' => 1,
15
- 'X30' => 2,
16
- 'NZCV' => 3,
17
- 'SP' => 4,
18
- 'WSP' => 5,
19
- 'WZR' => 6,
20
- 'XZR' => 7,
21
- 'B0' => 8,
22
- 'B1' => 9,
23
- 'B2' => 10,
24
- 'B3' => 11,
25
- 'B4' => 12,
26
- 'B5' => 13,
27
- 'B6' => 14,
28
- 'B7' => 15,
29
- 'B8' => 16,
30
- 'B9' => 17,
31
- 'B10' => 18,
32
- 'B11' => 19,
33
- 'B12' => 20,
34
- 'B13' => 21,
35
- 'B14' => 22,
36
- 'B15' => 23,
37
- 'B16' => 24,
38
- 'B17' => 25,
39
- 'B18' => 26,
40
- 'B19' => 27,
41
- 'B20' => 28,
42
- 'B21' => 29,
43
- 'B22' => 30,
44
- 'B23' => 31,
45
- 'B24' => 32,
46
- 'B25' => 33,
47
- 'B26' => 34,
48
- 'B27' => 35,
49
- 'B28' => 36,
50
- 'B29' => 37,
51
- 'B30' => 38,
52
- 'B31' => 39,
53
- 'D0' => 40,
54
- 'D1' => 41,
55
- 'D2' => 42,
56
- 'D3' => 43,
57
- 'D4' => 44,
58
- 'D5' => 45,
59
- 'D6' => 46,
60
- 'D7' => 47,
61
- 'D8' => 48,
62
- 'D9' => 49,
63
- 'D10' => 50,
64
- 'D11' => 51,
65
- 'D12' => 52,
66
- 'D13' => 53,
67
- 'D14' => 54,
68
- 'D15' => 55,
69
- 'D16' => 56,
70
- 'D17' => 57,
71
- 'D18' => 58,
72
- 'D19' => 59,
73
- 'D20' => 60,
74
- 'D21' => 61,
75
- 'D22' => 62,
76
- 'D23' => 63,
77
- 'D24' => 64,
78
- 'D25' => 65,
79
- 'D26' => 66,
80
- 'D27' => 67,
81
- 'D28' => 68,
82
- 'D29' => 69,
83
- 'D30' => 70,
84
- 'D31' => 71,
85
- 'H0' => 72,
86
- 'H1' => 73,
87
- 'H2' => 74,
88
- 'H3' => 75,
89
- 'H4' => 76,
90
- 'H5' => 77,
91
- 'H6' => 78,
92
- 'H7' => 79,
93
- 'H8' => 80,
94
- 'H9' => 81,
95
- 'H10' => 82,
96
- 'H11' => 83,
97
- 'H12' => 84,
98
- 'H13' => 85,
99
- 'H14' => 86,
100
- 'H15' => 87,
101
- 'H16' => 88,
102
- 'H17' => 89,
103
- 'H18' => 90,
104
- 'H19' => 91,
105
- 'H20' => 92,
106
- 'H21' => 93,
107
- 'H22' => 94,
108
- 'H23' => 95,
109
- 'H24' => 96,
110
- 'H25' => 97,
111
- 'H26' => 98,
112
- 'H27' => 99,
113
- 'H28' => 100,
114
- 'H29' => 101,
115
- 'H30' => 102,
116
- 'H31' => 103,
117
- 'Q0' => 104,
118
- 'Q1' => 105,
119
- 'Q2' => 106,
120
- 'Q3' => 107,
121
- 'Q4' => 108,
122
- 'Q5' => 109,
123
- 'Q6' => 110,
124
- 'Q7' => 111,
125
- 'Q8' => 112,
126
- 'Q9' => 113,
127
- 'Q10' => 114,
128
- 'Q11' => 115,
129
- 'Q12' => 116,
130
- 'Q13' => 117,
131
- 'Q14' => 118,
132
- 'Q15' => 119,
133
- 'Q16' => 120,
134
- 'Q17' => 121,
135
- 'Q18' => 122,
136
- 'Q19' => 123,
137
- 'Q20' => 124,
138
- 'Q21' => 125,
139
- 'Q22' => 126,
140
- 'Q23' => 127,
141
- 'Q24' => 128,
142
- 'Q25' => 129,
143
- 'Q26' => 130,
144
- 'Q27' => 131,
145
- 'Q28' => 132,
146
- 'Q29' => 133,
147
- 'Q30' => 134,
148
- 'Q31' => 135,
149
- 'S0' => 136,
150
- 'S1' => 137,
151
- 'S2' => 138,
152
- 'S3' => 139,
153
- 'S4' => 140,
154
- 'S5' => 141,
155
- 'S6' => 142,
156
- 'S7' => 143,
157
- 'S8' => 144,
158
- 'S9' => 145,
159
- 'S10' => 146,
160
- 'S11' => 147,
161
- 'S12' => 148,
162
- 'S13' => 149,
163
- 'S14' => 150,
164
- 'S15' => 151,
165
- 'S16' => 152,
166
- 'S17' => 153,
167
- 'S18' => 154,
168
- 'S19' => 155,
169
- 'S20' => 156,
170
- 'S21' => 157,
171
- 'S22' => 158,
172
- 'S23' => 159,
173
- 'S24' => 160,
174
- 'S25' => 161,
175
- 'S26' => 162,
176
- 'S27' => 163,
177
- 'S28' => 164,
178
- 'S29' => 165,
179
- 'S30' => 166,
180
- 'S31' => 167,
181
- 'W0' => 168,
182
- 'W1' => 169,
183
- 'W2' => 170,
184
- 'W3' => 171,
185
- 'W4' => 172,
186
- 'W5' => 173,
187
- 'W6' => 174,
188
- 'W7' => 175,
189
- 'W8' => 176,
190
- 'W9' => 177,
191
- 'W10' => 178,
192
- 'W11' => 179,
193
- 'W12' => 180,
194
- 'W13' => 181,
195
- 'W14' => 182,
196
- 'W15' => 183,
197
- 'W16' => 184,
198
- 'W17' => 185,
199
- 'W18' => 186,
200
- 'W19' => 187,
201
- 'W20' => 188,
202
- 'W21' => 189,
203
- 'W22' => 190,
204
- 'W23' => 191,
205
- 'W24' => 192,
206
- 'W25' => 193,
207
- 'W26' => 194,
208
- 'W27' => 195,
209
- 'W28' => 196,
210
- 'W29' => 197,
211
- 'W30' => 198,
212
- 'X0' => 199,
213
- 'X1' => 200,
214
- 'X2' => 201,
215
- 'X3' => 202,
216
- 'X4' => 203,
217
- 'X5' => 204,
218
- 'X6' => 205,
219
- 'X7' => 206,
220
- 'X8' => 207,
221
- 'X9' => 208,
222
- 'X10' => 209,
223
- 'X11' => 210,
224
- 'X12' => 211,
225
- 'X13' => 212,
226
- 'X14' => 213,
227
- 'X15' => 214,
228
- 'X16' => 215,
229
- 'X17' => 216,
230
- 'X18' => 217,
231
- 'X19' => 218,
232
- 'X20' => 219,
233
- 'X21' => 220,
234
- 'X22' => 221,
235
- 'X23' => 222,
236
- 'X24' => 223,
237
- 'X25' => 224,
238
- 'X26' => 225,
239
- 'X27' => 226,
240
- 'X28' => 227,
241
- 'V0' => 228,
242
- 'V1' => 229,
243
- 'V2' => 230,
244
- 'V3' => 231,
245
- 'V4' => 232,
246
- 'V5' => 233,
247
- 'V6' => 234,
248
- 'V7' => 235,
249
- 'V8' => 236,
250
- 'V9' => 237,
251
- 'V10' => 238,
252
- 'V11' => 239,
253
- 'V12' => 240,
254
- 'V13' => 241,
255
- 'V14' => 242,
256
- 'V15' => 243,
257
- 'V16' => 244,
258
- 'V17' => 245,
259
- 'V18' => 246,
260
- 'V19' => 247,
261
- 'V20' => 248,
262
- 'V21' => 249,
263
- 'V22' => 250,
264
- 'V23' => 251,
265
- 'V24' => 252,
266
- 'V25' => 253,
267
- 'V26' => 254,
268
- 'V27' => 255,
269
- 'V28' => 256,
270
- 'V29' => 257,
271
- 'V30' => 258,
272
- 'V31' => 259
273
- }
274
-
275
- ID_LOOKUP = REG_LOOKUP.invert
276
-
277
- # alias registers
278
- REG_LOOKUP['IP1'] = REG_LOOKUP['X16']
279
- REG_LOOKUP['IP0'] = REG_LOOKUP['X17']
280
- REG_LOOKUP['FP'] = REG_LOOKUP['X29']
281
- REG_LOOKUP['LR'] = REG_LOOKUP['X30']
282
-
283
- SYM_LOOKUP = Hash[REG_LOOKUP.map {|k,v| [k.downcase.to_sym,v]}]
284
-
285
- def self.register reg
286
- return reg if ID_LOOKUP[reg]
287
- return SYM_LOOKUP[reg] if SYM_LOOKUP[reg]
288
- if reg.respond_to? :upcase
289
- return REG_LOOKUP[reg.upcase] || REG_LOOKUP['INVALID']
290
- end
291
- REG_LOOKUP['INVALID']
292
- end
293
-
294
- end
295
- end