fisk 1.0.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1255) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +35 -0
  3. data/CODE_OF_CONDUCT.md +78 -0
  4. data/Gemfile +1 -2
  5. data/README.md +59 -4
  6. data/Rakefile +13 -5
  7. data/bin/build-machine.rb +58 -2
  8. data/bin/instruction.rb.erb +65 -0
  9. data/bin/instructions.rb.erb +66 -0
  10. data/fisk.gemspec +21 -0
  11. data/lib/fisk/basic_block.rb +162 -0
  12. data/lib/fisk/encoding.rb +127 -0
  13. data/lib/fisk/errors.rb +35 -0
  14. data/lib/fisk/helpers.rb +40 -2
  15. data/lib/fisk/instructions/adc.rb +726 -0
  16. data/lib/fisk/instructions/adcx.rb +109 -0
  17. data/lib/fisk/instructions/add.rb +726 -0
  18. data/lib/fisk/instructions/addpd.rb +57 -0
  19. data/lib/fisk/instructions/addps.rb +55 -0
  20. data/lib/fisk/instructions/addsd.rb +57 -0
  21. data/lib/fisk/instructions/addss.rb +57 -0
  22. data/lib/fisk/instructions/addsubpd.rb +57 -0
  23. data/lib/fisk/instructions/addsubps.rb +57 -0
  24. data/lib/fisk/instructions/adox.rb +109 -0
  25. data/lib/fisk/instructions/aesdec.rb +59 -0
  26. data/lib/fisk/instructions/aesdeclast.rb +59 -0
  27. data/lib/fisk/instructions/aesenc.rb +59 -0
  28. data/lib/fisk/instructions/aesenclast.rb +59 -0
  29. data/lib/fisk/instructions/aesimc.rb +59 -0
  30. data/lib/fisk/instructions/aeskeygenassist.rb +63 -0
  31. data/lib/fisk/instructions/and.rb +726 -0
  32. data/lib/fisk/instructions/andn.rb +81 -0
  33. data/lib/fisk/instructions/andnpd.rb +57 -0
  34. data/lib/fisk/instructions/andnps.rb +55 -0
  35. data/lib/fisk/instructions/andpd.rb +57 -0
  36. data/lib/fisk/instructions/andps.rb +55 -0
  37. data/lib/fisk/instructions/bextr.rb +157 -0
  38. data/lib/fisk/instructions/blcfill.rb +77 -0
  39. data/lib/fisk/instructions/blci.rb +77 -0
  40. data/lib/fisk/instructions/blcic.rb +77 -0
  41. data/lib/fisk/instructions/blcmsk.rb +77 -0
  42. data/lib/fisk/instructions/blcs.rb +77 -0
  43. data/lib/fisk/instructions/blendpd.rb +63 -0
  44. data/lib/fisk/instructions/blendps.rb +63 -0
  45. data/lib/fisk/instructions/blendvpd.rb +61 -0
  46. data/lib/fisk/instructions/blendvps.rb +61 -0
  47. data/lib/fisk/instructions/blsfill.rb +77 -0
  48. data/lib/fisk/instructions/blsi.rb +77 -0
  49. data/lib/fisk/instructions/blsic.rb +77 -0
  50. data/lib/fisk/instructions/blsmsk.rb +77 -0
  51. data/lib/fisk/instructions/blsr.rb +77 -0
  52. data/lib/fisk/instructions/bsf.rb +149 -0
  53. data/lib/fisk/instructions/bsr.rb +149 -0
  54. data/lib/fisk/instructions/bswap.rb +45 -0
  55. data/lib/fisk/instructions/bt.rb +295 -0
  56. data/lib/fisk/instructions/btc.rb +295 -0
  57. data/lib/fisk/instructions/btr.rb +295 -0
  58. data/lib/fisk/instructions/bts.rb +295 -0
  59. data/lib/fisk/instructions/bzhi.rb +81 -0
  60. data/lib/fisk/instructions/call.rb +63 -0
  61. data/lib/fisk/instructions/cbw.rb +20 -0
  62. data/lib/fisk/instructions/cdq.rb +19 -0
  63. data/lib/fisk/instructions/cdqe.rb +25 -0
  64. data/lib/fisk/instructions/clc.rb +19 -0
  65. data/lib/fisk/instructions/cld.rb +19 -0
  66. data/lib/fisk/instructions/clflush.rb +31 -0
  67. data/lib/fisk/instructions/clflushopt.rb +32 -0
  68. data/lib/fisk/instructions/clwb.rb +32 -0
  69. data/lib/fisk/instructions/clzero.rb +21 -0
  70. data/lib/fisk/instructions/cmc.rb +19 -0
  71. data/lib/fisk/instructions/cmova.rb +149 -0
  72. data/lib/fisk/instructions/cmovae.rb +149 -0
  73. data/lib/fisk/instructions/cmovb.rb +149 -0
  74. data/lib/fisk/instructions/cmovbe.rb +149 -0
  75. data/lib/fisk/instructions/cmovc.rb +149 -0
  76. data/lib/fisk/instructions/cmove.rb +149 -0
  77. data/lib/fisk/instructions/cmovg.rb +149 -0
  78. data/lib/fisk/instructions/cmovge.rb +149 -0
  79. data/lib/fisk/instructions/cmovl.rb +149 -0
  80. data/lib/fisk/instructions/cmovle.rb +149 -0
  81. data/lib/fisk/instructions/cmovna.rb +149 -0
  82. data/lib/fisk/instructions/cmovnae.rb +149 -0
  83. data/lib/fisk/instructions/cmovnb.rb +149 -0
  84. data/lib/fisk/instructions/cmovnbe.rb +149 -0
  85. data/lib/fisk/instructions/cmovnc.rb +149 -0
  86. data/lib/fisk/instructions/cmovne.rb +149 -0
  87. data/lib/fisk/instructions/cmovng.rb +149 -0
  88. data/lib/fisk/instructions/cmovnge.rb +149 -0
  89. data/lib/fisk/instructions/cmovnl.rb +149 -0
  90. data/lib/fisk/instructions/cmovnle.rb +149 -0
  91. data/lib/fisk/instructions/cmovno.rb +149 -0
  92. data/lib/fisk/instructions/cmovnp.rb +149 -0
  93. data/lib/fisk/instructions/cmovns.rb +149 -0
  94. data/lib/fisk/instructions/cmovnz.rb +149 -0
  95. data/lib/fisk/instructions/cmovo.rb +149 -0
  96. data/lib/fisk/instructions/cmovp.rb +149 -0
  97. data/lib/fisk/instructions/cmovpe.rb +149 -0
  98. data/lib/fisk/instructions/cmovpo.rb +149 -0
  99. data/lib/fisk/instructions/cmovs.rb +149 -0
  100. data/lib/fisk/instructions/cmovz.rb +149 -0
  101. data/lib/fisk/instructions/cmp.rb +726 -0
  102. data/lib/fisk/instructions/cmppd.rb +61 -0
  103. data/lib/fisk/instructions/cmpps.rb +59 -0
  104. data/lib/fisk/instructions/cmpsd.rb +61 -0
  105. data/lib/fisk/instructions/cmpss.rb +61 -0
  106. data/lib/fisk/instructions/cmpxchg.rb +195 -0
  107. data/lib/fisk/instructions/cmpxchg16b.rb +31 -0
  108. data/lib/fisk/instructions/cmpxchg8b.rb +31 -0
  109. data/lib/fisk/instructions/comisd.rb +57 -0
  110. data/lib/fisk/instructions/comiss.rb +55 -0
  111. data/lib/fisk/instructions/cpuid.rb +20 -0
  112. data/lib/fisk/instructions/cqo.rb +25 -0
  113. data/lib/fisk/instructions/crc32.rb +261 -0
  114. data/lib/fisk/instructions/cvtdq2pd.rb +57 -0
  115. data/lib/fisk/instructions/cvtdq2ps.rb +55 -0
  116. data/lib/fisk/instructions/cvtpd2dq.rb +57 -0
  117. data/lib/fisk/instructions/cvtpd2pi.rb +57 -0
  118. data/lib/fisk/instructions/cvtpd2ps.rb +57 -0
  119. data/lib/fisk/instructions/cvtpi2pd.rb +57 -0
  120. data/lib/fisk/instructions/cvtpi2ps.rb +55 -0
  121. data/lib/fisk/instructions/cvtps2dq.rb +57 -0
  122. data/lib/fisk/instructions/cvtps2pd.rb +55 -0
  123. data/lib/fisk/instructions/cvtps2pi.rb +55 -0
  124. data/lib/fisk/instructions/cvtsd2si.rb +105 -0
  125. data/lib/fisk/instructions/cvtsd2ss.rb +57 -0
  126. data/lib/fisk/instructions/cvtsi2sd.rb +105 -0
  127. data/lib/fisk/instructions/cvtsi2ss.rb +105 -0
  128. data/lib/fisk/instructions/cvtss2sd.rb +57 -0
  129. data/lib/fisk/instructions/cvtss2si.rb +105 -0
  130. data/lib/fisk/instructions/cvttpd2dq.rb +57 -0
  131. data/lib/fisk/instructions/cvttpd2pi.rb +57 -0
  132. data/lib/fisk/instructions/cvttps2dq.rb +57 -0
  133. data/lib/fisk/instructions/cvttps2pi.rb +55 -0
  134. data/lib/fisk/instructions/cvttsd2si.rb +105 -0
  135. data/lib/fisk/instructions/cvttss2si.rb +105 -0
  136. data/lib/fisk/instructions/cwd.rb +20 -0
  137. data/lib/fisk/instructions/cwde.rb +19 -0
  138. data/lib/fisk/instructions/dec.rb +179 -0
  139. data/lib/fisk/instructions/div.rb +179 -0
  140. data/lib/fisk/instructions/divpd.rb +57 -0
  141. data/lib/fisk/instructions/divps.rb +55 -0
  142. data/lib/fisk/instructions/divsd.rb +57 -0
  143. data/lib/fisk/instructions/divss.rb +57 -0
  144. data/lib/fisk/instructions/dppd.rb +63 -0
  145. data/lib/fisk/instructions/dpps.rb +63 -0
  146. data/lib/fisk/instructions/emms.rb +20 -0
  147. data/lib/fisk/instructions/extractps.rb +63 -0
  148. data/lib/fisk/instructions/extrq.rb +60 -0
  149. data/lib/fisk/instructions/femms.rb +20 -0
  150. data/lib/fisk/instructions/haddpd.rb +57 -0
  151. data/lib/fisk/instructions/haddps.rb +57 -0
  152. data/lib/fisk/instructions/hsubpd.rb +57 -0
  153. data/lib/fisk/instructions/hsubps.rb +57 -0
  154. data/lib/fisk/instructions/idiv.rb +179 -0
  155. data/lib/fisk/instructions/imul.rb +611 -0
  156. data/lib/fisk/instructions/inc.rb +179 -0
  157. data/lib/fisk/instructions/insertps.rb +63 -0
  158. data/lib/fisk/instructions/insertq.rb +61 -0
  159. data/lib/fisk/instructions/int.rb +32 -0
  160. data/lib/fisk/instructions/ja.rb +34 -0
  161. data/lib/fisk/instructions/jae.rb +34 -0
  162. data/lib/fisk/instructions/jb.rb +34 -0
  163. data/lib/fisk/instructions/jbe.rb +34 -0
  164. data/lib/fisk/instructions/jc.rb +34 -0
  165. data/lib/fisk/instructions/je.rb +34 -0
  166. data/lib/fisk/instructions/jecxz.rb +21 -0
  167. data/lib/fisk/instructions/jg.rb +34 -0
  168. data/lib/fisk/instructions/jge.rb +34 -0
  169. data/lib/fisk/instructions/jl.rb +34 -0
  170. data/lib/fisk/instructions/jle.rb +34 -0
  171. data/lib/fisk/instructions/jmp.rb +75 -0
  172. data/lib/fisk/instructions/jna.rb +34 -0
  173. data/lib/fisk/instructions/jnae.rb +34 -0
  174. data/lib/fisk/instructions/jnb.rb +34 -0
  175. data/lib/fisk/instructions/jnbe.rb +34 -0
  176. data/lib/fisk/instructions/jnc.rb +34 -0
  177. data/lib/fisk/instructions/jne.rb +34 -0
  178. data/lib/fisk/instructions/jng.rb +34 -0
  179. data/lib/fisk/instructions/jnge.rb +34 -0
  180. data/lib/fisk/instructions/jnl.rb +34 -0
  181. data/lib/fisk/instructions/jnle.rb +34 -0
  182. data/lib/fisk/instructions/jno.rb +34 -0
  183. data/lib/fisk/instructions/jnp.rb +34 -0
  184. data/lib/fisk/instructions/jns.rb +34 -0
  185. data/lib/fisk/instructions/jnz.rb +34 -0
  186. data/lib/fisk/instructions/jo.rb +34 -0
  187. data/lib/fisk/instructions/jp.rb +34 -0
  188. data/lib/fisk/instructions/jpe.rb +34 -0
  189. data/lib/fisk/instructions/jpo.rb +34 -0
  190. data/lib/fisk/instructions/jrcxz.rb +21 -0
  191. data/lib/fisk/instructions/js.rb +34 -0
  192. data/lib/fisk/instructions/jz.rb +34 -0
  193. data/lib/fisk/instructions/kaddb.rb +27 -0
  194. data/lib/fisk/instructions/kaddd.rb +27 -0
  195. data/lib/fisk/instructions/kaddq.rb +27 -0
  196. data/lib/fisk/instructions/kaddw.rb +27 -0
  197. data/lib/fisk/instructions/kandb.rb +27 -0
  198. data/lib/fisk/instructions/kandd.rb +27 -0
  199. data/lib/fisk/instructions/kandnb.rb +27 -0
  200. data/lib/fisk/instructions/kandnd.rb +27 -0
  201. data/lib/fisk/instructions/kandnq.rb +27 -0
  202. data/lib/fisk/instructions/kandnw.rb +27 -0
  203. data/lib/fisk/instructions/kandq.rb +27 -0
  204. data/lib/fisk/instructions/kandw.rb +27 -0
  205. data/lib/fisk/instructions/kmovb.rb +94 -0
  206. data/lib/fisk/instructions/kmovd.rb +94 -0
  207. data/lib/fisk/instructions/kmovq.rb +94 -0
  208. data/lib/fisk/instructions/kmovw.rb +94 -0
  209. data/lib/fisk/instructions/knotb.rb +26 -0
  210. data/lib/fisk/instructions/knotd.rb +26 -0
  211. data/lib/fisk/instructions/knotq.rb +26 -0
  212. data/lib/fisk/instructions/knotw.rb +26 -0
  213. data/lib/fisk/instructions/korb.rb +27 -0
  214. data/lib/fisk/instructions/kord.rb +27 -0
  215. data/lib/fisk/instructions/korq.rb +27 -0
  216. data/lib/fisk/instructions/kortestb.rb +26 -0
  217. data/lib/fisk/instructions/kortestd.rb +26 -0
  218. data/lib/fisk/instructions/kortestq.rb +26 -0
  219. data/lib/fisk/instructions/kortestw.rb +26 -0
  220. data/lib/fisk/instructions/korw.rb +27 -0
  221. data/lib/fisk/instructions/kshiftlb.rb +28 -0
  222. data/lib/fisk/instructions/kshiftld.rb +28 -0
  223. data/lib/fisk/instructions/kshiftlq.rb +28 -0
  224. data/lib/fisk/instructions/kshiftlw.rb +28 -0
  225. data/lib/fisk/instructions/kshiftrb.rb +28 -0
  226. data/lib/fisk/instructions/kshiftrd.rb +28 -0
  227. data/lib/fisk/instructions/kshiftrq.rb +28 -0
  228. data/lib/fisk/instructions/kshiftrw.rb +28 -0
  229. data/lib/fisk/instructions/ktestb.rb +26 -0
  230. data/lib/fisk/instructions/ktestd.rb +26 -0
  231. data/lib/fisk/instructions/ktestq.rb +26 -0
  232. data/lib/fisk/instructions/ktestw.rb +26 -0
  233. data/lib/fisk/instructions/kunpckbw.rb +27 -0
  234. data/lib/fisk/instructions/kunpckdq.rb +27 -0
  235. data/lib/fisk/instructions/kunpckwd.rb +27 -0
  236. data/lib/fisk/instructions/kxnorb.rb +27 -0
  237. data/lib/fisk/instructions/kxnord.rb +27 -0
  238. data/lib/fisk/instructions/kxnorq.rb +27 -0
  239. data/lib/fisk/instructions/kxnorw.rb +27 -0
  240. data/lib/fisk/instructions/kxorb.rb +27 -0
  241. data/lib/fisk/instructions/kxord.rb +27 -0
  242. data/lib/fisk/instructions/kxorq.rb +27 -0
  243. data/lib/fisk/instructions/kxorw.rb +27 -0
  244. data/lib/fisk/instructions/lddqu.rb +33 -0
  245. data/lib/fisk/instructions/ldmxcsr.rb +31 -0
  246. data/lib/fisk/instructions/lea.rb +76 -0
  247. data/lib/fisk/instructions/lfence.rb +21 -0
  248. data/lib/fisk/instructions/lzcnt.rb +155 -0
  249. data/lib/fisk/instructions/maskmovdqu.rb +33 -0
  250. data/lib/fisk/instructions/maskmovq.rb +32 -0
  251. data/lib/fisk/instructions/maxpd.rb +57 -0
  252. data/lib/fisk/instructions/maxps.rb +55 -0
  253. data/lib/fisk/instructions/maxsd.rb +57 -0
  254. data/lib/fisk/instructions/maxss.rb +57 -0
  255. data/lib/fisk/instructions/mfence.rb +21 -0
  256. data/lib/fisk/instructions/minpd.rb +57 -0
  257. data/lib/fisk/instructions/minps.rb +55 -0
  258. data/lib/fisk/instructions/minsd.rb +57 -0
  259. data/lib/fisk/instructions/minss.rb +57 -0
  260. data/lib/fisk/instructions/monitor.rb +21 -0
  261. data/lib/fisk/instructions/monitorx.rb +21 -0
  262. data/lib/fisk/instructions/mov.rb +650 -0
  263. data/lib/fisk/instructions/movapd.rb +99 -0
  264. data/lib/fisk/instructions/movaps.rb +95 -0
  265. data/lib/fisk/instructions/movbe.rb +155 -0
  266. data/lib/fisk/instructions/movd.rb +197 -0
  267. data/lib/fisk/instructions/movddup.rb +57 -0
  268. data/lib/fisk/instructions/movdq2q.rb +33 -0
  269. data/lib/fisk/instructions/movdqa.rb +99 -0
  270. data/lib/fisk/instructions/movdqu.rb +99 -0
  271. data/lib/fisk/instructions/movhlps.rb +32 -0
  272. data/lib/fisk/instructions/movhpd.rb +57 -0
  273. data/lib/fisk/instructions/movhps.rb +55 -0
  274. data/lib/fisk/instructions/movlhps.rb +32 -0
  275. data/lib/fisk/instructions/movlpd.rb +57 -0
  276. data/lib/fisk/instructions/movlps.rb +55 -0
  277. data/lib/fisk/instructions/movmskpd.rb +33 -0
  278. data/lib/fisk/instructions/movmskps.rb +32 -0
  279. data/lib/fisk/instructions/movntdq.rb +33 -0
  280. data/lib/fisk/instructions/movntdqa.rb +34 -0
  281. data/lib/fisk/instructions/movnti.rb +55 -0
  282. data/lib/fisk/instructions/movntpd.rb +33 -0
  283. data/lib/fisk/instructions/movntps.rb +32 -0
  284. data/lib/fisk/instructions/movntq.rb +32 -0
  285. data/lib/fisk/instructions/movntsd.rb +33 -0
  286. data/lib/fisk/instructions/movntss.rb +33 -0
  287. data/lib/fisk/instructions/movq.rb +349 -0
  288. data/lib/fisk/instructions/movq2dq.rb +33 -0
  289. data/lib/fisk/instructions/movsd.rb +99 -0
  290. data/lib/fisk/instructions/movshdup.rb +57 -0
  291. data/lib/fisk/instructions/movsldup.rb +57 -0
  292. data/lib/fisk/instructions/movss.rb +99 -0
  293. data/lib/fisk/instructions/movsx.rb +241 -0
  294. data/lib/fisk/instructions/movsxd.rb +53 -0
  295. data/lib/fisk/instructions/movupd.rb +99 -0
  296. data/lib/fisk/instructions/movups.rb +95 -0
  297. data/lib/fisk/instructions/movzx.rb +241 -0
  298. data/lib/fisk/instructions/mpsadbw.rb +63 -0
  299. data/lib/fisk/instructions/mul.rb +179 -0
  300. data/lib/fisk/instructions/mulpd.rb +57 -0
  301. data/lib/fisk/instructions/mulps.rb +55 -0
  302. data/lib/fisk/instructions/mulsd.rb +57 -0
  303. data/lib/fisk/instructions/mulss.rb +57 -0
  304. data/lib/fisk/instructions/mulx.rb +81 -0
  305. data/lib/fisk/instructions/mwait.rb +21 -0
  306. data/lib/fisk/instructions/mwaitx.rb +21 -0
  307. data/lib/fisk/instructions/neg.rb +179 -0
  308. data/lib/fisk/instructions/nop.rb +19 -0
  309. data/lib/fisk/instructions/not.rb +179 -0
  310. data/lib/fisk/instructions/or.rb +726 -0
  311. data/lib/fisk/instructions/orpd.rb +57 -0
  312. data/lib/fisk/instructions/orps.rb +55 -0
  313. data/lib/fisk/instructions/pabsb.rb +107 -0
  314. data/lib/fisk/instructions/pabsd.rb +107 -0
  315. data/lib/fisk/instructions/pabsw.rb +107 -0
  316. data/lib/fisk/instructions/packssdw.rb +103 -0
  317. data/lib/fisk/instructions/packsswb.rb +103 -0
  318. data/lib/fisk/instructions/packusdw.rb +59 -0
  319. data/lib/fisk/instructions/packuswb.rb +103 -0
  320. data/lib/fisk/instructions/paddb.rb +103 -0
  321. data/lib/fisk/instructions/paddd.rb +103 -0
  322. data/lib/fisk/instructions/paddq.rb +103 -0
  323. data/lib/fisk/instructions/paddsb.rb +103 -0
  324. data/lib/fisk/instructions/paddsw.rb +103 -0
  325. data/lib/fisk/instructions/paddusb.rb +103 -0
  326. data/lib/fisk/instructions/paddusw.rb +103 -0
  327. data/lib/fisk/instructions/paddw.rb +103 -0
  328. data/lib/fisk/instructions/palignr.rb +115 -0
  329. data/lib/fisk/instructions/pand.rb +103 -0
  330. data/lib/fisk/instructions/pandn.rb +103 -0
  331. data/lib/fisk/instructions/pause.rb +20 -0
  332. data/lib/fisk/instructions/pavgb.rb +103 -0
  333. data/lib/fisk/instructions/pavgusb.rb +57 -0
  334. data/lib/fisk/instructions/pavgw.rb +103 -0
  335. data/lib/fisk/instructions/pblendvb.rb +61 -0
  336. data/lib/fisk/instructions/pblendw.rb +63 -0
  337. data/lib/fisk/instructions/pclmulqdq.rb +63 -0
  338. data/lib/fisk/instructions/pcmpeqb.rb +103 -0
  339. data/lib/fisk/instructions/pcmpeqd.rb +103 -0
  340. data/lib/fisk/instructions/pcmpeqq.rb +59 -0
  341. data/lib/fisk/instructions/pcmpeqw.rb +103 -0
  342. data/lib/fisk/instructions/pcmpestri.rb +63 -0
  343. data/lib/fisk/instructions/pcmpestrm.rb +63 -0
  344. data/lib/fisk/instructions/pcmpgtb.rb +103 -0
  345. data/lib/fisk/instructions/pcmpgtd.rb +103 -0
  346. data/lib/fisk/instructions/pcmpgtq.rb +59 -0
  347. data/lib/fisk/instructions/pcmpgtw.rb +103 -0
  348. data/lib/fisk/instructions/pcmpistri.rb +63 -0
  349. data/lib/fisk/instructions/pcmpistrm.rb +63 -0
  350. data/lib/fisk/instructions/pdep.rb +81 -0
  351. data/lib/fisk/instructions/pext.rb +81 -0
  352. data/lib/fisk/instructions/pextrb.rb +63 -0
  353. data/lib/fisk/instructions/pextrd.rb +63 -0
  354. data/lib/fisk/instructions/pextrq.rb +63 -0
  355. data/lib/fisk/instructions/pextrw.rb +107 -0
  356. data/lib/fisk/instructions/pf2id.rb +57 -0
  357. data/lib/fisk/instructions/pf2iw.rb +57 -0
  358. data/lib/fisk/instructions/pfacc.rb +57 -0
  359. data/lib/fisk/instructions/pfadd.rb +57 -0
  360. data/lib/fisk/instructions/pfcmpeq.rb +57 -0
  361. data/lib/fisk/instructions/pfcmpge.rb +57 -0
  362. data/lib/fisk/instructions/pfcmpgt.rb +57 -0
  363. data/lib/fisk/instructions/pfmax.rb +57 -0
  364. data/lib/fisk/instructions/pfmin.rb +57 -0
  365. data/lib/fisk/instructions/pfmul.rb +57 -0
  366. data/lib/fisk/instructions/pfnacc.rb +57 -0
  367. data/lib/fisk/instructions/pfpnacc.rb +57 -0
  368. data/lib/fisk/instructions/pfrcp.rb +57 -0
  369. data/lib/fisk/instructions/pfrcpit1.rb +57 -0
  370. data/lib/fisk/instructions/pfrcpit2.rb +57 -0
  371. data/lib/fisk/instructions/pfrsqit1.rb +57 -0
  372. data/lib/fisk/instructions/pfrsqrt.rb +57 -0
  373. data/lib/fisk/instructions/pfsub.rb +57 -0
  374. data/lib/fisk/instructions/pfsubr.rb +57 -0
  375. data/lib/fisk/instructions/phaddd.rb +107 -0
  376. data/lib/fisk/instructions/phaddsw.rb +107 -0
  377. data/lib/fisk/instructions/phaddw.rb +107 -0
  378. data/lib/fisk/instructions/phminposuw.rb +59 -0
  379. data/lib/fisk/instructions/phsubd.rb +107 -0
  380. data/lib/fisk/instructions/phsubsw.rb +107 -0
  381. data/lib/fisk/instructions/phsubw.rb +107 -0
  382. data/lib/fisk/instructions/pi2fd.rb +57 -0
  383. data/lib/fisk/instructions/pi2fw.rb +57 -0
  384. data/lib/fisk/instructions/pinsrb.rb +63 -0
  385. data/lib/fisk/instructions/pinsrd.rb +63 -0
  386. data/lib/fisk/instructions/pinsrq.rb +63 -0
  387. data/lib/fisk/instructions/pinsrw.rb +111 -0
  388. data/lib/fisk/instructions/pmaddubsw.rb +107 -0
  389. data/lib/fisk/instructions/pmaddwd.rb +103 -0
  390. data/lib/fisk/instructions/pmaxsb.rb +59 -0
  391. data/lib/fisk/instructions/pmaxsd.rb +59 -0
  392. data/lib/fisk/instructions/pmaxsw.rb +103 -0
  393. data/lib/fisk/instructions/pmaxub.rb +103 -0
  394. data/lib/fisk/instructions/pmaxud.rb +59 -0
  395. data/lib/fisk/instructions/pmaxuw.rb +59 -0
  396. data/lib/fisk/instructions/pminsb.rb +59 -0
  397. data/lib/fisk/instructions/pminsd.rb +59 -0
  398. data/lib/fisk/instructions/pminsw.rb +103 -0
  399. data/lib/fisk/instructions/pminub.rb +103 -0
  400. data/lib/fisk/instructions/pminud.rb +59 -0
  401. data/lib/fisk/instructions/pminuw.rb +59 -0
  402. data/lib/fisk/instructions/pmovmskb.rb +56 -0
  403. data/lib/fisk/instructions/pmovsxbd.rb +59 -0
  404. data/lib/fisk/instructions/pmovsxbq.rb +59 -0
  405. data/lib/fisk/instructions/pmovsxbw.rb +59 -0
  406. data/lib/fisk/instructions/pmovsxdq.rb +59 -0
  407. data/lib/fisk/instructions/pmovsxwd.rb +59 -0
  408. data/lib/fisk/instructions/pmovsxwq.rb +59 -0
  409. data/lib/fisk/instructions/pmovzxbd.rb +59 -0
  410. data/lib/fisk/instructions/pmovzxbq.rb +59 -0
  411. data/lib/fisk/instructions/pmovzxbw.rb +59 -0
  412. data/lib/fisk/instructions/pmovzxdq.rb +59 -0
  413. data/lib/fisk/instructions/pmovzxwd.rb +59 -0
  414. data/lib/fisk/instructions/pmovzxwq.rb +59 -0
  415. data/lib/fisk/instructions/pmuldq.rb +59 -0
  416. data/lib/fisk/instructions/pmulhrsw.rb +107 -0
  417. data/lib/fisk/instructions/pmulhrw.rb +57 -0
  418. data/lib/fisk/instructions/pmulhuw.rb +103 -0
  419. data/lib/fisk/instructions/pmulhw.rb +103 -0
  420. data/lib/fisk/instructions/pmulld.rb +59 -0
  421. data/lib/fisk/instructions/pmullw.rb +103 -0
  422. data/lib/fisk/instructions/pmuludq.rb +103 -0
  423. data/lib/fisk/instructions/pop.rb +120 -0
  424. data/lib/fisk/instructions/popcnt.rb +155 -0
  425. data/lib/fisk/instructions/por.rb +103 -0
  426. data/lib/fisk/instructions/prefetch.rb +31 -0
  427. data/lib/fisk/instructions/prefetchnta.rb +31 -0
  428. data/lib/fisk/instructions/prefetcht0.rb +31 -0
  429. data/lib/fisk/instructions/prefetcht1.rb +31 -0
  430. data/lib/fisk/instructions/prefetcht2.rb +31 -0
  431. data/lib/fisk/instructions/prefetchw.rb +31 -0
  432. data/lib/fisk/instructions/prefetchwt1.rb +31 -0
  433. data/lib/fisk/instructions/psadbw.rb +103 -0
  434. data/lib/fisk/instructions/pshufb.rb +107 -0
  435. data/lib/fisk/instructions/pshufd.rb +61 -0
  436. data/lib/fisk/instructions/pshufhw.rb +61 -0
  437. data/lib/fisk/instructions/pshuflw.rb +61 -0
  438. data/lib/fisk/instructions/pshufw.rb +59 -0
  439. data/lib/fisk/instructions/psignb.rb +107 -0
  440. data/lib/fisk/instructions/psignd.rb +107 -0
  441. data/lib/fisk/instructions/psignw.rb +107 -0
  442. data/lib/fisk/instructions/pslld.rb +152 -0
  443. data/lib/fisk/instructions/pslldq.rb +34 -0
  444. data/lib/fisk/instructions/psllq.rb +152 -0
  445. data/lib/fisk/instructions/psllw.rb +152 -0
  446. data/lib/fisk/instructions/psrad.rb +152 -0
  447. data/lib/fisk/instructions/psraw.rb +152 -0
  448. data/lib/fisk/instructions/psrld.rb +152 -0
  449. data/lib/fisk/instructions/psrldq.rb +34 -0
  450. data/lib/fisk/instructions/psrlq.rb +152 -0
  451. data/lib/fisk/instructions/psrlw.rb +152 -0
  452. data/lib/fisk/instructions/psubb.rb +103 -0
  453. data/lib/fisk/instructions/psubd.rb +103 -0
  454. data/lib/fisk/instructions/psubq.rb +103 -0
  455. data/lib/fisk/instructions/psubsb.rb +103 -0
  456. data/lib/fisk/instructions/psubsw.rb +103 -0
  457. data/lib/fisk/instructions/psubusb.rb +103 -0
  458. data/lib/fisk/instructions/psubusw.rb +103 -0
  459. data/lib/fisk/instructions/psubw.rb +103 -0
  460. data/lib/fisk/instructions/pswapd.rb +57 -0
  461. data/lib/fisk/instructions/ptest.rb +59 -0
  462. data/lib/fisk/instructions/punpckhbw.rb +103 -0
  463. data/lib/fisk/instructions/punpckhdq.rb +103 -0
  464. data/lib/fisk/instructions/punpckhqdq.rb +57 -0
  465. data/lib/fisk/instructions/punpckhwd.rb +103 -0
  466. data/lib/fisk/instructions/punpcklbw.rb +103 -0
  467. data/lib/fisk/instructions/punpckldq.rb +103 -0
  468. data/lib/fisk/instructions/punpcklqdq.rb +57 -0
  469. data/lib/fisk/instructions/punpcklwd.rb +103 -0
  470. data/lib/fisk/instructions/push.rb +144 -0
  471. data/lib/fisk/instructions/pxor.rb +103 -0
  472. data/lib/fisk/instructions/rcl.rb +551 -0
  473. data/lib/fisk/instructions/rcpps.rb +55 -0
  474. data/lib/fisk/instructions/rcpss.rb +57 -0
  475. data/lib/fisk/instructions/rcr.rb +551 -0
  476. data/lib/fisk/instructions/rdrand.rb +76 -0
  477. data/lib/fisk/instructions/rdseed.rb +76 -0
  478. data/lib/fisk/instructions/rdtsc.rb +20 -0
  479. data/lib/fisk/instructions/rdtscp.rb +21 -0
  480. data/lib/fisk/instructions/ret.rb +31 -0
  481. data/lib/fisk/instructions/rol.rb +551 -0
  482. data/lib/fisk/instructions/ror.rb +551 -0
  483. data/lib/fisk/instructions/rorx.rb +85 -0
  484. data/lib/fisk/instructions/roundpd.rb +63 -0
  485. data/lib/fisk/instructions/roundps.rb +63 -0
  486. data/lib/fisk/instructions/roundsd.rb +63 -0
  487. data/lib/fisk/instructions/roundss.rb +63 -0
  488. data/lib/fisk/instructions/rsqrtps.rb +55 -0
  489. data/lib/fisk/instructions/rsqrtss.rb +57 -0
  490. data/lib/fisk/instructions/sal.rb +551 -0
  491. data/lib/fisk/instructions/sar.rb +551 -0
  492. data/lib/fisk/instructions/sarx.rb +81 -0
  493. data/lib/fisk/instructions/sbb.rb +726 -0
  494. data/lib/fisk/instructions/seta.rb +53 -0
  495. data/lib/fisk/instructions/setae.rb +53 -0
  496. data/lib/fisk/instructions/setb.rb +53 -0
  497. data/lib/fisk/instructions/setbe.rb +53 -0
  498. data/lib/fisk/instructions/setc.rb +53 -0
  499. data/lib/fisk/instructions/sete.rb +53 -0
  500. data/lib/fisk/instructions/setg.rb +53 -0
  501. data/lib/fisk/instructions/setge.rb +53 -0
  502. data/lib/fisk/instructions/setl.rb +53 -0
  503. data/lib/fisk/instructions/setle.rb +53 -0
  504. data/lib/fisk/instructions/setna.rb +53 -0
  505. data/lib/fisk/instructions/setnae.rb +53 -0
  506. data/lib/fisk/instructions/setnb.rb +53 -0
  507. data/lib/fisk/instructions/setnbe.rb +53 -0
  508. data/lib/fisk/instructions/setnc.rb +53 -0
  509. data/lib/fisk/instructions/setne.rb +53 -0
  510. data/lib/fisk/instructions/setng.rb +53 -0
  511. data/lib/fisk/instructions/setnge.rb +53 -0
  512. data/lib/fisk/instructions/setnl.rb +53 -0
  513. data/lib/fisk/instructions/setnle.rb +53 -0
  514. data/lib/fisk/instructions/setno.rb +53 -0
  515. data/lib/fisk/instructions/setnp.rb +53 -0
  516. data/lib/fisk/instructions/setns.rb +53 -0
  517. data/lib/fisk/instructions/setnz.rb +53 -0
  518. data/lib/fisk/instructions/seto.rb +53 -0
  519. data/lib/fisk/instructions/setp.rb +53 -0
  520. data/lib/fisk/instructions/setpe.rb +53 -0
  521. data/lib/fisk/instructions/setpo.rb +53 -0
  522. data/lib/fisk/instructions/sets.rb +53 -0
  523. data/lib/fisk/instructions/setz.rb +53 -0
  524. data/lib/fisk/instructions/sfence.rb +21 -0
  525. data/lib/fisk/instructions/sha1msg1.rb +57 -0
  526. data/lib/fisk/instructions/sha1msg2.rb +57 -0
  527. data/lib/fisk/instructions/sha1nexte.rb +57 -0
  528. data/lib/fisk/instructions/sha1rnds4.rb +61 -0
  529. data/lib/fisk/instructions/sha256msg1.rb +57 -0
  530. data/lib/fisk/instructions/sha256msg2.rb +57 -0
  531. data/lib/fisk/instructions/sha256rnds2.rb +59 -0
  532. data/lib/fisk/instructions/shl.rb +551 -0
  533. data/lib/fisk/instructions/shld.rb +307 -0
  534. data/lib/fisk/instructions/shlx.rb +81 -0
  535. data/lib/fisk/instructions/shr.rb +551 -0
  536. data/lib/fisk/instructions/shrd.rb +307 -0
  537. data/lib/fisk/instructions/shrx.rb +81 -0
  538. data/lib/fisk/instructions/shufpd.rb +61 -0
  539. data/lib/fisk/instructions/shufps.rb +59 -0
  540. data/lib/fisk/instructions/sqrtpd.rb +57 -0
  541. data/lib/fisk/instructions/sqrtps.rb +55 -0
  542. data/lib/fisk/instructions/sqrtsd.rb +57 -0
  543. data/lib/fisk/instructions/sqrtss.rb +57 -0
  544. data/lib/fisk/instructions/stc.rb +19 -0
  545. data/lib/fisk/instructions/std.rb +19 -0
  546. data/lib/fisk/instructions/stmxcsr.rb +31 -0
  547. data/lib/fisk/instructions/sub.rb +726 -0
  548. data/lib/fisk/instructions/subpd.rb +57 -0
  549. data/lib/fisk/instructions/subps.rb +55 -0
  550. data/lib/fisk/instructions/subsd.rb +57 -0
  551. data/lib/fisk/instructions/subss.rb +57 -0
  552. data/lib/fisk/instructions/syscall.rb +20 -0
  553. data/lib/fisk/instructions/t1mskc.rb +77 -0
  554. data/lib/fisk/instructions/test.rb +432 -0
  555. data/lib/fisk/instructions/tzcnt.rb +155 -0
  556. data/lib/fisk/instructions/tzmsk.rb +77 -0
  557. data/lib/fisk/instructions/ucomisd.rb +57 -0
  558. data/lib/fisk/instructions/ucomiss.rb +55 -0
  559. data/lib/fisk/instructions/ud2.rb +20 -0
  560. data/lib/fisk/instructions/unpckhpd.rb +57 -0
  561. data/lib/fisk/instructions/unpckhps.rb +55 -0
  562. data/lib/fisk/instructions/unpcklpd.rb +57 -0
  563. data/lib/fisk/instructions/unpcklps.rb +55 -0
  564. data/lib/fisk/instructions/vaddpd.rb +190 -0
  565. data/lib/fisk/instructions/vaddps.rb +190 -0
  566. data/lib/fisk/instructions/vaddsd.rb +82 -0
  567. data/lib/fisk/instructions/vaddss.rb +82 -0
  568. data/lib/fisk/instructions/vaddsubpd.rb +81 -0
  569. data/lib/fisk/instructions/vaddsubps.rb +81 -0
  570. data/lib/fisk/instructions/vaesdec.rb +45 -0
  571. data/lib/fisk/instructions/vaesdeclast.rb +45 -0
  572. data/lib/fisk/instructions/vaesenc.rb +45 -0
  573. data/lib/fisk/instructions/vaesenclast.rb +45 -0
  574. data/lib/fisk/instructions/vaesimc.rb +43 -0
  575. data/lib/fisk/instructions/vaeskeygenassist.rb +47 -0
  576. data/lib/fisk/instructions/valignd.rb +129 -0
  577. data/lib/fisk/instructions/valignq.rb +129 -0
  578. data/lib/fisk/instructions/vandnpd.rb +189 -0
  579. data/lib/fisk/instructions/vandnps.rb +189 -0
  580. data/lib/fisk/instructions/vandpd.rb +189 -0
  581. data/lib/fisk/instructions/vandps.rb +189 -0
  582. data/lib/fisk/instructions/vblendmpd.rb +117 -0
  583. data/lib/fisk/instructions/vblendmps.rb +117 -0
  584. data/lib/fisk/instructions/vblendpd.rb +89 -0
  585. data/lib/fisk/instructions/vblendps.rb +89 -0
  586. data/lib/fisk/instructions/vblendvpd.rb +89 -0
  587. data/lib/fisk/instructions/vblendvps.rb +89 -0
  588. data/lib/fisk/instructions/vbroadcastf128.rb +26 -0
  589. data/lib/fisk/instructions/vbroadcastf32x2.rb +77 -0
  590. data/lib/fisk/instructions/vbroadcastf32x4.rb +43 -0
  591. data/lib/fisk/instructions/vbroadcastf32x8.rb +26 -0
  592. data/lib/fisk/instructions/vbroadcastf64x2.rb +43 -0
  593. data/lib/fisk/instructions/vbroadcastf64x4.rb +26 -0
  594. data/lib/fisk/instructions/vbroadcasti128.rb +26 -0
  595. data/lib/fisk/instructions/vbroadcasti32x2.rb +111 -0
  596. data/lib/fisk/instructions/vbroadcasti32x4.rb +43 -0
  597. data/lib/fisk/instructions/vbroadcasti32x8.rb +26 -0
  598. data/lib/fisk/instructions/vbroadcasti64x2.rb +43 -0
  599. data/lib/fisk/instructions/vbroadcasti64x4.rb +26 -0
  600. data/lib/fisk/instructions/vbroadcastsd.rb +111 -0
  601. data/lib/fisk/instructions/vbroadcastss.rb +145 -0
  602. data/lib/fisk/instructions/vcmppd.rb +210 -0
  603. data/lib/fisk/instructions/vcmpps.rb +210 -0
  604. data/lib/fisk/instructions/vcmpsd.rb +90 -0
  605. data/lib/fisk/instructions/vcmpss.rb +90 -0
  606. data/lib/fisk/instructions/vcomisd.rb +78 -0
  607. data/lib/fisk/instructions/vcomiss.rb +78 -0
  608. data/lib/fisk/instructions/vcompresspd.rb +111 -0
  609. data/lib/fisk/instructions/vcompressps.rb +111 -0
  610. data/lib/fisk/instructions/vcvtdq2pd.rb +179 -0
  611. data/lib/fisk/instructions/vcvtdq2ps.rb +180 -0
  612. data/lib/fisk/instructions/vcvtpd2dq.rb +180 -0
  613. data/lib/fisk/instructions/vcvtpd2ps.rb +180 -0
  614. data/lib/fisk/instructions/vcvtpd2qq.rb +112 -0
  615. data/lib/fisk/instructions/vcvtpd2udq.rb +112 -0
  616. data/lib/fisk/instructions/vcvtpd2uqq.rb +112 -0
  617. data/lib/fisk/instructions/vcvtph2ps.rb +180 -0
  618. data/lib/fisk/instructions/vcvtps2dq.rb +180 -0
  619. data/lib/fisk/instructions/vcvtps2pd.rb +180 -0
  620. data/lib/fisk/instructions/vcvtps2ph.rb +200 -0
  621. data/lib/fisk/instructions/vcvtps2qq.rb +112 -0
  622. data/lib/fisk/instructions/vcvtps2udq.rb +112 -0
  623. data/lib/fisk/instructions/vcvtps2uqq.rb +112 -0
  624. data/lib/fisk/instructions/vcvtqq2pd.rb +112 -0
  625. data/lib/fisk/instructions/vcvtqq2ps.rb +112 -0
  626. data/lib/fisk/instructions/vcvtsd2si.rb +147 -0
  627. data/lib/fisk/instructions/vcvtsd2ss.rb +82 -0
  628. data/lib/fisk/instructions/vcvtsd2usi.rb +79 -0
  629. data/lib/fisk/instructions/vcvtsi2sd.rb +154 -0
  630. data/lib/fisk/instructions/vcvtsi2ss.rb +155 -0
  631. data/lib/fisk/instructions/vcvtss2sd.rb +82 -0
  632. data/lib/fisk/instructions/vcvtss2si.rb +147 -0
  633. data/lib/fisk/instructions/vcvtss2usi.rb +79 -0
  634. data/lib/fisk/instructions/vcvttpd2dq.rb +180 -0
  635. data/lib/fisk/instructions/vcvttpd2qq.rb +112 -0
  636. data/lib/fisk/instructions/vcvttpd2udq.rb +112 -0
  637. data/lib/fisk/instructions/vcvttpd2uqq.rb +112 -0
  638. data/lib/fisk/instructions/vcvttps2dq.rb +180 -0
  639. data/lib/fisk/instructions/vcvttps2qq.rb +112 -0
  640. data/lib/fisk/instructions/vcvttps2udq.rb +112 -0
  641. data/lib/fisk/instructions/vcvttps2uqq.rb +112 -0
  642. data/lib/fisk/instructions/vcvttsd2si.rb +147 -0
  643. data/lib/fisk/instructions/vcvttsd2usi.rb +79 -0
  644. data/lib/fisk/instructions/vcvttss2si.rb +147 -0
  645. data/lib/fisk/instructions/vcvttss2usi.rb +79 -0
  646. data/lib/fisk/instructions/vcvtudq2pd.rb +111 -0
  647. data/lib/fisk/instructions/vcvtudq2ps.rb +112 -0
  648. data/lib/fisk/instructions/vcvtuqq2pd.rb +112 -0
  649. data/lib/fisk/instructions/vcvtuqq2ps.rb +112 -0
  650. data/lib/fisk/instructions/vcvtusi2sd.rb +82 -0
  651. data/lib/fisk/instructions/vcvtusi2ss.rb +83 -0
  652. data/lib/fisk/instructions/vdbpsadbw.rb +129 -0
  653. data/lib/fisk/instructions/vdivpd.rb +190 -0
  654. data/lib/fisk/instructions/vdivps.rb +190 -0
  655. data/lib/fisk/instructions/vdivsd.rb +82 -0
  656. data/lib/fisk/instructions/vdivss.rb +82 -0
  657. data/lib/fisk/instructions/vdppd.rb +49 -0
  658. data/lib/fisk/instructions/vdpps.rb +89 -0
  659. data/lib/fisk/instructions/vexp2pd.rb +44 -0
  660. data/lib/fisk/instructions/vexp2ps.rb +44 -0
  661. data/lib/fisk/instructions/vexpandpd.rb +111 -0
  662. data/lib/fisk/instructions/vexpandps.rb +111 -0
  663. data/lib/fisk/instructions/vextractf128.rb +47 -0
  664. data/lib/fisk/instructions/vextractf32x4.rb +85 -0
  665. data/lib/fisk/instructions/vextractf32x8.rb +47 -0
  666. data/lib/fisk/instructions/vextractf64x2.rb +85 -0
  667. data/lib/fisk/instructions/vextractf64x4.rb +47 -0
  668. data/lib/fisk/instructions/vextracti128.rb +47 -0
  669. data/lib/fisk/instructions/vextracti32x4.rb +85 -0
  670. data/lib/fisk/instructions/vextracti32x8.rb +47 -0
  671. data/lib/fisk/instructions/vextracti64x2.rb +85 -0
  672. data/lib/fisk/instructions/vextracti64x4.rb +47 -0
  673. data/lib/fisk/instructions/vextractps.rb +85 -0
  674. data/lib/fisk/instructions/vfixupimmpd.rb +130 -0
  675. data/lib/fisk/instructions/vfixupimmps.rb +130 -0
  676. data/lib/fisk/instructions/vfixupimmsd.rb +50 -0
  677. data/lib/fisk/instructions/vfixupimmss.rb +50 -0
  678. data/lib/fisk/instructions/vfmadd132pd.rb +190 -0
  679. data/lib/fisk/instructions/vfmadd132ps.rb +190 -0
  680. data/lib/fisk/instructions/vfmadd132sd.rb +82 -0
  681. data/lib/fisk/instructions/vfmadd132ss.rb +82 -0
  682. data/lib/fisk/instructions/vfmadd213pd.rb +190 -0
  683. data/lib/fisk/instructions/vfmadd213ps.rb +190 -0
  684. data/lib/fisk/instructions/vfmadd213sd.rb +82 -0
  685. data/lib/fisk/instructions/vfmadd213ss.rb +82 -0
  686. data/lib/fisk/instructions/vfmadd231pd.rb +190 -0
  687. data/lib/fisk/instructions/vfmadd231ps.rb +190 -0
  688. data/lib/fisk/instructions/vfmadd231sd.rb +82 -0
  689. data/lib/fisk/instructions/vfmadd231ss.rb +82 -0
  690. data/lib/fisk/instructions/vfmaddpd.rb +153 -0
  691. data/lib/fisk/instructions/vfmaddps.rb +153 -0
  692. data/lib/fisk/instructions/vfmaddsd.rb +81 -0
  693. data/lib/fisk/instructions/vfmaddss.rb +81 -0
  694. data/lib/fisk/instructions/vfmaddsub132pd.rb +190 -0
  695. data/lib/fisk/instructions/vfmaddsub132ps.rb +190 -0
  696. data/lib/fisk/instructions/vfmaddsub213pd.rb +190 -0
  697. data/lib/fisk/instructions/vfmaddsub213ps.rb +190 -0
  698. data/lib/fisk/instructions/vfmaddsub231pd.rb +190 -0
  699. data/lib/fisk/instructions/vfmaddsub231ps.rb +190 -0
  700. data/lib/fisk/instructions/vfmaddsubpd.rb +153 -0
  701. data/lib/fisk/instructions/vfmaddsubps.rb +153 -0
  702. data/lib/fisk/instructions/vfmsub132pd.rb +190 -0
  703. data/lib/fisk/instructions/vfmsub132ps.rb +190 -0
  704. data/lib/fisk/instructions/vfmsub132sd.rb +82 -0
  705. data/lib/fisk/instructions/vfmsub132ss.rb +82 -0
  706. data/lib/fisk/instructions/vfmsub213pd.rb +190 -0
  707. data/lib/fisk/instructions/vfmsub213ps.rb +190 -0
  708. data/lib/fisk/instructions/vfmsub213sd.rb +82 -0
  709. data/lib/fisk/instructions/vfmsub213ss.rb +82 -0
  710. data/lib/fisk/instructions/vfmsub231pd.rb +190 -0
  711. data/lib/fisk/instructions/vfmsub231ps.rb +190 -0
  712. data/lib/fisk/instructions/vfmsub231sd.rb +82 -0
  713. data/lib/fisk/instructions/vfmsub231ss.rb +82 -0
  714. data/lib/fisk/instructions/vfmsubadd132pd.rb +190 -0
  715. data/lib/fisk/instructions/vfmsubadd132ps.rb +190 -0
  716. data/lib/fisk/instructions/vfmsubadd213pd.rb +190 -0
  717. data/lib/fisk/instructions/vfmsubadd213ps.rb +190 -0
  718. data/lib/fisk/instructions/vfmsubadd231pd.rb +190 -0
  719. data/lib/fisk/instructions/vfmsubadd231ps.rb +190 -0
  720. data/lib/fisk/instructions/vfmsubaddpd.rb +153 -0
  721. data/lib/fisk/instructions/vfmsubaddps.rb +153 -0
  722. data/lib/fisk/instructions/vfmsubpd.rb +153 -0
  723. data/lib/fisk/instructions/vfmsubps.rb +153 -0
  724. data/lib/fisk/instructions/vfmsubsd.rb +81 -0
  725. data/lib/fisk/instructions/vfmsubss.rb +81 -0
  726. data/lib/fisk/instructions/vfnmadd132pd.rb +190 -0
  727. data/lib/fisk/instructions/vfnmadd132ps.rb +190 -0
  728. data/lib/fisk/instructions/vfnmadd132sd.rb +82 -0
  729. data/lib/fisk/instructions/vfnmadd132ss.rb +82 -0
  730. data/lib/fisk/instructions/vfnmadd213pd.rb +190 -0
  731. data/lib/fisk/instructions/vfnmadd213ps.rb +190 -0
  732. data/lib/fisk/instructions/vfnmadd213sd.rb +82 -0
  733. data/lib/fisk/instructions/vfnmadd213ss.rb +82 -0
  734. data/lib/fisk/instructions/vfnmadd231pd.rb +190 -0
  735. data/lib/fisk/instructions/vfnmadd231ps.rb +190 -0
  736. data/lib/fisk/instructions/vfnmadd231sd.rb +82 -0
  737. data/lib/fisk/instructions/vfnmadd231ss.rb +82 -0
  738. data/lib/fisk/instructions/vfnmaddpd.rb +153 -0
  739. data/lib/fisk/instructions/vfnmaddps.rb +153 -0
  740. data/lib/fisk/instructions/vfnmaddsd.rb +81 -0
  741. data/lib/fisk/instructions/vfnmaddss.rb +81 -0
  742. data/lib/fisk/instructions/vfnmsub132pd.rb +190 -0
  743. data/lib/fisk/instructions/vfnmsub132ps.rb +190 -0
  744. data/lib/fisk/instructions/vfnmsub132sd.rb +82 -0
  745. data/lib/fisk/instructions/vfnmsub132ss.rb +82 -0
  746. data/lib/fisk/instructions/vfnmsub213pd.rb +190 -0
  747. data/lib/fisk/instructions/vfnmsub213ps.rb +190 -0
  748. data/lib/fisk/instructions/vfnmsub213sd.rb +82 -0
  749. data/lib/fisk/instructions/vfnmsub213ss.rb +82 -0
  750. data/lib/fisk/instructions/vfnmsub231pd.rb +190 -0
  751. data/lib/fisk/instructions/vfnmsub231ps.rb +190 -0
  752. data/lib/fisk/instructions/vfnmsub231sd.rb +82 -0
  753. data/lib/fisk/instructions/vfnmsub231ss.rb +82 -0
  754. data/lib/fisk/instructions/vfnmsubpd.rb +153 -0
  755. data/lib/fisk/instructions/vfnmsubps.rb +153 -0
  756. data/lib/fisk/instructions/vfnmsubsd.rb +81 -0
  757. data/lib/fisk/instructions/vfnmsubss.rb +81 -0
  758. data/lib/fisk/instructions/vfpclasspd.rb +123 -0
  759. data/lib/fisk/instructions/vfpclassps.rb +123 -0
  760. data/lib/fisk/instructions/vfpclasssd.rb +47 -0
  761. data/lib/fisk/instructions/vfpclassss.rb +47 -0
  762. data/lib/fisk/instructions/vfrczpd.rb +77 -0
  763. data/lib/fisk/instructions/vfrczps.rb +77 -0
  764. data/lib/fisk/instructions/vfrczsd.rb +43 -0
  765. data/lib/fisk/instructions/vfrczss.rb +43 -0
  766. data/lib/fisk/instructions/vgatherdpd.rb +96 -0
  767. data/lib/fisk/instructions/vgatherdps.rb +96 -0
  768. data/lib/fisk/instructions/vgatherpf0dpd.rb +25 -0
  769. data/lib/fisk/instructions/vgatherpf0dps.rb +25 -0
  770. data/lib/fisk/instructions/vgatherpf0qpd.rb +25 -0
  771. data/lib/fisk/instructions/vgatherpf0qps.rb +25 -0
  772. data/lib/fisk/instructions/vgatherpf1dpd.rb +25 -0
  773. data/lib/fisk/instructions/vgatherpf1dps.rb +25 -0
  774. data/lib/fisk/instructions/vgatherpf1qpd.rb +25 -0
  775. data/lib/fisk/instructions/vgatherpf1qps.rb +25 -0
  776. data/lib/fisk/instructions/vgatherqpd.rb +96 -0
  777. data/lib/fisk/instructions/vgatherqps.rb +96 -0
  778. data/lib/fisk/instructions/vgetexppd.rb +112 -0
  779. data/lib/fisk/instructions/vgetexpps.rb +112 -0
  780. data/lib/fisk/instructions/vgetexpsd.rb +46 -0
  781. data/lib/fisk/instructions/vgetexpss.rb +46 -0
  782. data/lib/fisk/instructions/vgetmantpd.rb +124 -0
  783. data/lib/fisk/instructions/vgetmantps.rb +124 -0
  784. data/lib/fisk/instructions/vgetmantsd.rb +50 -0
  785. data/lib/fisk/instructions/vgetmantss.rb +50 -0
  786. data/lib/fisk/instructions/vhaddpd.rb +81 -0
  787. data/lib/fisk/instructions/vhaddps.rb +81 -0
  788. data/lib/fisk/instructions/vhsubpd.rb +81 -0
  789. data/lib/fisk/instructions/vhsubps.rb +81 -0
  790. data/lib/fisk/instructions/vinsertf128.rb +49 -0
  791. data/lib/fisk/instructions/vinsertf32x4.rb +89 -0
  792. data/lib/fisk/instructions/vinsertf32x8.rb +49 -0
  793. data/lib/fisk/instructions/vinsertf64x2.rb +89 -0
  794. data/lib/fisk/instructions/vinsertf64x4.rb +49 -0
  795. data/lib/fisk/instructions/vinserti128.rb +49 -0
  796. data/lib/fisk/instructions/vinserti32x4.rb +89 -0
  797. data/lib/fisk/instructions/vinserti32x8.rb +49 -0
  798. data/lib/fisk/instructions/vinserti64x2.rb +89 -0
  799. data/lib/fisk/instructions/vinserti64x4.rb +49 -0
  800. data/lib/fisk/instructions/vinsertps.rb +89 -0
  801. data/lib/fisk/instructions/vlddqu.rb +43 -0
  802. data/lib/fisk/instructions/vldmxcsr.rb +25 -0
  803. data/lib/fisk/instructions/vmaskmovdqu.rb +26 -0
  804. data/lib/fisk/instructions/vmaskmovpd.rb +81 -0
  805. data/lib/fisk/instructions/vmaskmovps.rb +81 -0
  806. data/lib/fisk/instructions/vmaxpd.rb +190 -0
  807. data/lib/fisk/instructions/vmaxps.rb +190 -0
  808. data/lib/fisk/instructions/vmaxsd.rb +82 -0
  809. data/lib/fisk/instructions/vmaxss.rb +82 -0
  810. data/lib/fisk/instructions/vminpd.rb +190 -0
  811. data/lib/fisk/instructions/vminps.rb +190 -0
  812. data/lib/fisk/instructions/vminsd.rb +82 -0
  813. data/lib/fisk/instructions/vminss.rb +82 -0
  814. data/lib/fisk/instructions/vmovapd.rb +319 -0
  815. data/lib/fisk/instructions/vmovaps.rb +319 -0
  816. data/lib/fisk/instructions/vmovd.rb +145 -0
  817. data/lib/fisk/instructions/vmovddup.rb +179 -0
  818. data/lib/fisk/instructions/vmovdqa.rb +133 -0
  819. data/lib/fisk/instructions/vmovdqa32.rb +195 -0
  820. data/lib/fisk/instructions/vmovdqa64.rb +195 -0
  821. data/lib/fisk/instructions/vmovdqu.rb +133 -0
  822. data/lib/fisk/instructions/vmovdqu16.rb +195 -0
  823. data/lib/fisk/instructions/vmovdqu32.rb +195 -0
  824. data/lib/fisk/instructions/vmovdqu64.rb +195 -0
  825. data/lib/fisk/instructions/vmovdqu8.rb +195 -0
  826. data/lib/fisk/instructions/vmovhlps.rb +45 -0
  827. data/lib/fisk/instructions/vmovhpd.rb +79 -0
  828. data/lib/fisk/instructions/vmovhps.rb +79 -0
  829. data/lib/fisk/instructions/vmovlhps.rb +45 -0
  830. data/lib/fisk/instructions/vmovlpd.rb +79 -0
  831. data/lib/fisk/instructions/vmovlps.rb +79 -0
  832. data/lib/fisk/instructions/vmovmskpd.rb +43 -0
  833. data/lib/fisk/instructions/vmovmskps.rb +43 -0
  834. data/lib/fisk/instructions/vmovntdq.rb +94 -0
  835. data/lib/fisk/instructions/vmovntdqa.rb +94 -0
  836. data/lib/fisk/instructions/vmovntpd.rb +94 -0
  837. data/lib/fisk/instructions/vmovntps.rb +94 -0
  838. data/lib/fisk/instructions/vmovq.rb +245 -0
  839. data/lib/fisk/instructions/vmovsd.rb +135 -0
  840. data/lib/fisk/instructions/vmovshdup.rb +179 -0
  841. data/lib/fisk/instructions/vmovsldup.rb +179 -0
  842. data/lib/fisk/instructions/vmovss.rb +135 -0
  843. data/lib/fisk/instructions/vmovupd.rb +319 -0
  844. data/lib/fisk/instructions/vmovups.rb +319 -0
  845. data/lib/fisk/instructions/vmpsadbw.rb +89 -0
  846. data/lib/fisk/instructions/vmulpd.rb +190 -0
  847. data/lib/fisk/instructions/vmulps.rb +190 -0
  848. data/lib/fisk/instructions/vmulsd.rb +82 -0
  849. data/lib/fisk/instructions/vmulss.rb +82 -0
  850. data/lib/fisk/instructions/vorpd.rb +189 -0
  851. data/lib/fisk/instructions/vorps.rb +189 -0
  852. data/lib/fisk/instructions/vpabsb.rb +179 -0
  853. data/lib/fisk/instructions/vpabsd.rb +179 -0
  854. data/lib/fisk/instructions/vpabsq.rb +111 -0
  855. data/lib/fisk/instructions/vpabsw.rb +179 -0
  856. data/lib/fisk/instructions/vpackssdw.rb +189 -0
  857. data/lib/fisk/instructions/vpacksswb.rb +189 -0
  858. data/lib/fisk/instructions/vpackusdw.rb +189 -0
  859. data/lib/fisk/instructions/vpackuswb.rb +189 -0
  860. data/lib/fisk/instructions/vpaddb.rb +189 -0
  861. data/lib/fisk/instructions/vpaddd.rb +189 -0
  862. data/lib/fisk/instructions/vpaddq.rb +189 -0
  863. data/lib/fisk/instructions/vpaddsb.rb +189 -0
  864. data/lib/fisk/instructions/vpaddsw.rb +189 -0
  865. data/lib/fisk/instructions/vpaddusb.rb +189 -0
  866. data/lib/fisk/instructions/vpaddusw.rb +189 -0
  867. data/lib/fisk/instructions/vpaddw.rb +189 -0
  868. data/lib/fisk/instructions/vpalignr.rb +209 -0
  869. data/lib/fisk/instructions/vpand.rb +81 -0
  870. data/lib/fisk/instructions/vpandd.rb +117 -0
  871. data/lib/fisk/instructions/vpandn.rb +81 -0
  872. data/lib/fisk/instructions/vpandnd.rb +117 -0
  873. data/lib/fisk/instructions/vpandnq.rb +117 -0
  874. data/lib/fisk/instructions/vpandq.rb +117 -0
  875. data/lib/fisk/instructions/vpavgb.rb +189 -0
  876. data/lib/fisk/instructions/vpavgw.rb +189 -0
  877. data/lib/fisk/instructions/vpblendd.rb +89 -0
  878. data/lib/fisk/instructions/vpblendmb.rb +117 -0
  879. data/lib/fisk/instructions/vpblendmd.rb +117 -0
  880. data/lib/fisk/instructions/vpblendmq.rb +117 -0
  881. data/lib/fisk/instructions/vpblendmw.rb +117 -0
  882. data/lib/fisk/instructions/vpblendvb.rb +89 -0
  883. data/lib/fisk/instructions/vpblendw.rb +89 -0
  884. data/lib/fisk/instructions/vpbroadcastb.rb +230 -0
  885. data/lib/fisk/instructions/vpbroadcastd.rb +230 -0
  886. data/lib/fisk/instructions/vpbroadcastmb2q.rb +60 -0
  887. data/lib/fisk/instructions/vpbroadcastmw2d.rb +60 -0
  888. data/lib/fisk/instructions/vpbroadcastq.rb +230 -0
  889. data/lib/fisk/instructions/vpbroadcastw.rb +230 -0
  890. data/lib/fisk/instructions/vpclmulqdq.rb +49 -0
  891. data/lib/fisk/instructions/vpcmov.rb +153 -0
  892. data/lib/fisk/instructions/vpcmpb.rb +129 -0
  893. data/lib/fisk/instructions/vpcmpd.rb +129 -0
  894. data/lib/fisk/instructions/vpcmpeqb.rb +189 -0
  895. data/lib/fisk/instructions/vpcmpeqd.rb +189 -0
  896. data/lib/fisk/instructions/vpcmpeqq.rb +189 -0
  897. data/lib/fisk/instructions/vpcmpeqw.rb +189 -0
  898. data/lib/fisk/instructions/vpcmpestri.rb +47 -0
  899. data/lib/fisk/instructions/vpcmpestrm.rb +47 -0
  900. data/lib/fisk/instructions/vpcmpgtb.rb +189 -0
  901. data/lib/fisk/instructions/vpcmpgtd.rb +189 -0
  902. data/lib/fisk/instructions/vpcmpgtq.rb +189 -0
  903. data/lib/fisk/instructions/vpcmpgtw.rb +189 -0
  904. data/lib/fisk/instructions/vpcmpistri.rb +47 -0
  905. data/lib/fisk/instructions/vpcmpistrm.rb +47 -0
  906. data/lib/fisk/instructions/vpcmpq.rb +129 -0
  907. data/lib/fisk/instructions/vpcmpub.rb +129 -0
  908. data/lib/fisk/instructions/vpcmpud.rb +129 -0
  909. data/lib/fisk/instructions/vpcmpuq.rb +129 -0
  910. data/lib/fisk/instructions/vpcmpuw.rb +129 -0
  911. data/lib/fisk/instructions/vpcmpw.rb +129 -0
  912. data/lib/fisk/instructions/vpcomb.rb +49 -0
  913. data/lib/fisk/instructions/vpcomd.rb +49 -0
  914. data/lib/fisk/instructions/vpcompressd.rb +111 -0
  915. data/lib/fisk/instructions/vpcompressq.rb +111 -0
  916. data/lib/fisk/instructions/vpcomq.rb +49 -0
  917. data/lib/fisk/instructions/vpcomub.rb +49 -0
  918. data/lib/fisk/instructions/vpcomud.rb +49 -0
  919. data/lib/fisk/instructions/vpcomuq.rb +49 -0
  920. data/lib/fisk/instructions/vpcomuw.rb +49 -0
  921. data/lib/fisk/instructions/vpcomw.rb +49 -0
  922. data/lib/fisk/instructions/vpconflictd.rb +111 -0
  923. data/lib/fisk/instructions/vpconflictq.rb +111 -0
  924. data/lib/fisk/instructions/vperm2f128.rb +49 -0
  925. data/lib/fisk/instructions/vperm2i128.rb +49 -0
  926. data/lib/fisk/instructions/vpermb.rb +117 -0
  927. data/lib/fisk/instructions/vpermd.rb +117 -0
  928. data/lib/fisk/instructions/vpermi2b.rb +117 -0
  929. data/lib/fisk/instructions/vpermi2d.rb +117 -0
  930. data/lib/fisk/instructions/vpermi2pd.rb +117 -0
  931. data/lib/fisk/instructions/vpermi2ps.rb +117 -0
  932. data/lib/fisk/instructions/vpermi2q.rb +117 -0
  933. data/lib/fisk/instructions/vpermi2w.rb +117 -0
  934. data/lib/fisk/instructions/vpermil2pd.rb +159 -0
  935. data/lib/fisk/instructions/vpermil2ps.rb +159 -0
  936. data/lib/fisk/instructions/vpermilpd.rb +379 -0
  937. data/lib/fisk/instructions/vpermilps.rb +379 -0
  938. data/lib/fisk/instructions/vpermpd.rb +195 -0
  939. data/lib/fisk/instructions/vpermps.rb +117 -0
  940. data/lib/fisk/instructions/vpermq.rb +195 -0
  941. data/lib/fisk/instructions/vpermt2b.rb +117 -0
  942. data/lib/fisk/instructions/vpermt2d.rb +117 -0
  943. data/lib/fisk/instructions/vpermt2pd.rb +117 -0
  944. data/lib/fisk/instructions/vpermt2ps.rb +117 -0
  945. data/lib/fisk/instructions/vpermt2q.rb +117 -0
  946. data/lib/fisk/instructions/vpermt2w.rb +117 -0
  947. data/lib/fisk/instructions/vpermw.rb +117 -0
  948. data/lib/fisk/instructions/vpexpandd.rb +111 -0
  949. data/lib/fisk/instructions/vpexpandq.rb +111 -0
  950. data/lib/fisk/instructions/vpextrb.rb +85 -0
  951. data/lib/fisk/instructions/vpextrd.rb +85 -0
  952. data/lib/fisk/instructions/vpextrq.rb +85 -0
  953. data/lib/fisk/instructions/vpextrw.rb +109 -0
  954. data/lib/fisk/instructions/vpgatherdd.rb +96 -0
  955. data/lib/fisk/instructions/vpgatherdq.rb +96 -0
  956. data/lib/fisk/instructions/vpgatherqd.rb +96 -0
  957. data/lib/fisk/instructions/vpgatherqq.rb +96 -0
  958. data/lib/fisk/instructions/vphaddbd.rb +43 -0
  959. data/lib/fisk/instructions/vphaddbq.rb +43 -0
  960. data/lib/fisk/instructions/vphaddbw.rb +43 -0
  961. data/lib/fisk/instructions/vphaddd.rb +81 -0
  962. data/lib/fisk/instructions/vphadddq.rb +43 -0
  963. data/lib/fisk/instructions/vphaddsw.rb +81 -0
  964. data/lib/fisk/instructions/vphaddubd.rb +43 -0
  965. data/lib/fisk/instructions/vphaddubq.rb +43 -0
  966. data/lib/fisk/instructions/vphaddubw.rb +43 -0
  967. data/lib/fisk/instructions/vphaddudq.rb +43 -0
  968. data/lib/fisk/instructions/vphadduwd.rb +43 -0
  969. data/lib/fisk/instructions/vphadduwq.rb +43 -0
  970. data/lib/fisk/instructions/vphaddw.rb +81 -0
  971. data/lib/fisk/instructions/vphaddwd.rb +43 -0
  972. data/lib/fisk/instructions/vphaddwq.rb +43 -0
  973. data/lib/fisk/instructions/vphminposuw.rb +43 -0
  974. data/lib/fisk/instructions/vphsubbw.rb +43 -0
  975. data/lib/fisk/instructions/vphsubd.rb +81 -0
  976. data/lib/fisk/instructions/vphsubdq.rb +43 -0
  977. data/lib/fisk/instructions/vphsubsw.rb +81 -0
  978. data/lib/fisk/instructions/vphsubw.rb +81 -0
  979. data/lib/fisk/instructions/vphsubwd.rb +43 -0
  980. data/lib/fisk/instructions/vpinsrb.rb +89 -0
  981. data/lib/fisk/instructions/vpinsrd.rb +89 -0
  982. data/lib/fisk/instructions/vpinsrq.rb +89 -0
  983. data/lib/fisk/instructions/vpinsrw.rb +89 -0
  984. data/lib/fisk/instructions/vplzcntd.rb +111 -0
  985. data/lib/fisk/instructions/vplzcntq.rb +111 -0
  986. data/lib/fisk/instructions/vpmacsdd.rb +49 -0
  987. data/lib/fisk/instructions/vpmacsdqh.rb +49 -0
  988. data/lib/fisk/instructions/vpmacsdql.rb +49 -0
  989. data/lib/fisk/instructions/vpmacssdd.rb +49 -0
  990. data/lib/fisk/instructions/vpmacssdqh.rb +49 -0
  991. data/lib/fisk/instructions/vpmacssdql.rb +49 -0
  992. data/lib/fisk/instructions/vpmacsswd.rb +49 -0
  993. data/lib/fisk/instructions/vpmacssww.rb +49 -0
  994. data/lib/fisk/instructions/vpmacswd.rb +49 -0
  995. data/lib/fisk/instructions/vpmacsww.rb +49 -0
  996. data/lib/fisk/instructions/vpmadcsswd.rb +49 -0
  997. data/lib/fisk/instructions/vpmadcswd.rb +49 -0
  998. data/lib/fisk/instructions/vpmadd52huq.rb +117 -0
  999. data/lib/fisk/instructions/vpmadd52luq.rb +117 -0
  1000. data/lib/fisk/instructions/vpmaddubsw.rb +189 -0
  1001. data/lib/fisk/instructions/vpmaddwd.rb +189 -0
  1002. data/lib/fisk/instructions/vpmaskmovd.rb +81 -0
  1003. data/lib/fisk/instructions/vpmaskmovq.rb +81 -0
  1004. data/lib/fisk/instructions/vpmaxsb.rb +189 -0
  1005. data/lib/fisk/instructions/vpmaxsd.rb +189 -0
  1006. data/lib/fisk/instructions/vpmaxsq.rb +117 -0
  1007. data/lib/fisk/instructions/vpmaxsw.rb +189 -0
  1008. data/lib/fisk/instructions/vpmaxub.rb +189 -0
  1009. data/lib/fisk/instructions/vpmaxud.rb +189 -0
  1010. data/lib/fisk/instructions/vpmaxuq.rb +117 -0
  1011. data/lib/fisk/instructions/vpmaxuw.rb +189 -0
  1012. data/lib/fisk/instructions/vpminsb.rb +189 -0
  1013. data/lib/fisk/instructions/vpminsd.rb +189 -0
  1014. data/lib/fisk/instructions/vpminsq.rb +117 -0
  1015. data/lib/fisk/instructions/vpminsw.rb +189 -0
  1016. data/lib/fisk/instructions/vpminub.rb +189 -0
  1017. data/lib/fisk/instructions/vpminud.rb +189 -0
  1018. data/lib/fisk/instructions/vpminuq.rb +117 -0
  1019. data/lib/fisk/instructions/vpminuw.rb +189 -0
  1020. data/lib/fisk/instructions/vpmovb2m.rb +60 -0
  1021. data/lib/fisk/instructions/vpmovd2m.rb +60 -0
  1022. data/lib/fisk/instructions/vpmovdb.rb +111 -0
  1023. data/lib/fisk/instructions/vpmovdw.rb +111 -0
  1024. data/lib/fisk/instructions/vpmovm2b.rb +60 -0
  1025. data/lib/fisk/instructions/vpmovm2d.rb +60 -0
  1026. data/lib/fisk/instructions/vpmovm2q.rb +60 -0
  1027. data/lib/fisk/instructions/vpmovm2w.rb +60 -0
  1028. data/lib/fisk/instructions/vpmovmskb.rb +43 -0
  1029. data/lib/fisk/instructions/vpmovq2m.rb +60 -0
  1030. data/lib/fisk/instructions/vpmovqb.rb +111 -0
  1031. data/lib/fisk/instructions/vpmovqd.rb +111 -0
  1032. data/lib/fisk/instructions/vpmovqw.rb +111 -0
  1033. data/lib/fisk/instructions/vpmovsdb.rb +111 -0
  1034. data/lib/fisk/instructions/vpmovsdw.rb +111 -0
  1035. data/lib/fisk/instructions/vpmovsqb.rb +111 -0
  1036. data/lib/fisk/instructions/vpmovsqd.rb +111 -0
  1037. data/lib/fisk/instructions/vpmovsqw.rb +111 -0
  1038. data/lib/fisk/instructions/vpmovswb.rb +111 -0
  1039. data/lib/fisk/instructions/vpmovsxbd.rb +179 -0
  1040. data/lib/fisk/instructions/vpmovsxbq.rb +179 -0
  1041. data/lib/fisk/instructions/vpmovsxbw.rb +179 -0
  1042. data/lib/fisk/instructions/vpmovsxdq.rb +179 -0
  1043. data/lib/fisk/instructions/vpmovsxwd.rb +179 -0
  1044. data/lib/fisk/instructions/vpmovsxwq.rb +179 -0
  1045. data/lib/fisk/instructions/vpmovusdb.rb +111 -0
  1046. data/lib/fisk/instructions/vpmovusdw.rb +111 -0
  1047. data/lib/fisk/instructions/vpmovusqb.rb +111 -0
  1048. data/lib/fisk/instructions/vpmovusqd.rb +111 -0
  1049. data/lib/fisk/instructions/vpmovusqw.rb +111 -0
  1050. data/lib/fisk/instructions/vpmovuswb.rb +111 -0
  1051. data/lib/fisk/instructions/vpmovw2m.rb +60 -0
  1052. data/lib/fisk/instructions/vpmovwb.rb +111 -0
  1053. data/lib/fisk/instructions/vpmovzxbd.rb +179 -0
  1054. data/lib/fisk/instructions/vpmovzxbq.rb +179 -0
  1055. data/lib/fisk/instructions/vpmovzxbw.rb +179 -0
  1056. data/lib/fisk/instructions/vpmovzxdq.rb +179 -0
  1057. data/lib/fisk/instructions/vpmovzxwd.rb +179 -0
  1058. data/lib/fisk/instructions/vpmovzxwq.rb +179 -0
  1059. data/lib/fisk/instructions/vpmuldq.rb +189 -0
  1060. data/lib/fisk/instructions/vpmulhrsw.rb +189 -0
  1061. data/lib/fisk/instructions/vpmulhuw.rb +189 -0
  1062. data/lib/fisk/instructions/vpmulhw.rb +189 -0
  1063. data/lib/fisk/instructions/vpmulld.rb +189 -0
  1064. data/lib/fisk/instructions/vpmullq.rb +117 -0
  1065. data/lib/fisk/instructions/vpmullw.rb +189 -0
  1066. data/lib/fisk/instructions/vpmultishiftqb.rb +117 -0
  1067. data/lib/fisk/instructions/vpmuludq.rb +189 -0
  1068. data/lib/fisk/instructions/vpopcntd.rb +43 -0
  1069. data/lib/fisk/instructions/vpopcntq.rb +43 -0
  1070. data/lib/fisk/instructions/vpor.rb +81 -0
  1071. data/lib/fisk/instructions/vpord.rb +117 -0
  1072. data/lib/fisk/instructions/vporq.rb +117 -0
  1073. data/lib/fisk/instructions/vpperm.rb +81 -0
  1074. data/lib/fisk/instructions/vprold.rb +123 -0
  1075. data/lib/fisk/instructions/vprolq.rb +123 -0
  1076. data/lib/fisk/instructions/vprolvd.rb +117 -0
  1077. data/lib/fisk/instructions/vprolvq.rb +117 -0
  1078. data/lib/fisk/instructions/vprord.rb +123 -0
  1079. data/lib/fisk/instructions/vprorq.rb +123 -0
  1080. data/lib/fisk/instructions/vprorvd.rb +117 -0
  1081. data/lib/fisk/instructions/vprorvq.rb +117 -0
  1082. data/lib/fisk/instructions/vprotb.rb +112 -0
  1083. data/lib/fisk/instructions/vprotd.rb +112 -0
  1084. data/lib/fisk/instructions/vprotq.rb +112 -0
  1085. data/lib/fisk/instructions/vprotw.rb +112 -0
  1086. data/lib/fisk/instructions/vpsadbw.rb +189 -0
  1087. data/lib/fisk/instructions/vpscatterdd.rb +60 -0
  1088. data/lib/fisk/instructions/vpscatterdq.rb +60 -0
  1089. data/lib/fisk/instructions/vpscatterqd.rb +60 -0
  1090. data/lib/fisk/instructions/vpscatterqq.rb +60 -0
  1091. data/lib/fisk/instructions/vpshab.rb +74 -0
  1092. data/lib/fisk/instructions/vpshad.rb +74 -0
  1093. data/lib/fisk/instructions/vpshaq.rb +74 -0
  1094. data/lib/fisk/instructions/vpshaw.rb +74 -0
  1095. data/lib/fisk/instructions/vpshlb.rb +74 -0
  1096. data/lib/fisk/instructions/vpshld.rb +74 -0
  1097. data/lib/fisk/instructions/vpshlq.rb +74 -0
  1098. data/lib/fisk/instructions/vpshlw.rb +74 -0
  1099. data/lib/fisk/instructions/vpshufb.rb +189 -0
  1100. data/lib/fisk/instructions/vpshufd.rb +199 -0
  1101. data/lib/fisk/instructions/vpshufhw.rb +199 -0
  1102. data/lib/fisk/instructions/vpshuflw.rb +199 -0
  1103. data/lib/fisk/instructions/vpsignb.rb +81 -0
  1104. data/lib/fisk/instructions/vpsignd.rb +81 -0
  1105. data/lib/fisk/instructions/vpsignw.rb +81 -0
  1106. data/lib/fisk/instructions/vpslld.rb +341 -0
  1107. data/lib/fisk/instructions/vpslldq.rb +161 -0
  1108. data/lib/fisk/instructions/vpsllq.rb +341 -0
  1109. data/lib/fisk/instructions/vpsllvd.rb +189 -0
  1110. data/lib/fisk/instructions/vpsllvq.rb +189 -0
  1111. data/lib/fisk/instructions/vpsllvw.rb +117 -0
  1112. data/lib/fisk/instructions/vpsllw.rb +341 -0
  1113. data/lib/fisk/instructions/vpsrad.rb +341 -0
  1114. data/lib/fisk/instructions/vpsraq.rb +231 -0
  1115. data/lib/fisk/instructions/vpsravd.rb +189 -0
  1116. data/lib/fisk/instructions/vpsravq.rb +117 -0
  1117. data/lib/fisk/instructions/vpsravw.rb +117 -0
  1118. data/lib/fisk/instructions/vpsraw.rb +341 -0
  1119. data/lib/fisk/instructions/vpsrld.rb +341 -0
  1120. data/lib/fisk/instructions/vpsrldq.rb +161 -0
  1121. data/lib/fisk/instructions/vpsrlq.rb +341 -0
  1122. data/lib/fisk/instructions/vpsrlvd.rb +189 -0
  1123. data/lib/fisk/instructions/vpsrlvq.rb +189 -0
  1124. data/lib/fisk/instructions/vpsrlvw.rb +117 -0
  1125. data/lib/fisk/instructions/vpsrlw.rb +341 -0
  1126. data/lib/fisk/instructions/vpsubb.rb +189 -0
  1127. data/lib/fisk/instructions/vpsubd.rb +189 -0
  1128. data/lib/fisk/instructions/vpsubq.rb +189 -0
  1129. data/lib/fisk/instructions/vpsubsb.rb +189 -0
  1130. data/lib/fisk/instructions/vpsubsw.rb +189 -0
  1131. data/lib/fisk/instructions/vpsubusb.rb +189 -0
  1132. data/lib/fisk/instructions/vpsubusw.rb +189 -0
  1133. data/lib/fisk/instructions/vpsubw.rb +189 -0
  1134. data/lib/fisk/instructions/vpternlogd.rb +129 -0
  1135. data/lib/fisk/instructions/vpternlogq.rb +129 -0
  1136. data/lib/fisk/instructions/vptest.rb +77 -0
  1137. data/lib/fisk/instructions/vptestmb.rb +117 -0
  1138. data/lib/fisk/instructions/vptestmd.rb +117 -0
  1139. data/lib/fisk/instructions/vptestmq.rb +117 -0
  1140. data/lib/fisk/instructions/vptestmw.rb +117 -0
  1141. data/lib/fisk/instructions/vptestnmb.rb +117 -0
  1142. data/lib/fisk/instructions/vptestnmd.rb +117 -0
  1143. data/lib/fisk/instructions/vptestnmq.rb +117 -0
  1144. data/lib/fisk/instructions/vptestnmw.rb +117 -0
  1145. data/lib/fisk/instructions/vpunpckhbw.rb +189 -0
  1146. data/lib/fisk/instructions/vpunpckhdq.rb +189 -0
  1147. data/lib/fisk/instructions/vpunpckhqdq.rb +189 -0
  1148. data/lib/fisk/instructions/vpunpckhwd.rb +189 -0
  1149. data/lib/fisk/instructions/vpunpcklbw.rb +189 -0
  1150. data/lib/fisk/instructions/vpunpckldq.rb +189 -0
  1151. data/lib/fisk/instructions/vpunpcklqdq.rb +189 -0
  1152. data/lib/fisk/instructions/vpunpcklwd.rb +189 -0
  1153. data/lib/fisk/instructions/vpxor.rb +81 -0
  1154. data/lib/fisk/instructions/vpxord.rb +117 -0
  1155. data/lib/fisk/instructions/vpxorq.rb +117 -0
  1156. data/lib/fisk/instructions/vrangepd.rb +130 -0
  1157. data/lib/fisk/instructions/vrangeps.rb +130 -0
  1158. data/lib/fisk/instructions/vrangesd.rb +50 -0
  1159. data/lib/fisk/instructions/vrangess.rb +50 -0
  1160. data/lib/fisk/instructions/vrcp14pd.rb +111 -0
  1161. data/lib/fisk/instructions/vrcp14ps.rb +111 -0
  1162. data/lib/fisk/instructions/vrcp14sd.rb +45 -0
  1163. data/lib/fisk/instructions/vrcp14ss.rb +45 -0
  1164. data/lib/fisk/instructions/vrcp28pd.rb +44 -0
  1165. data/lib/fisk/instructions/vrcp28ps.rb +44 -0
  1166. data/lib/fisk/instructions/vrcp28sd.rb +46 -0
  1167. data/lib/fisk/instructions/vrcp28ss.rb +46 -0
  1168. data/lib/fisk/instructions/vrcpps.rb +77 -0
  1169. data/lib/fisk/instructions/vrcpss.rb +45 -0
  1170. data/lib/fisk/instructions/vreducepd.rb +123 -0
  1171. data/lib/fisk/instructions/vreduceps.rb +123 -0
  1172. data/lib/fisk/instructions/vreducesd.rb +49 -0
  1173. data/lib/fisk/instructions/vreducess.rb +49 -0
  1174. data/lib/fisk/instructions/vrndscalepd.rb +124 -0
  1175. data/lib/fisk/instructions/vrndscaleps.rb +124 -0
  1176. data/lib/fisk/instructions/vrndscalesd.rb +50 -0
  1177. data/lib/fisk/instructions/vrndscaless.rb +50 -0
  1178. data/lib/fisk/instructions/vroundpd.rb +85 -0
  1179. data/lib/fisk/instructions/vroundps.rb +85 -0
  1180. data/lib/fisk/instructions/vroundsd.rb +49 -0
  1181. data/lib/fisk/instructions/vroundss.rb +49 -0
  1182. data/lib/fisk/instructions/vrsqrt14pd.rb +111 -0
  1183. data/lib/fisk/instructions/vrsqrt14ps.rb +111 -0
  1184. data/lib/fisk/instructions/vrsqrt14sd.rb +45 -0
  1185. data/lib/fisk/instructions/vrsqrt14ss.rb +45 -0
  1186. data/lib/fisk/instructions/vrsqrt28pd.rb +44 -0
  1187. data/lib/fisk/instructions/vrsqrt28ps.rb +44 -0
  1188. data/lib/fisk/instructions/vrsqrt28sd.rb +46 -0
  1189. data/lib/fisk/instructions/vrsqrt28ss.rb +46 -0
  1190. data/lib/fisk/instructions/vrsqrtps.rb +77 -0
  1191. data/lib/fisk/instructions/vrsqrtss.rb +45 -0
  1192. data/lib/fisk/instructions/vscalefpd.rb +118 -0
  1193. data/lib/fisk/instructions/vscalefps.rb +118 -0
  1194. data/lib/fisk/instructions/vscalefsd.rb +46 -0
  1195. data/lib/fisk/instructions/vscalefss.rb +46 -0
  1196. data/lib/fisk/instructions/vscatterdpd.rb +60 -0
  1197. data/lib/fisk/instructions/vscatterdps.rb +60 -0
  1198. data/lib/fisk/instructions/vscatterpf0dpd.rb +25 -0
  1199. data/lib/fisk/instructions/vscatterpf0dps.rb +25 -0
  1200. data/lib/fisk/instructions/vscatterpf0qpd.rb +25 -0
  1201. data/lib/fisk/instructions/vscatterpf0qps.rb +25 -0
  1202. data/lib/fisk/instructions/vscatterpf1dpd.rb +25 -0
  1203. data/lib/fisk/instructions/vscatterpf1dps.rb +25 -0
  1204. data/lib/fisk/instructions/vscatterpf1qpd.rb +25 -0
  1205. data/lib/fisk/instructions/vscatterpf1qps.rb +25 -0
  1206. data/lib/fisk/instructions/vscatterqpd.rb +60 -0
  1207. data/lib/fisk/instructions/vscatterqps.rb +60 -0
  1208. data/lib/fisk/instructions/vshuff32x4.rb +89 -0
  1209. data/lib/fisk/instructions/vshuff64x2.rb +89 -0
  1210. data/lib/fisk/instructions/vshufi32x4.rb +89 -0
  1211. data/lib/fisk/instructions/vshufi64x2.rb +89 -0
  1212. data/lib/fisk/instructions/vshufpd.rb +209 -0
  1213. data/lib/fisk/instructions/vshufps.rb +209 -0
  1214. data/lib/fisk/instructions/vsqrtpd.rb +180 -0
  1215. data/lib/fisk/instructions/vsqrtps.rb +180 -0
  1216. data/lib/fisk/instructions/vsqrtsd.rb +82 -0
  1217. data/lib/fisk/instructions/vsqrtss.rb +82 -0
  1218. data/lib/fisk/instructions/vstmxcsr.rb +25 -0
  1219. data/lib/fisk/instructions/vsubpd.rb +190 -0
  1220. data/lib/fisk/instructions/vsubps.rb +190 -0
  1221. data/lib/fisk/instructions/vsubsd.rb +82 -0
  1222. data/lib/fisk/instructions/vsubss.rb +82 -0
  1223. data/lib/fisk/instructions/vtestpd.rb +77 -0
  1224. data/lib/fisk/instructions/vtestps.rb +77 -0
  1225. data/lib/fisk/instructions/vucomisd.rb +78 -0
  1226. data/lib/fisk/instructions/vucomiss.rb +78 -0
  1227. data/lib/fisk/instructions/vunpckhpd.rb +189 -0
  1228. data/lib/fisk/instructions/vunpckhps.rb +189 -0
  1229. data/lib/fisk/instructions/vunpcklpd.rb +189 -0
  1230. data/lib/fisk/instructions/vunpcklps.rb +189 -0
  1231. data/lib/fisk/instructions/vxorpd.rb +189 -0
  1232. data/lib/fisk/instructions/vxorps.rb +189 -0
  1233. data/lib/fisk/instructions/vzeroall.rb +20 -0
  1234. data/lib/fisk/instructions/vzeroupper.rb +20 -0
  1235. data/lib/fisk/instructions/xadd.rb +195 -0
  1236. data/lib/fisk/instructions/xchg.rb +451 -0
  1237. data/lib/fisk/instructions/xgetbv.rb +21 -0
  1238. data/lib/fisk/instructions/xlatb.rb +35 -0
  1239. data/lib/fisk/instructions/xor.rb +726 -0
  1240. data/lib/fisk/instructions/xorpd.rb +57 -0
  1241. data/lib/fisk/instructions/xorps.rb +55 -0
  1242. data/lib/fisk/instructions.rb +5067 -0
  1243. data/lib/fisk/version.rb +3 -0
  1244. data/lib/fisk.rb +728 -96
  1245. data/test/helper.rb +11 -0
  1246. data/test/test_cfg.rb +245 -0
  1247. data/test/test_fisk.rb +526 -3
  1248. data/test/test_fisk_written_size.rb +21 -0
  1249. data/test/test_register_allocation.rb +220 -0
  1250. data/test/test_run_fisk.rb +222 -7
  1251. metadata +1302 -7
  1252. data/bin/machine.rb.erb +0 -100
  1253. data/lib/fisk/machine/encoding.rb +0 -78
  1254. data/lib/fisk/machine/generated.rb +0 -124746
  1255. data/lib/fisk/machine.rb +0 -35
data/lib/fisk.rb CHANGED
@@ -1,18 +1,176 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "fisk/machine/encoding"
4
- require "fisk/machine"
3
+ require "stringio"
4
+ require "set"
5
+
6
+ require "fisk/instructions"
7
+ require "fisk/basic_block"
8
+ require "fisk/errors"
9
+ require "fisk/version"
5
10
 
6
11
  class Fisk
12
+ module OperandPredicates
13
+ def unresolved?; false; end
14
+ def register?; false; end
15
+ def temp_register?; false; end
16
+ def extended_register?; false; end
17
+ def memory?; false; end
18
+ def rip?; false; end
19
+ def immediate?; false; end
20
+ def absolute_location?; false; end
21
+ end
22
+
23
+ class Operand
24
+ include OperandPredicates
25
+
26
+ def works? op
27
+ self.type == op.type
28
+ end
29
+
30
+ def rex_value
31
+ value >> 3
32
+ end
33
+
34
+ def op_value
35
+ value
36
+ end
37
+ end
38
+
39
+ class ValueOperand < Operand
40
+ attr_reader :value
41
+ alias :type :value
42
+
43
+ def initialize value
44
+ @value = value
45
+ end
46
+ end
47
+
7
48
  module Registers
8
- class Register < Struct.new(:name, :type, :value)
9
- def works? type
49
+ class Register < Operand
50
+ attr_reader :name, :type, :value
51
+
52
+ def initialize name, type, value
53
+ @name = name
54
+ @type = type
55
+ @value = value
56
+ end
57
+
58
+ def works? op
59
+ type = op.type
10
60
  type == self.name || type == self.type
11
61
  end
12
62
 
13
- def unknown_label?; false; end
63
+ def op_value
64
+ value
65
+ end
66
+
67
+ def extended_register?
68
+ @value > 7 || EXTENDED_R8.include?(self)
69
+ end
70
+
71
+ def register?; true; end
72
+
73
+ def to_register
74
+ self
75
+ end
76
+ end
77
+
78
+ class Rip < Operand
79
+ attr_accessor :displacement
80
+
81
+ def initialize displacement
82
+ @displacement = displacement
83
+ end
84
+
85
+ def works? op
86
+ type = op.type
87
+ type == "m64" || type == "m"
88
+ end
89
+
90
+ def unresolved?
91
+ @displacement.is_a?(Fisk::UnknownLabel)
92
+ end
93
+
94
+ def memory?; true; end
95
+ def rip?; true; end
96
+
97
+ def rex_value
98
+ 0x0
99
+ end
100
+
101
+ def op_value
102
+ 0x0
103
+ end
104
+ end
105
+
106
+ class Temp < Operand
107
+ attr_reader :name, :type
108
+ attr_accessor :register, :start_point, :end_point
109
+
110
+ def initialize name, type
111
+ @name = name
112
+ @type = type
113
+ @start_point = nil
114
+ @end_point = nil
115
+ end
116
+
117
+ def temp_register?; true; end
118
+ def register?; true; end
119
+
120
+ def op_value
121
+ reg.op_value
122
+ end
123
+
124
+ def extended_register?
125
+ reg.extended_register?
126
+ end
127
+
128
+ def rex_value
129
+ reg.rex_value
130
+ end
131
+
132
+ def value
133
+ reg.value
134
+ end
135
+
136
+ def to_register
137
+ self
138
+ end
139
+
140
+ def reg
141
+ unless @register
142
+ raise Errors::UnassignedRegister, "Temporary register #{name} hasn't been assigned a real register"
143
+ end
144
+
145
+ @register
146
+ end
14
147
  end
15
148
 
149
+ AL = Register.new "al", "r8", 0
150
+ CL = Register.new "cl", "r8", 1
151
+ DL = Register.new "dl", "r8", 2
152
+ BL = Register.new "bl", "r8", 3
153
+
154
+ SPL = Register.new "spl", "r8", 4
155
+ BPL = Register.new "bpl", "r8", 5
156
+ SIL = Register.new "sil", "r8", 6
157
+ DIL = Register.new "dil", "r8", 7
158
+ EXTENDED_R8 = [SPL, BPL, SIL, DIL]
159
+
160
+ AH = Register.new "ah", "r8", 4
161
+ CH = Register.new "ch", "r8", 5
162
+ DH = Register.new "dh", "r8", 6
163
+ BH = Register.new "bh", "r8", 7
164
+
165
+ AX = Register.new "ax", "r16", 0
166
+ CX = Register.new "cx", "r16", 1
167
+ DX = Register.new "dx", "r16", 2
168
+ BX = Register.new "bx", "r16", 3
169
+ SP = Register.new "sp", "r16", 4
170
+ BP = Register.new "bp", "r16", 5
171
+ SI = Register.new "si", "r16", 6
172
+ DI = Register.new "di", "r16", 7
173
+
16
174
  EAX = Register.new "eax", "r32", 0
17
175
  ECX = Register.new "ecx", "r32", 1
18
176
  EDX = Register.new "edx", "r32", 2
@@ -33,177 +191,521 @@ class Fisk
33
191
  8.times do |i|
34
192
  i += 8
35
193
  const_set "R#{i}", Register.new("r#{i}", "r64", i)
194
+ const_set "R#{i}D", Register.new("r#{i}d", "r32", i)
195
+ const_set "R#{i}W", Register.new("r#{i}w", "r16", i)
196
+ const_set "R#{i}B", Register.new("r#{i}b", "r8", i)
36
197
  end
37
- end
38
198
 
39
- class Operand < Struct.new(:value)
40
- def type; value; end
41
- def works? type; self.type == type; end
42
- def unknown_label?; false; end
199
+ # List of *caller* saved registers for the C calling convention
200
+ CALLER_SAVED = [ RDI, RSI, RDX, RCX, R8, R9, R10, R11 ]
201
+
202
+ # List of *callee* saved registers for the C calling convention
203
+ CALLEE_SAVED = [ RBX, RSP, RBP, R12, R13, R14, R15 ]
43
204
  end
44
205
 
45
- class M64 < Operand
46
- def type
47
- "m64"
206
+ class Memory < Operand
207
+ attr_reader :register, :displacement
208
+
209
+ def initialize register, displacement
210
+ @register = register
211
+ @displacement = displacement
212
+ end
213
+
214
+ def extended_register?
215
+ @register.extended_register?
216
+ end
217
+
218
+ def value
219
+ @register.value
220
+ end
221
+
222
+ def + displacement
223
+ self.class.new(register, self.displacement + displacement)
224
+ end
225
+
226
+ def memory?; true; end
227
+
228
+ def rex_value
229
+ @register.rex_value
48
230
  end
49
231
  end
50
232
 
51
- def m64 x
52
- M64.new x
233
+ [8, 16, 32, 64].each do |size|
234
+ class_eval <<~eostr, __FILE__, __LINE__ + 1
235
+ class M#{size} < Memory
236
+ def type
237
+ "m#{size}"
238
+ end
239
+
240
+ def size; #{size}; end
241
+ end
242
+
243
+ def m#{size} val, displacement = 0; M#{size}.new(val, displacement); end
244
+ eostr
53
245
  end
54
246
 
55
- class Imm8 < Operand
247
+ class M < Memory
56
248
  def type
57
- "imm8"
249
+ "m"
58
250
  end
59
251
  end
60
252
 
61
- class Imm32 < Operand
62
- def type
63
- "imm32"
64
- end
253
+ def rip displacement = 0
254
+ Registers::Rip.new(displacement)
65
255
  end
66
256
 
67
- class Imm64 < Operand
68
- def type
69
- "imm64"
257
+ def m x, displacement = 0
258
+ M.new x, displacement
259
+ end
260
+
261
+ class ImmediateOperand < ValueOperand
262
+ def immediate?; true; end
263
+
264
+ def works? insn_op
265
+ insn_op.immediate? && size <= insn_op.size
70
266
  end
71
267
  end
72
268
 
73
- class Rel8 < Operand
269
+ # Define all immediate value methods of different sizes
270
+ [8, 16, 32, 64].each do |size|
271
+ class_eval <<~eostr, __FILE__, __LINE__ + 1
272
+ class Imm#{size} < ImmediateOperand
273
+ def type
274
+ "imm#{size}"
275
+ end
276
+
277
+ def size; #{size}; end
278
+ end
279
+
280
+ def imm#{size} val; Imm#{size}.new(val.to_i); end
281
+ eostr
282
+ end
283
+
284
+ class Relative < ValueOperand; end
285
+
286
+ class Rel8 < Relative
74
287
  def type
75
288
  "rel8"
76
289
  end
77
290
  end
78
291
 
79
- class Rel32 < Operand
292
+ class Rel32 < Relative
80
293
  def type
81
294
  "rel32"
82
295
  end
83
296
  end
84
297
 
85
- class MOffs64 < Operand
298
+ class MOffs64 < ValueOperand
86
299
  def type
87
300
  "moffs64"
88
301
  end
89
302
  end
90
303
 
91
- class Lit < Operand
304
+ class Lit < ValueOperand
92
305
  def type
93
306
  value.to_s
94
307
  end
95
308
  end
96
309
 
97
- attr_reader :position
310
+ class UnknownLabel < Operand
311
+ attr_reader :name
98
312
 
99
- def initialize
100
- @instructions = []
101
- @labels = {}
102
- @position = 0
103
- end
313
+ def initialize name
314
+ @name = name
315
+ end
104
316
 
105
- class UnknownLabel < Struct.new(:name, :assembler, :insn)
106
- def works? type
317
+ def works? op
318
+ type = op.type
107
319
  type == "rel32"
108
320
  end
109
321
 
110
- def unknown_label?; true; end
111
-
112
- def value
113
- label = assembler.label_for(name)
114
- label.position - (insn.position + insn.bytesize)
115
- end
322
+ def unresolved?; true; end
116
323
  end
117
324
 
118
- class Label < Struct.new(:name, :position)
325
+ module InstructionPredicates
326
+ def retry?; false; end
327
+ def label?; false; end
328
+ def jump?; false; end
329
+ def has_temp_registers?; false; end
330
+ def comment?; false; end
331
+ def lazy?; false; end
119
332
  end
120
333
 
121
- def label_for name
122
- @labels.fetch name
123
- end
334
+ class Label < Struct.new(:name)
335
+ include InstructionPredicates
124
336
 
125
- def label name
126
- UnknownLabel.new(name, self)
337
+ def label?; true; end
127
338
  end
128
339
 
129
- def make_label name
130
- @labels[name] = Label.new(name, position)
131
- end
340
+ class Comment < Struct.new(:message)
341
+ include InstructionPredicates
132
342
 
133
- Registers.constants.grep(/^[A-Z0-9]*$/).each do |const|
134
- val = Registers.const_get const
135
- define_method(const.downcase) { val }
343
+ def comment?; true; end
136
344
  end
137
345
 
138
346
  class Instruction
139
- attr_reader :position
347
+ include InstructionPredicates
140
348
 
141
- def initialize insn, operands, position
349
+ def initialize insn, form, operands
142
350
  @insn = insn
351
+ @form = form
143
352
  @operands = operands
144
- @position = position
353
+ end
354
+
355
+ def has_temp_registers?
356
+ @operands.any?(&:temp_register?)
357
+ end
358
+
359
+ def temp_registers
360
+ @operands.find_all(&:temp_register?)
145
361
  end
146
362
 
147
363
  def encodings
148
- @insn.encodings
364
+ @form.encodings
149
365
  end
150
366
 
151
- def encode buffer
152
- encoding = @insn.encodings.first
367
+ def encode buffer, labels
368
+ encoding = @form.encodings.first
153
369
  encoding.encode buffer, @operands
154
370
  end
371
+ end
372
+
373
+ class UnresolvedRIPInstruction
374
+ include InstructionPredicates
375
+
376
+ def initialize insn, form, operands
377
+ @insn = insn
378
+ @form = form
379
+ @operands = operands
380
+ @retry = false
381
+ @saved_pos = 0
382
+ end
383
+
384
+ def retry?; true; end
385
+
386
+ def encode buffer, labels
387
+ # Use dummy values for any unresolvable operands
388
+ operands = @operands.map do |op|
389
+ if op.rip? && op.unresolved?
390
+ # Try resolving the operands
391
+ if labels.key?(op.displacement.name)
392
+ Registers::Rip.new labels[op.displacement.name] - @saved_pos
393
+ else
394
+ Registers::Rip.new 0x0CAFE
395
+ end
396
+ else
397
+ op
398
+ end
399
+ end
155
400
 
156
- def bytesize
157
- @insn.encodings.first.bytesize
401
+ @form.encodings.first.encode buffer, operands
402
+ @saved_pos = buffer.pos
158
403
  end
159
404
  end
160
405
 
161
- def gen name, params
162
- insns = Machine.instruction_with_name(name)
163
- forms = insns.forms.find_all do |insn|
164
- if insn.operands.length == params.length
165
- params.zip(insn.operands).all? { |want_op, have_op|
166
- want_op.works?(have_op.type)
167
- }
406
+ class AbsoluteJumpInstruction
407
+ include InstructionPredicates
408
+
409
+ def initialize insn, form, operand
410
+ @insn = insn
411
+ @form = form
412
+ @operand = operand
413
+ @must_retry = false
414
+ end
415
+
416
+ def jump?
417
+ true
418
+ end
419
+
420
+ def target
421
+ @operand.name
422
+ end
423
+
424
+ def encode buffer, labels
425
+ form = find_form "rel32"
426
+ encoding = form.encodings.first
427
+ operand_klass = Rel32
428
+
429
+ pos = buffer.pos
430
+ rel_jump = 0xCAFE
431
+ 2.times do
432
+ buffer.seek pos, IO::SEEK_SET
433
+ encoding.encode buffer, [operand_klass.new(rel_jump)]
434
+ rel_jump = @operand.value - buffer.address
435
+ end
436
+ end
437
+
438
+ private
439
+
440
+ def find_form form_type
441
+ @insn.forms.find { |form| form.operands.first.type == form_type }
442
+ end
443
+ end
444
+
445
+ class UnresolvedJumpInstruction
446
+ include InstructionPredicates
447
+
448
+ def initialize insn, form, operand
449
+ @insn = insn
450
+ @form = form
451
+ @operand = operand
452
+ @must_retry = false
453
+ end
454
+
455
+ def jump?
456
+ true
457
+ end
458
+
459
+ def target
460
+ @operand.name
461
+ end
462
+
463
+ def retry?
464
+ true
465
+ end
466
+
467
+ def encode buffer, labels
468
+ # Estimate by using a rel32 offset
469
+ form = find_form "rel32"
470
+ encoding = form.encodings.first
471
+ operand_klass = Rel32
472
+
473
+ if labels.key? target
474
+ unless @must_retry
475
+ estimated_offset = labels[target] - (buffer.pos + 6) # 6 seems like a good length
476
+
477
+ if estimated_offset >= -128 && estimated_offset <= 127
478
+ # fits in a rel8
479
+ operand_klass = Rel8
480
+ form = find_form "rel8"
481
+ encoding = form.encodings.first
482
+ end
483
+ end
484
+
485
+ # We don't know what the size of the jump will be, so just write
486
+ # it out with some dummy data and keep track of the buffer position.
487
+ # Calculate the real jump offset, then rewind and patch the jump with
488
+ # the right location. 😩
489
+ pos = buffer.pos
490
+ encoding.encode buffer, [operand_klass.new(0xFE)]
491
+ jump_len = -(buffer.pos - labels[target])
492
+ buffer.seek pos, IO::SEEK_SET
493
+ encoding.encode buffer, [operand_klass.new(jump_len)]
168
494
  else
169
- false
495
+ if @must_retry
496
+ # We retried once, but the label wasn't defined
497
+ raise Errors::MissingLabel, "Label `#{target}` was used, but not defined"
498
+ end
499
+ @must_retry = true
500
+ encoding.encode buffer, [operand_klass.new(0x0CAFE)]
170
501
  end
171
502
  end
172
503
 
173
- raise NotImplementedError, "couldn't find instruction #{name}" if forms.length == 0
504
+ private
174
505
 
175
- insn = nil
506
+ def find_form form_type
507
+ @insn.forms.find { |form| form.operands.first.type == form_type }
508
+ end
509
+ end
176
510
 
177
- insn = forms.first
511
+ def initialize
512
+ @instructions = []
513
+ @labels = {}
514
+ # A set of temp registers recorded as we see them (not at allocation time)
515
+ @temp_registers = Set.new
516
+ yield self if block_given?
517
+ end
178
518
 
179
- insn = Instruction.new(insn, params, position)
180
- @position += insn.bytesize
181
- @instructions << insn
182
- params.each { |param| param.insn = insn if param.unknown_label? }
519
+ # Mark a temporary register as "done being used" at this point in the
520
+ # instructions. Using the register after passing the register to this
521
+ # method results in undefined behavior.
522
+ def release_register reg
523
+ if reg.end_point
524
+ raise Errors::AlreadyReleasedError, "register #{reg.name} already released at #{reg.end_point}"
525
+ end
526
+
527
+ reg.end_point = (@instructions.length - 1)
528
+ end
529
+
530
+ # Releases all registers that haven't already been released
531
+ def release_all_registers
532
+ @temp_registers.each do |reg|
533
+ next if reg.end_point
534
+ release_register reg
535
+ end
536
+ end
537
+
538
+ # Return a list of basic blocks for the instructions
539
+ def basic_blocks
540
+ cfg.blocks
541
+ end
542
+
543
+ # Return a cfg for these instructions. The CFG includes connected basic
544
+ # blocks as well as any temporary registers
545
+ def cfg
546
+ CFG.build @instructions
547
+ end
548
+
549
+ # Create a label to be used with jump instructions. For example:
550
+ #
551
+ # fisk.jmp(fisk.label(:foo))
552
+ # fisk.int(lit(3))
553
+ # fisk.put_label(:foo)
554
+ #
555
+ def label name
556
+ UnknownLabel.new(name)
557
+ end
183
558
 
559
+ Lazy = Struct.new(:block) do # :nodoc:
560
+ include InstructionPredicates
561
+
562
+ def lazy?; true; end
563
+
564
+ def encode buffer, labels
565
+ block.call buffer.pos
566
+ end
567
+ end
568
+
569
+ # Record a block that will be called during instruction encoding. The block
570
+ # will be yielded the current position of the buffer.
571
+ #
572
+ # For example:
573
+ #
574
+ # patch_position = nil
575
+ #
576
+ # fisk.nop
577
+ # fisk.lazy { |pos| patch_location = pos }
578
+ # fisk.jmp(fisk.label(:foo))
579
+ # fisk.lazy { |_|
580
+ # fisk.mov(fisk.r8, fisk.imm64(patch_location))
581
+ # }
582
+ # fisk.write_to(buf)
583
+ #
584
+ # The first lazy block will be yielded the position of the buffer immediately
585
+ # after encoding the `nop` instruction and before encoding the `jmp`
586
+ # instruction. The second lazy block will be yielded to after the `jmp`
587
+ # instruction has been encoded. This gives you a chance to write the buffer
588
+ # position from certain points in to your assembly
589
+ def lazy &block
590
+ @instructions << Lazy.new(block)
184
591
  self
185
592
  end
186
593
 
187
- Machine.instructions.keys.each do |insn|
188
- define_method(insn.downcase) do |*params|
189
- gen insn, params
594
+ # Insert a label named +name+ at the current position in the instructions.
595
+ def put_label name
596
+ if @labels.key? name
597
+ raise Errors::LabelAlreadyDefined, "Label `#{name}` is already defined"
190
598
  end
599
+ @labels[name] = nil
600
+ @instructions << Label.new(name)
601
+ self
191
602
  end
603
+ alias :make_label :put_label
192
604
 
193
- def moffs64 val
194
- MOffs64.new val
605
+ # Insert a comment at the current position in the instructions.
606
+ def comment message
607
+ @instructions << Comment.new(message)
608
+ self
195
609
  end
196
610
 
197
- def imm8 val
198
- Imm8.new val
611
+ # Allocate and return a new register. These registers will be replaced with
612
+ # real registers when `assign_registers` is called.
613
+ def register name = "temp"
614
+ Registers::Temp.new name, "r64"
199
615
  end
200
616
 
201
- def imm32 val
202
- Imm32.new val
617
+ # Allocate a register and yield it to the block. The register will be
618
+ # automatically released after the block is finished.
619
+ def with_register name = "temp"
620
+ reg = register(name)
621
+ yield reg
622
+ release_register reg
203
623
  end
204
624
 
205
- def imm64 val
206
- Imm64.new val
625
+ # Assign registers to any temporary registers. Only registers in +list+
626
+ # will be used when selecting register assignments
627
+ def assign_registers list, local: false
628
+ temp_registers = @temp_registers
629
+
630
+ # This mutates the temp registers, setting their end_point based on
631
+ # the CFG
632
+ self.cfg unless local
633
+
634
+ temp_registers.each do |reg|
635
+ unless reg.end_point
636
+ raise Errors::UnreleasedRegisterError, "Register #{reg.name} hasn't been released"
637
+ end
638
+ end
639
+
640
+ temp_registers = temp_registers.sort_by(&:start_point)
641
+
642
+ active = []
643
+ free_registers = list.reverse
644
+ register_count = list.length
645
+
646
+ temp_registers.each do |temp_reg|
647
+ # expire old intervals
648
+ active, dead = active.sort_by(&:end_point).partition do |j|
649
+ j.end_point >= temp_reg.start_point
650
+ end
651
+
652
+ # Add unused registers back to the free register list
653
+ dead.each { |tr| free_registers << tr.register }
654
+
655
+ if active.length == register_count
656
+ raise NotImplementedError, "Register spilled"
657
+ end
658
+
659
+ temp_reg.register = free_registers.pop
660
+ active << temp_reg
661
+ end
662
+ end
663
+
664
+ Registers.constants.grep(/^[A-Z0-9]*$/).each do |const|
665
+ val = Registers.const_get const
666
+ define_method(const.downcase) { val }
667
+ end
668
+
669
+ include Fisk::Instructions::DSLMethods
670
+
671
+ def moffs64 val
672
+ MOffs64.new val
673
+ end
674
+
675
+ # Create a signed immediate value of the right width
676
+ def imm val
677
+ val = val.to_i
678
+
679
+ if val >= -0x7F - 1 && val <= 0x7F
680
+ imm8 val
681
+ elsif val >= -0x7FFF - 1 && val <= 0x7FFF
682
+ imm16 val
683
+ elsif val >= -0x7FFFFFFF - 1 && val <= 0x7FFFFFFF
684
+ imm32 val
685
+ elsif val >= -0x7FFFFFFFFFFFFFFF - 1 && val <= 0x7FFFFFFFFFFFFFFF
686
+ imm64 val
687
+ else
688
+ raise ArgumentError, "#{val} is larger than a 64 bit int"
689
+ end
690
+ end
691
+
692
+ # Create an unsigned immediate value of the right width
693
+ def uimm val
694
+ val = val.to_i
695
+
696
+ if val < 0
697
+ raise ArgumentError, "#{val} is negative"
698
+ elsif val <= 0xFF
699
+ imm8 val
700
+ elsif val <= 0xFFFF
701
+ imm16 val
702
+ elsif val <= 0xFFFFFFFF
703
+ imm32 val
704
+ elsif val <= 0xFFFFFFFFFFFFFFFF
705
+ imm64 val
706
+ else
707
+ raise ArgumentError, "#{val} is too large for a 64 bit int"
708
+ end
207
709
  end
208
710
 
209
711
  def rel8 val
@@ -214,27 +716,157 @@ class Fisk
214
716
  Rel32.new val
215
717
  end
216
718
 
719
+ class AbsoluteLocation < Rel32
720
+ def absolute_location?; true; end
721
+ end
722
+
723
+ # Creates an "absolute" location. Use this for JUMP instructions where you
724
+ # know the absolute location but want a relative location calculated later.
725
+ #
726
+ # For example:
727
+ #
728
+ # fisk.jmp fisk.absolute(0xCAFE)
729
+ #
730
+ # The emitted JMP instruction will use a calculated relative address (this is
731
+ # because x64 doesn't have a jump to absolute position).
732
+ def absolute val
733
+ AbsoluteLocation.new val
734
+ end
735
+
217
736
  def lit val
218
- # to_s because we're getting the value from JSON as a string
219
737
  Lit.new val
220
738
  end
221
739
 
222
- def asm buf = StringIO.new(''.b), &block
223
- @position = 0
740
+ # Instance eval's a given block and writes encoded instructions to +buf+.
741
+ # For example:
742
+ #
743
+ # fisk = Fisk.new
744
+ # fisk.asm do
745
+ # mov r9, imm64(32)
746
+ # end
747
+ #
748
+ def asm buf = StringIO.new(''.b), metadata: {}, &block
224
749
  instance_eval(&block)
225
- write_to_buffer buf
750
+ write_to buf, metadata: metadata
226
751
  buf
227
752
  end
228
753
 
229
- def to_binary
754
+ # Encodes all instructions and returns a binary string with the encoded
755
+ # instructions.
756
+ def to_binary(metadata: {})
230
757
  io = StringIO.new ''.b
231
- write_to_buffer io
758
+ write_to io, metadata: metadata
232
759
  io.string
233
760
  end
234
761
 
762
+ RetryRequest = Struct.new(:insn, :io_seek_pos)
763
+
764
+ # Encode all instructions and write them to +buffer+. +buffer+ should be an
765
+ # IO object.
766
+ def write_to buffer, metadata: {}
767
+ labels = {}
768
+ comments = {}
769
+ unresolved = []
770
+ instructions = @instructions.dup
771
+ backup = @instructions.dup
772
+ @instructions.clear
773
+
774
+ while insn = instructions.shift
775
+ if insn.label?
776
+ labels[insn.name] = buffer.pos
777
+ elsif insn.comment?
778
+ comments.update({buffer.pos => insn.message}) { |_, *lines| lines.join($/) }
779
+ elsif insn.lazy?
780
+ insn.encode buffer, labels
781
+ instructions.unshift(*@instructions)
782
+ @instructions.clear
783
+ else
784
+ if insn.retry?
785
+ retry_req = RetryRequest.new(insn, buffer.pos)
786
+ unresolved << retry_req
787
+ end
788
+
789
+ write_instruction insn, buffer, labels
790
+ end
791
+ end
792
+
793
+ metadata[:comments] = comments
794
+ @instructions = backup
795
+
796
+ return if unresolved.empty?
797
+
798
+ pos = buffer.pos
799
+ unresolved.each do |req|
800
+ insn = req.insn
801
+ buffer.seek req.io_seek_pos, IO::SEEK_SET
802
+ insn.encode buffer, labels
803
+ end
804
+ buffer.seek pos, IO::SEEK_SET
805
+
806
+ buffer
807
+ end
808
+
809
+ def gen_with_insn insns, params
810
+ forms = insns.forms.find_all do |insn|
811
+ if insn.operands.length == params.length
812
+ params.zip(insn.operands).all? { |want_op, have_op|
813
+ want_op.works?(have_op)
814
+ }
815
+ else
816
+ false
817
+ end
818
+ end
819
+
820
+ if forms.length == 0
821
+ valid_forms = insns.forms.map { |form|
822
+ " #{insns.name} #{form.operands.map(&:type).join(", ")}"
823
+ }.join "\n"
824
+ msg = <<~eostr
825
+ Couldn't find instruction #{insns.name} #{params.map(&:type).join(", ")}
826
+ Valid forms:
827
+ #{valid_forms}
828
+ eostr
829
+ raise NotImplementedError, msg
830
+ end
831
+
832
+ form = forms.first
833
+
834
+ insn = nil
835
+
836
+ params.each do |param|
837
+ if param.unresolved?
838
+ if insns.name =~ /^J/ # I hope all jump instructions start with J!
839
+ insn = UnresolvedJumpInstruction.new(insns, form, params.first)
840
+ else
841
+ # If it's not a jump instruction, assume unresolved RIP relative 😬
842
+ insn = UnresolvedRIPInstruction.new(insns, form, params)
843
+ end
844
+ end
845
+
846
+ if param.absolute_location? && insns.name =~ /^(?:J|CALL)/
847
+ insn = AbsoluteJumpInstruction.new(insns, form, params.first)
848
+ end
849
+
850
+ if param.temp_register?
851
+ if param.end_point
852
+ raise Errors::UseAfterInvalidationError, "Register #{param.name} used after release"
853
+ end
854
+ @temp_registers << param
855
+
856
+ param.start_point ||= @instructions.length
857
+ end
858
+ end
859
+
860
+ insn ||= Instruction.new(insns, form, params)
861
+
862
+ @instructions << insn
863
+
864
+ self
865
+ end
866
+
235
867
  private
236
868
 
237
- def write_to_buffer buffer
238
- @instructions.each { |insn| insn.encode buffer }
869
+ def write_instruction insn, buffer, labels
870
+ insn.encode buffer, labels
239
871
  end
240
872
  end