laag-nasm 2.13.03.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (455) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +57 -0
  3. data/LICENSE.txt +29 -0
  4. data/README.org +34 -0
  5. data/ext/laag/nasm/extconf.rb +16 -0
  6. data/laag-nasm.gemspec +20 -0
  7. data/lib/laag/nasm.rb +29 -0
  8. data/patches/Makefile.in.patch +13 -0
  9. data/vendor/repo.or.cz/nasm/.gitignore +102 -0
  10. data/vendor/repo.or.cz/nasm/AUTHORS +137 -0
  11. data/vendor/repo.or.cz/nasm/CHANGES +2 -0
  12. data/vendor/repo.or.cz/nasm/ChangeLog +2905 -0
  13. data/vendor/repo.or.cz/nasm/INSTALL +102 -0
  14. data/vendor/repo.or.cz/nasm/LICENSE +29 -0
  15. data/vendor/repo.or.cz/nasm/Makefile.in +855 -0
  16. data/vendor/repo.or.cz/nasm/Mkfiles/README +46 -0
  17. data/vendor/repo.or.cz/nasm/Mkfiles/msvc.mak +732 -0
  18. data/vendor/repo.or.cz/nasm/Mkfiles/openwcom.mak +706 -0
  19. data/vendor/repo.or.cz/nasm/README +23 -0
  20. data/vendor/repo.or.cz/nasm/SubmittingPatches +116 -0
  21. data/vendor/repo.or.cz/nasm/TODO +376 -0
  22. data/vendor/repo.or.cz/nasm/aclocal.m4 +139 -0
  23. data/vendor/repo.or.cz/nasm/asm/assemble.c +2957 -0
  24. data/vendor/repo.or.cz/nasm/asm/assemble.h +54 -0
  25. data/vendor/repo.or.cz/nasm/asm/directiv.c +566 -0
  26. data/vendor/repo.or.cz/nasm/asm/directiv.dat +92 -0
  27. data/vendor/repo.or.cz/nasm/asm/error.c +202 -0
  28. data/vendor/repo.or.cz/nasm/asm/eval.c +1014 -0
  29. data/vendor/repo.or.cz/nasm/asm/eval.h +49 -0
  30. data/vendor/repo.or.cz/nasm/asm/exprdump.c +79 -0
  31. data/vendor/repo.or.cz/nasm/asm/exprlib.c +200 -0
  32. data/vendor/repo.or.cz/nasm/asm/float.c +952 -0
  33. data/vendor/repo.or.cz/nasm/asm/float.h +54 -0
  34. data/vendor/repo.or.cz/nasm/asm/labels.c +540 -0
  35. data/vendor/repo.or.cz/nasm/asm/listing.c +346 -0
  36. data/vendor/repo.or.cz/nasm/asm/listing.h +113 -0
  37. data/vendor/repo.or.cz/nasm/asm/nasm.c +1855 -0
  38. data/vendor/repo.or.cz/nasm/asm/parser.c +1167 -0
  39. data/vendor/repo.or.cz/nasm/asm/parser.h +45 -0
  40. data/vendor/repo.or.cz/nasm/asm/phash.pl +109 -0
  41. data/vendor/repo.or.cz/nasm/asm/pptok.dat +96 -0
  42. data/vendor/repo.or.cz/nasm/asm/pptok.pl +271 -0
  43. data/vendor/repo.or.cz/nasm/asm/pragma.c +218 -0
  44. data/vendor/repo.or.cz/nasm/asm/preproc-nop.c +188 -0
  45. data/vendor/repo.or.cz/nasm/asm/preproc.c +5459 -0
  46. data/vendor/repo.or.cz/nasm/asm/preproc.h +55 -0
  47. data/vendor/repo.or.cz/nasm/asm/quote.c +479 -0
  48. data/vendor/repo.or.cz/nasm/asm/quote.h +44 -0
  49. data/vendor/repo.or.cz/nasm/asm/rdstrnum.c +68 -0
  50. data/vendor/repo.or.cz/nasm/asm/segalloc.c +51 -0
  51. data/vendor/repo.or.cz/nasm/asm/stdscan.c +345 -0
  52. data/vendor/repo.or.cz/nasm/asm/stdscan.h +49 -0
  53. data/vendor/repo.or.cz/nasm/asm/strfunc.c +359 -0
  54. data/vendor/repo.or.cz/nasm/asm/tokens.dat +135 -0
  55. data/vendor/repo.or.cz/nasm/asm/tokhash.pl +284 -0
  56. data/vendor/repo.or.cz/nasm/autogen.sh +9 -0
  57. data/vendor/repo.or.cz/nasm/common/common.c +122 -0
  58. data/vendor/repo.or.cz/nasm/config/msvc.h +192 -0
  59. data/vendor/repo.or.cz/nasm/config/unknown.h +51 -0
  60. data/vendor/repo.or.cz/nasm/config/watcom.h +74 -0
  61. data/vendor/repo.or.cz/nasm/configure.ac +253 -0
  62. data/vendor/repo.or.cz/nasm/contrib/MSVC6.txt +25 -0
  63. data/vendor/repo.or.cz/nasm/contrib/VSrules/nasm.README +16 -0
  64. data/vendor/repo.or.cz/nasm/contrib/VSrules/nasm.rules +79 -0
  65. data/vendor/repo.or.cz/nasm/disasm/disasm.c +1735 -0
  66. data/vendor/repo.or.cz/nasm/disasm/disasm.h +49 -0
  67. data/vendor/repo.or.cz/nasm/disasm/ndisasm.c +397 -0
  68. data/vendor/repo.or.cz/nasm/disasm/sync.c +132 -0
  69. data/vendor/repo.or.cz/nasm/disasm/sync.h +45 -0
  70. data/vendor/repo.or.cz/nasm/doc/Makefile.in +86 -0
  71. data/vendor/repo.or.cz/nasm/doc/README +20 -0
  72. data/vendor/repo.or.cz/nasm/doc/afmmetrics.ph +102 -0
  73. data/vendor/repo.or.cz/nasm/doc/changes.src +2588 -0
  74. data/vendor/repo.or.cz/nasm/doc/findfont.ph +180 -0
  75. data/vendor/repo.or.cz/nasm/doc/genps.pl +1294 -0
  76. data/vendor/repo.or.cz/nasm/doc/inslist.pl +108 -0
  77. data/vendor/repo.or.cz/nasm/doc/internal.doc +290 -0
  78. data/vendor/repo.or.cz/nasm/doc/local.css +1 -0
  79. data/vendor/repo.or.cz/nasm/doc/nasmdoc.css +150 -0
  80. data/vendor/repo.or.cz/nasm/doc/nasmdoc.src +8309 -0
  81. data/vendor/repo.or.cz/nasm/doc/nasmlogo.eps +212 -0
  82. data/vendor/repo.or.cz/nasm/doc/nasmlogw.png +0 -0
  83. data/vendor/repo.or.cz/nasm/doc/psfonts.ph +53 -0
  84. data/vendor/repo.or.cz/nasm/doc/pspdf.pl +98 -0
  85. data/vendor/repo.or.cz/nasm/doc/pswidth.ph +25 -0
  86. data/vendor/repo.or.cz/nasm/doc/rdsrc.pl +1111 -0
  87. data/vendor/repo.or.cz/nasm/doc/ttfmetrics.ph +63 -0
  88. data/vendor/repo.or.cz/nasm/headers/c +33 -0
  89. data/vendor/repo.or.cz/nasm/headers/doc +33 -0
  90. data/vendor/repo.or.cz/nasm/headers/mac +33 -0
  91. data/vendor/repo.or.cz/nasm/headers/perl +33 -0
  92. data/vendor/repo.or.cz/nasm/include/compiler.h +277 -0
  93. data/vendor/repo.or.cz/nasm/include/disp8.h +45 -0
  94. data/vendor/repo.or.cz/nasm/include/error.h +135 -0
  95. data/vendor/repo.or.cz/nasm/include/hashtbl.h +85 -0
  96. data/vendor/repo.or.cz/nasm/include/iflag.h +173 -0
  97. data/vendor/repo.or.cz/nasm/include/insns.h +76 -0
  98. data/vendor/repo.or.cz/nasm/include/labels.h +60 -0
  99. data/vendor/repo.or.cz/nasm/include/md5.h +21 -0
  100. data/vendor/repo.or.cz/nasm/include/nasm.h +1246 -0
  101. data/vendor/repo.or.cz/nasm/include/nasmint.h +219 -0
  102. data/vendor/repo.or.cz/nasm/include/nasmlib.h +524 -0
  103. data/vendor/repo.or.cz/nasm/include/opflags.h +271 -0
  104. data/vendor/repo.or.cz/nasm/include/perfhash.h +52 -0
  105. data/vendor/repo.or.cz/nasm/include/raa.h +46 -0
  106. data/vendor/repo.or.cz/nasm/include/rbtree.h +51 -0
  107. data/vendor/repo.or.cz/nasm/include/rdoff.h +169 -0
  108. data/vendor/repo.or.cz/nasm/include/saa.h +94 -0
  109. data/vendor/repo.or.cz/nasm/include/strlist.h +55 -0
  110. data/vendor/repo.or.cz/nasm/include/tables.h +70 -0
  111. data/vendor/repo.or.cz/nasm/include/ver.h +47 -0
  112. data/vendor/repo.or.cz/nasm/install-sh +250 -0
  113. data/vendor/repo.or.cz/nasm/macros/altreg.mac +107 -0
  114. data/vendor/repo.or.cz/nasm/macros/fp.mac +54 -0
  115. data/vendor/repo.or.cz/nasm/macros/ifunc.mac +48 -0
  116. data/vendor/repo.or.cz/nasm/macros/macros.pl +294 -0
  117. data/vendor/repo.or.cz/nasm/macros/smartalign.mac +189 -0
  118. data/vendor/repo.or.cz/nasm/macros/standard.mac +226 -0
  119. data/vendor/repo.or.cz/nasm/misc/Doxyfile +752 -0
  120. data/vendor/repo.or.cz/nasm/misc/Nindent +18 -0
  121. data/vendor/repo.or.cz/nasm/misc/README +2 -0
  122. data/vendor/repo.or.cz/nasm/misc/c16.mac +82 -0
  123. data/vendor/repo.or.cz/nasm/misc/c32.mac +52 -0
  124. data/vendor/repo.or.cz/nasm/misc/crcgen.c +44 -0
  125. data/vendor/repo.or.cz/nasm/misc/exebin.mac +57 -0
  126. data/vendor/repo.or.cz/nasm/misc/exebin2.mac +114 -0
  127. data/vendor/repo.or.cz/nasm/misc/fmtinsns.pl +40 -0
  128. data/vendor/repo.or.cz/nasm/misc/genfma.pl +63 -0
  129. data/vendor/repo.or.cz/nasm/misc/hints.txt +26 -0
  130. data/vendor/repo.or.cz/nasm/misc/magic +6 -0
  131. data/vendor/repo.or.cz/nasm/misc/myC32.mac +121 -0
  132. data/vendor/repo.or.cz/nasm/misc/nasm.sl +320 -0
  133. data/vendor/repo.or.cz/nasm/misc/nasmstab +296 -0
  134. data/vendor/repo.or.cz/nasm/misc/omfdump.c +517 -0
  135. data/vendor/repo.or.cz/nasm/misc/pmw.bat +9 -0
  136. data/vendor/repo.or.cz/nasm/misc/proc32.ash +441 -0
  137. data/vendor/repo.or.cz/nasm/misc/scitech.mac +1223 -0
  138. data/vendor/repo.or.cz/nasm/misc/xcrcgen.c +80 -0
  139. data/vendor/repo.or.cz/nasm/nasm.spec.in +83 -0
  140. data/vendor/repo.or.cz/nasm/nasm.spec.sed +3 -0
  141. data/vendor/repo.or.cz/nasm/nasm.txt +306 -0
  142. data/vendor/repo.or.cz/nasm/nasmlib/badenum.c +43 -0
  143. data/vendor/repo.or.cz/nasm/nasmlib/bsi.c +77 -0
  144. data/vendor/repo.or.cz/nasm/nasmlib/crc64.c +189 -0
  145. data/vendor/repo.or.cz/nasm/nasmlib/file.c +259 -0
  146. data/vendor/repo.or.cz/nasm/nasmlib/file.h +128 -0
  147. data/vendor/repo.or.cz/nasm/nasmlib/filename.c +69 -0
  148. data/vendor/repo.or.cz/nasm/nasmlib/hashtbl.c +232 -0
  149. data/vendor/repo.or.cz/nasm/nasmlib/ilog2.c +168 -0
  150. data/vendor/repo.or.cz/nasm/nasmlib/malloc.c +108 -0
  151. data/vendor/repo.or.cz/nasm/nasmlib/md5c.c +247 -0
  152. data/vendor/repo.or.cz/nasm/nasmlib/mmap.c +139 -0
  153. data/vendor/repo.or.cz/nasm/nasmlib/path.c +186 -0
  154. data/vendor/repo.or.cz/nasm/nasmlib/perfhash.c +55 -0
  155. data/vendor/repo.or.cz/nasm/nasmlib/perfhash.pl +362 -0
  156. data/vendor/repo.or.cz/nasm/nasmlib/raa.c +173 -0
  157. data/vendor/repo.or.cz/nasm/nasmlib/rbtree.c +119 -0
  158. data/vendor/repo.or.cz/nasm/nasmlib/readnum.c +172 -0
  159. data/vendor/repo.or.cz/nasm/nasmlib/realpath.c +135 -0
  160. data/vendor/repo.or.cz/nasm/nasmlib/saa.c +431 -0
  161. data/vendor/repo.or.cz/nasm/nasmlib/srcfile.c +128 -0
  162. data/vendor/repo.or.cz/nasm/nasmlib/string.c +242 -0
  163. data/vendor/repo.or.cz/nasm/nasmlib/strlist.c +100 -0
  164. data/vendor/repo.or.cz/nasm/nasmlib/ver.c +51 -0
  165. data/vendor/repo.or.cz/nasm/nasmlib/zerobuf.c +42 -0
  166. data/vendor/repo.or.cz/nasm/ndisasm.txt +94 -0
  167. data/vendor/repo.or.cz/nasm/nsis/NASMMultiUser.nsh +478 -0
  168. data/vendor/repo.or.cz/nasm/nsis/getpearch.pl +76 -0
  169. data/vendor/repo.or.cz/nasm/nsis/nasm-un.ico +0 -0
  170. data/vendor/repo.or.cz/nasm/nsis/nasm.ico +0 -0
  171. data/vendor/repo.or.cz/nasm/nsis/nasm.nsi +241 -0
  172. data/vendor/repo.or.cz/nasm/output/codeview.c +814 -0
  173. data/vendor/repo.or.cz/nasm/output/dwarf.h +566 -0
  174. data/vendor/repo.or.cz/nasm/output/elf.h +537 -0
  175. data/vendor/repo.or.cz/nasm/output/legacy.c +112 -0
  176. data/vendor/repo.or.cz/nasm/output/nulldbg.c +93 -0
  177. data/vendor/repo.or.cz/nasm/output/nullout.c +51 -0
  178. data/vendor/repo.or.cz/nasm/output/outaout.c +954 -0
  179. data/vendor/repo.or.cz/nasm/output/outaout.mac +37 -0
  180. data/vendor/repo.or.cz/nasm/output/outas86.c +650 -0
  181. data/vendor/repo.or.cz/nasm/output/outas86.mac +37 -0
  182. data/vendor/repo.or.cz/nasm/output/outbin.c +1713 -0
  183. data/vendor/repo.or.cz/nasm/output/outbin.mac +40 -0
  184. data/vendor/repo.or.cz/nasm/output/outcoff.c +1242 -0
  185. data/vendor/repo.or.cz/nasm/output/outcoff.mac +43 -0
  186. data/vendor/repo.or.cz/nasm/output/outdbg.c +425 -0
  187. data/vendor/repo.or.cz/nasm/output/outelf.c +3370 -0
  188. data/vendor/repo.or.cz/nasm/output/outelf.h +156 -0
  189. data/vendor/repo.or.cz/nasm/output/outelf.mac +41 -0
  190. data/vendor/repo.or.cz/nasm/output/outform.c +120 -0
  191. data/vendor/repo.or.cz/nasm/output/outform.h +379 -0
  192. data/vendor/repo.or.cz/nasm/output/outieee.c +1528 -0
  193. data/vendor/repo.or.cz/nasm/output/outlib.c +58 -0
  194. data/vendor/repo.or.cz/nasm/output/outlib.h +63 -0
  195. data/vendor/repo.or.cz/nasm/output/outmacho.c +2387 -0
  196. data/vendor/repo.or.cz/nasm/output/outmacho.mac +49 -0
  197. data/vendor/repo.or.cz/nasm/output/outobj.c +2725 -0
  198. data/vendor/repo.or.cz/nasm/output/outobj.mac +49 -0
  199. data/vendor/repo.or.cz/nasm/output/outrdf.mac +40 -0
  200. data/vendor/repo.or.cz/nasm/output/outrdf2.c +791 -0
  201. data/vendor/repo.or.cz/nasm/output/outrdf2.mac +43 -0
  202. data/vendor/repo.or.cz/nasm/output/pecoff.h +532 -0
  203. data/vendor/repo.or.cz/nasm/output/stabs.h +144 -0
  204. data/vendor/repo.or.cz/nasm/perllib/crc64.ph +158 -0
  205. data/vendor/repo.or.cz/nasm/perllib/gensv.pl +34 -0
  206. data/vendor/repo.or.cz/nasm/perllib/phash.ph +200 -0
  207. data/vendor/repo.or.cz/nasm/perllib/random_sv_vectors.ph +67 -0
  208. data/vendor/repo.or.cz/nasm/rdoff/README +185 -0
  209. data/vendor/repo.or.cz/nasm/rdoff/collectn.c +44 -0
  210. data/vendor/repo.or.cz/nasm/rdoff/collectn.h +22 -0
  211. data/vendor/repo.or.cz/nasm/rdoff/doc/Makefile +37 -0
  212. data/vendor/repo.or.cz/nasm/rdoff/doc/rdoff.texi +137 -0
  213. data/vendor/repo.or.cz/nasm/rdoff/doc/v1-v2.txt +62 -0
  214. data/vendor/repo.or.cz/nasm/rdoff/hash.c +122 -0
  215. data/vendor/repo.or.cz/nasm/rdoff/hash.h +17 -0
  216. data/vendor/repo.or.cz/nasm/rdoff/ldrdf.1 +41 -0
  217. data/vendor/repo.or.cz/nasm/rdoff/ldrdf.c +1395 -0
  218. data/vendor/repo.or.cz/nasm/rdoff/ldsegs.h +59 -0
  219. data/vendor/repo.or.cz/nasm/rdoff/rdf2bin.1 +65 -0
  220. data/vendor/repo.or.cz/nasm/rdoff/rdf2bin.c +431 -0
  221. data/vendor/repo.or.cz/nasm/rdoff/rdf2com.1 +1 -0
  222. data/vendor/repo.or.cz/nasm/rdoff/rdf2ihx.1 +1 -0
  223. data/vendor/repo.or.cz/nasm/rdoff/rdf2ith.1 +1 -0
  224. data/vendor/repo.or.cz/nasm/rdoff/rdf2srec.1 +1 -0
  225. data/vendor/repo.or.cz/nasm/rdoff/rdfdump.1 +24 -0
  226. data/vendor/repo.or.cz/nasm/rdoff/rdfdump.c +347 -0
  227. data/vendor/repo.or.cz/nasm/rdoff/rdflib.1 +39 -0
  228. data/vendor/repo.or.cz/nasm/rdoff/rdflib.c +434 -0
  229. data/vendor/repo.or.cz/nasm/rdoff/rdfload.c +213 -0
  230. data/vendor/repo.or.cz/nasm/rdoff/rdfload.h +29 -0
  231. data/vendor/repo.or.cz/nasm/rdoff/rdfutils.h +165 -0
  232. data/vendor/repo.or.cz/nasm/rdoff/rdlar.c +492 -0
  233. data/vendor/repo.or.cz/nasm/rdoff/rdlar.h +34 -0
  234. data/vendor/repo.or.cz/nasm/rdoff/rdlib.c +290 -0
  235. data/vendor/repo.or.cz/nasm/rdoff/rdlib.h +62 -0
  236. data/vendor/repo.or.cz/nasm/rdoff/rdoff.c +621 -0
  237. data/vendor/repo.or.cz/nasm/rdoff/rdx.1 +21 -0
  238. data/vendor/repo.or.cz/nasm/rdoff/rdx.c +90 -0
  239. data/vendor/repo.or.cz/nasm/rdoff/segtab.c +172 -0
  240. data/vendor/repo.or.cz/nasm/rdoff/segtab.h +45 -0
  241. data/vendor/repo.or.cz/nasm/rdoff/symtab.c +159 -0
  242. data/vendor/repo.or.cz/nasm/rdoff/symtab.h +55 -0
  243. data/vendor/repo.or.cz/nasm/rdoff/test/Makefile +10 -0
  244. data/vendor/repo.or.cz/nasm/rdoff/test/makelib.sh +14 -0
  245. data/vendor/repo.or.cz/nasm/rdoff/test/rdfseg.asm +20 -0
  246. data/vendor/repo.or.cz/nasm/rdoff/test/rdfseg2.asm +12 -0
  247. data/vendor/repo.or.cz/nasm/rdoff/test/rdftest1.asm +54 -0
  248. data/vendor/repo.or.cz/nasm/rdoff/test/rdftest2.asm +33 -0
  249. data/vendor/repo.or.cz/nasm/rdoff/test/rdtlib.asm +48 -0
  250. data/vendor/repo.or.cz/nasm/rdoff/test/rdtmain.asm +47 -0
  251. data/vendor/repo.or.cz/nasm/rdoff/test/testlib.asm +18 -0
  252. data/vendor/repo.or.cz/nasm/stdlib/snprintf.c +29 -0
  253. data/vendor/repo.or.cz/nasm/stdlib/strlcpy.c +51 -0
  254. data/vendor/repo.or.cz/nasm/stdlib/strnlen.c +46 -0
  255. data/vendor/repo.or.cz/nasm/stdlib/vsnprintf.c +51 -0
  256. data/vendor/repo.or.cz/nasm/test/Makefile +106 -0
  257. data/vendor/repo.or.cz/nasm/test/_file_.asm +5 -0
  258. data/vendor/repo.or.cz/nasm/test/_version.asm +2 -0
  259. data/vendor/repo.or.cz/nasm/test/a32offs.asm +9 -0
  260. data/vendor/repo.or.cz/nasm/test/absolute.asm +40 -0
  261. data/vendor/repo.or.cz/nasm/test/addr64x.asm +18 -0
  262. data/vendor/repo.or.cz/nasm/test/align13.asm +19 -0
  263. data/vendor/repo.or.cz/nasm/test/align13s.asm +20 -0
  264. data/vendor/repo.or.cz/nasm/test/alonesym-obj.asm +166 -0
  265. data/vendor/repo.or.cz/nasm/test/andbyte.asm +15 -0
  266. data/vendor/repo.or.cz/nasm/test/aoutso.asm +99 -0
  267. data/vendor/repo.or.cz/nasm/test/aouttest.asm +86 -0
  268. data/vendor/repo.or.cz/nasm/test/aouttest.c +36 -0
  269. data/vendor/repo.or.cz/nasm/test/avx.asm +46 -0
  270. data/vendor/repo.or.cz/nasm/test/avx005.asm +529 -0
  271. data/vendor/repo.or.cz/nasm/test/avx2.asm +1608 -0
  272. data/vendor/repo.or.cz/nasm/test/avx512cd.asm +106 -0
  273. data/vendor/repo.or.cz/nasm/test/avx512er.asm +144 -0
  274. data/vendor/repo.or.cz/nasm/test/avx512f.asm +7000 -0
  275. data/vendor/repo.or.cz/nasm/test/avx512pf.asm +88 -0
  276. data/vendor/repo.or.cz/nasm/test/bcd.asm +23 -0
  277. data/vendor/repo.or.cz/nasm/test/binexe.asm +35 -0
  278. data/vendor/repo.or.cz/nasm/test/bintest.asm +59 -0
  279. data/vendor/repo.or.cz/nasm/test/bisect.sh +22 -0
  280. data/vendor/repo.or.cz/nasm/test/br1879590.asm +25 -0
  281. data/vendor/repo.or.cz/nasm/test/br2003451.asm +17 -0
  282. data/vendor/repo.or.cz/nasm/test/br2030823.asm +7 -0
  283. data/vendor/repo.or.cz/nasm/test/br2148476.asm +221 -0
  284. data/vendor/repo.or.cz/nasm/test/br2222615.asm +19 -0
  285. data/vendor/repo.or.cz/nasm/test/br2496848.asm +42 -0
  286. data/vendor/repo.or.cz/nasm/test/br3005117.asm +26 -0
  287. data/vendor/repo.or.cz/nasm/test/br3026808.asm +20 -0
  288. data/vendor/repo.or.cz/nasm/test/br3028880.asm +8 -0
  289. data/vendor/repo.or.cz/nasm/test/br3041451.asm +59 -0
  290. data/vendor/repo.or.cz/nasm/test/br3058845.asm +14 -0
  291. data/vendor/repo.or.cz/nasm/test/br3066383.asm +70 -0
  292. data/vendor/repo.or.cz/nasm/test/br3074517.asm +12 -0
  293. data/vendor/repo.or.cz/nasm/test/br3092924.asm +25 -0
  294. data/vendor/repo.or.cz/nasm/test/br3104312.asm +11 -0
  295. data/vendor/repo.or.cz/nasm/test/br3109604.asm +9 -0
  296. data/vendor/repo.or.cz/nasm/test/br3174983.asm +9 -0
  297. data/vendor/repo.or.cz/nasm/test/br3187743.asm +7 -0
  298. data/vendor/repo.or.cz/nasm/test/br3189064.asm +7 -0
  299. data/vendor/repo.or.cz/nasm/test/br3200749.asm +9 -0
  300. data/vendor/repo.or.cz/nasm/test/br3385573.asm +11 -0
  301. data/vendor/repo.or.cz/nasm/test/br3392252.asm +43 -0
  302. data/vendor/repo.or.cz/nasm/test/br3392259.asm +8 -0
  303. data/vendor/repo.or.cz/nasm/test/br3392363.asm +4 -0
  304. data/vendor/repo.or.cz/nasm/test/br3392392.asm +16 -0
  305. data/vendor/repo.or.cz/nasm/test/br3392396.asm +5 -0
  306. data/vendor/repo.or.cz/nasm/test/br3392411.asm +22 -0
  307. data/vendor/repo.or.cz/nasm/test/br3392418.asm +3 -0
  308. data/vendor/repo.or.cz/nasm/test/br3392439.asm +25 -0
  309. data/vendor/repo.or.cz/nasm/test/br3392442.asm +6 -0
  310. data/vendor/repo.or.cz/nasm/test/br560575.asm +17 -0
  311. data/vendor/repo.or.cz/nasm/test/br560873.asm +27 -0
  312. data/vendor/repo.or.cz/nasm/test/br890790.asm +7 -0
  313. data/vendor/repo.or.cz/nasm/test/br890790_i.asm +1 -0
  314. data/vendor/repo.or.cz/nasm/test/br978756.asm +7 -0
  315. data/vendor/repo.or.cz/nasm/test/changed.asm +383 -0
  316. data/vendor/repo.or.cz/nasm/test/cofftest.asm +85 -0
  317. data/vendor/repo.or.cz/nasm/test/cofftest.c +35 -0
  318. data/vendor/repo.or.cz/nasm/test/crc32.asm +37 -0
  319. data/vendor/repo.or.cz/nasm/test/cv8struc.asm +14 -0
  320. data/vendor/repo.or.cz/nasm/test/dtbcd.asm +72 -0
  321. data/vendor/repo.or.cz/nasm/test/elf64so.asm +118 -0
  322. data/vendor/repo.or.cz/nasm/test/elfso.asm +100 -0
  323. data/vendor/repo.or.cz/nasm/test/elftest.asm +87 -0
  324. data/vendor/repo.or.cz/nasm/test/elftest.c +38 -0
  325. data/vendor/repo.or.cz/nasm/test/elftest64.c +43 -0
  326. data/vendor/repo.or.cz/nasm/test/elif.asm +39 -0
  327. data/vendor/repo.or.cz/nasm/test/expimp.asm +90 -0
  328. data/vendor/repo.or.cz/nasm/test/far64.asm +10 -0
  329. data/vendor/repo.or.cz/nasm/test/float.asm +186 -0
  330. data/vendor/repo.or.cz/nasm/test/float8.asm +135 -0
  331. data/vendor/repo.or.cz/nasm/test/floatb.asm +35 -0
  332. data/vendor/repo.or.cz/nasm/test/floatexp.asm +382 -0
  333. data/vendor/repo.or.cz/nasm/test/floatize.asm +19 -0
  334. data/vendor/repo.or.cz/nasm/test/floattest.asm +28 -0
  335. data/vendor/repo.or.cz/nasm/test/floatx.asm +525 -0
  336. data/vendor/repo.or.cz/nasm/test/fpu.asm +127 -0
  337. data/vendor/repo.or.cz/nasm/test/fwdopt.asm +133 -0
  338. data/vendor/repo.or.cz/nasm/test/fwdoptpp.asm +150 -0
  339. data/vendor/repo.or.cz/nasm/test/gas2nasm.py +104 -0
  340. data/vendor/repo.or.cz/nasm/test/gather.asm +11 -0
  341. data/vendor/repo.or.cz/nasm/test/gotoff64.asm +25 -0
  342. data/vendor/repo.or.cz/nasm/test/hexfp.asm +25 -0
  343. data/vendor/repo.or.cz/nasm/test/hle.asm +19 -0
  344. data/vendor/repo.or.cz/nasm/test/ifelse.asm +46 -0
  345. data/vendor/repo.or.cz/nasm/test/ifenv.asm +31 -0
  346. data/vendor/repo.or.cz/nasm/test/ifmacro.asm +413 -0
  347. data/vendor/repo.or.cz/nasm/test/iftoken.asm +317 -0
  348. data/vendor/repo.or.cz/nasm/test/iftoken.pl +32 -0
  349. data/vendor/repo.or.cz/nasm/test/ilog2.asm +271 -0
  350. data/vendor/repo.or.cz/nasm/test/imacro.asm +8 -0
  351. data/vendor/repo.or.cz/nasm/test/imm.asm +23 -0
  352. data/vendor/repo.or.cz/nasm/test/imm64.asm +61 -0
  353. data/vendor/repo.or.cz/nasm/test/immwarn.asm +91 -0
  354. data/vendor/repo.or.cz/nasm/test/imul.asm +117 -0
  355. data/vendor/repo.or.cz/nasm/test/inc1.asm +6 -0
  356. data/vendor/repo.or.cz/nasm/test/inc2.asm +8 -0
  357. data/vendor/repo.or.cz/nasm/test/incbin.asm +7 -0
  358. data/vendor/repo.or.cz/nasm/test/incbin.data +2 -0
  359. data/vendor/repo.or.cz/nasm/test/inctest.asm +15 -0
  360. data/vendor/repo.or.cz/nasm/test/insnlbl.asm +12 -0
  361. data/vendor/repo.or.cz/nasm/test/invlpga.asm +11 -0
  362. data/vendor/repo.or.cz/nasm/test/jmp64.asm +19 -0
  363. data/vendor/repo.or.cz/nasm/test/lar_lsl.asm +124 -0
  364. data/vendor/repo.or.cz/nasm/test/larlsl.asm +23 -0
  365. data/vendor/repo.or.cz/nasm/test/lnxhello.asm +54 -0
  366. data/vendor/repo.or.cz/nasm/test/local.asm +19 -0
  367. data/vendor/repo.or.cz/nasm/test/loopoffs.asm +12 -0
  368. data/vendor/repo.or.cz/nasm/test/lwp.asm +213 -0
  369. data/vendor/repo.or.cz/nasm/test/macro-defaults.asm +64 -0
  370. data/vendor/repo.or.cz/nasm/test/macroerr.asm +12 -0
  371. data/vendor/repo.or.cz/nasm/test/macroerr.inc +3 -0
  372. data/vendor/repo.or.cz/nasm/test/mmxsize.asm +38 -0
  373. data/vendor/repo.or.cz/nasm/test/movd.asm +12 -0
  374. data/vendor/repo.or.cz/nasm/test/movd64.asm +15 -0
  375. data/vendor/repo.or.cz/nasm/test/movimm.asm +28 -0
  376. data/vendor/repo.or.cz/nasm/test/movnti.asm +10 -0
  377. data/vendor/repo.or.cz/nasm/test/mpx-64.asm +120 -0
  378. data/vendor/repo.or.cz/nasm/test/mpx.asm +89 -0
  379. data/vendor/repo.or.cz/nasm/test/multisection.asm +96 -0
  380. data/vendor/repo.or.cz/nasm/test/nasmformat.asm +17 -0
  381. data/vendor/repo.or.cz/nasm/test/new +9 -0
  382. data/vendor/repo.or.cz/nasm/test/newrdwr.asm +24 -0
  383. data/vendor/repo.or.cz/nasm/test/nop.asm +17 -0
  384. data/vendor/repo.or.cz/nasm/test/nullfile.asm +4 -0
  385. data/vendor/repo.or.cz/nasm/test/objexe.asm +30 -0
  386. data/vendor/repo.or.cz/nasm/test/objlink.c +33 -0
  387. data/vendor/repo.or.cz/nasm/test/objtest.asm +85 -0
  388. data/vendor/repo.or.cz/nasm/test/optimization.asm +104 -0
  389. data/vendor/repo.or.cz/nasm/test/org.asm +18 -0
  390. data/vendor/repo.or.cz/nasm/test/paste.asm +12 -0
  391. data/vendor/repo.or.cz/nasm/test/pcrel.asm +52 -0
  392. data/vendor/repo.or.cz/nasm/test/perf/label.pl +18 -0
  393. data/vendor/repo.or.cz/nasm/test/perf/macro.pl +18 -0
  394. data/vendor/repo.or.cz/nasm/test/perf/token.pl +23 -0
  395. data/vendor/repo.or.cz/nasm/test/performtest.pl +192 -0
  396. data/vendor/repo.or.cz/nasm/test/pextrw.asm +3 -0
  397. data/vendor/repo.or.cz/nasm/test/pinsr16.asm +53 -0
  398. data/vendor/repo.or.cz/nasm/test/pinsr32.asm +53 -0
  399. data/vendor/repo.or.cz/nasm/test/pinsr64.asm +68 -0
  400. data/vendor/repo.or.cz/nasm/test/popcnt.asm +32 -0
  401. data/vendor/repo.or.cz/nasm/test/ppindirect.asm +42 -0
  402. data/vendor/repo.or.cz/nasm/test/pragma.asm +12 -0
  403. data/vendor/repo.or.cz/nasm/test/prefix66.asm +28 -0
  404. data/vendor/repo.or.cz/nasm/test/ptr.asm +4 -0
  405. data/vendor/repo.or.cz/nasm/test/pushseg.asm +17 -0
  406. data/vendor/repo.or.cz/nasm/test/r13.asm +15 -0
  407. data/vendor/repo.or.cz/nasm/test/radix.asm +54 -0
  408. data/vendor/repo.or.cz/nasm/test/rdpid.asm +21 -0
  409. data/vendor/repo.or.cz/nasm/test/reldef.asm +57 -0
  410. data/vendor/repo.or.cz/nasm/test/relocs.asm +20 -0
  411. data/vendor/repo.or.cz/nasm/test/riprel.asm +5357 -0
  412. data/vendor/repo.or.cz/nasm/test/riprel.pl +29 -0
  413. data/vendor/repo.or.cz/nasm/test/riprel2.asm +11 -0
  414. data/vendor/repo.or.cz/nasm/test/sha-64.asm +30 -0
  415. data/vendor/repo.or.cz/nasm/test/sha.asm +31 -0
  416. data/vendor/repo.or.cz/nasm/test/smartalign16.asm +36 -0
  417. data/vendor/repo.or.cz/nasm/test/smartalign32.asm +36 -0
  418. data/vendor/repo.or.cz/nasm/test/smartalign64.asm +36 -0
  419. data/vendor/repo.or.cz/nasm/test/splitea.asm +11 -0
  420. data/vendor/repo.or.cz/nasm/test/sreg.asm +65 -0
  421. data/vendor/repo.or.cz/nasm/test/strlen.asm +5 -0
  422. data/vendor/repo.or.cz/nasm/test/struc.asm +33 -0
  423. data/vendor/repo.or.cz/nasm/test/test67.asm +38 -0
  424. data/vendor/repo.or.cz/nasm/test/testdos.asm +13 -0
  425. data/vendor/repo.or.cz/nasm/test/testnos3.asm +973 -0
  426. data/vendor/repo.or.cz/nasm/test/time.asm +11 -0
  427. data/vendor/repo.or.cz/nasm/test/times.asm +21 -0
  428. data/vendor/repo.or.cz/nasm/test/timesneg.asm +3 -0
  429. data/vendor/repo.or.cz/nasm/test/tmap.nas +1447 -0
  430. data/vendor/repo.or.cz/nasm/test/uscore.asm +15 -0
  431. data/vendor/repo.or.cz/nasm/test/utf.asm +82 -0
  432. data/vendor/repo.or.cz/nasm/test/vaesenc.asm +22 -0
  433. data/vendor/repo.or.cz/nasm/test/vex.asm +9 -0
  434. data/vendor/repo.or.cz/nasm/test/vgather.asm +76 -0
  435. data/vendor/repo.or.cz/nasm/test/vmread.asm +26 -0
  436. data/vendor/repo.or.cz/nasm/test/weirdpaste.asm +29 -0
  437. data/vendor/repo.or.cz/nasm/test/xchg.asm +96 -0
  438. data/vendor/repo.or.cz/nasm/test/xcrypt.asm +24 -0
  439. data/vendor/repo.or.cz/nasm/test/xmm0.asm +12 -0
  440. data/vendor/repo.or.cz/nasm/test/zerobyte.asm +22 -0
  441. data/vendor/repo.or.cz/nasm/tools/cleanfile +176 -0
  442. data/vendor/repo.or.cz/nasm/tools/cleanpatch +258 -0
  443. data/vendor/repo.or.cz/nasm/tools/mkdep.pl +261 -0
  444. data/vendor/repo.or.cz/nasm/tools/release +105 -0
  445. data/vendor/repo.or.cz/nasm/tools/syncfiles.pl +137 -0
  446. data/vendor/repo.or.cz/nasm/tools/tag-release +58 -0
  447. data/vendor/repo.or.cz/nasm/version +1 -0
  448. data/vendor/repo.or.cz/nasm/version.pl +189 -0
  449. data/vendor/repo.or.cz/nasm/x86/disp8.c +131 -0
  450. data/vendor/repo.or.cz/nasm/x86/insns-iflags.ph +280 -0
  451. data/vendor/repo.or.cz/nasm/x86/insns.dat +5371 -0
  452. data/vendor/repo.or.cz/nasm/x86/insns.pl +1043 -0
  453. data/vendor/repo.or.cz/nasm/x86/regs.dat +138 -0
  454. data/vendor/repo.or.cz/nasm/x86/regs.pl +204 -0
  455. metadata +520 -0
@@ -0,0 +1,60 @@
1
+ /* ----------------------------------------------------------------------- *
2
+ *
3
+ * Copyright 1996-2017 The NASM Authors - All Rights Reserved
4
+ * See the file AUTHORS included with the NASM distribution for
5
+ * the specific copyright holders.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following
9
+ * conditions are met:
10
+ *
11
+ * * Redistributions of source code must retain the above copyright
12
+ * notice, this list of conditions and the following disclaimer.
13
+ * * Redistributions in binary form must reproduce the above
14
+ * copyright notice, this list of conditions and the following
15
+ * disclaimer in the documentation and/or other materials provided
16
+ * with the distribution.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ *
32
+ * ----------------------------------------------------------------------- */
33
+
34
+ /*
35
+ * labels.h header file for labels.c
36
+ */
37
+
38
+ #ifndef LABELS_H
39
+ #define LABELS_H
40
+
41
+ #include "compiler.h"
42
+
43
+ extern char lprefix[PREFIX_MAX];
44
+ extern char lpostfix[PREFIX_MAX];
45
+
46
+ bool lookup_label(const char *label, int32_t *segment, int64_t *offset);
47
+ bool is_extern(const char *label);
48
+ void define_label(char *label, int32_t segment, int64_t offset, char *special,
49
+ bool is_norm, bool isextrn);
50
+ void redefine_label(char *label, int32_t segment, int64_t offset, char *special,
51
+ bool is_norm, bool isextrn);
52
+ void define_common(char *label, int32_t segment, int32_t size, char *special);
53
+ void declare_as_global(char *label, char *special);
54
+ int init_labels(void);
55
+ void cleanup_labels(void);
56
+ char *local_scope(char *label);
57
+
58
+ extern uint64_t global_offset_changed;
59
+
60
+ #endif /* LABELS_H */
@@ -0,0 +1,21 @@
1
+ #ifndef MD5_H
2
+ #define MD5_H
3
+
4
+ #include "compiler.h"
5
+
6
+ #define MD5_HASHBYTES 16
7
+
8
+ typedef struct MD5Context {
9
+ uint32_t buf[4];
10
+ uint32_t bits[2];
11
+ unsigned char in[64];
12
+ } MD5_CTX;
13
+
14
+ extern void MD5Init(MD5_CTX *context);
15
+ extern void MD5Update(MD5_CTX *context, unsigned char const *buf,
16
+ unsigned len);
17
+ extern void MD5Final(unsigned char digest[MD5_HASHBYTES], MD5_CTX *context);
18
+ extern void MD5Transform(uint32_t buf[4], uint32_t const in[16]);
19
+ extern char * MD5End(MD5_CTX *, char *);
20
+
21
+ #endif /* !MD5_H */
@@ -0,0 +1,1246 @@
1
+ /* ----------------------------------------------------------------------- *
2
+ *
3
+ * Copyright 1996-2017 The NASM Authors - All Rights Reserved
4
+ * See the file AUTHORS included with the NASM distribution for
5
+ * the specific copyright holders.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following
9
+ * conditions are met:
10
+ *
11
+ * * Redistributions of source code must retain the above copyright
12
+ * notice, this list of conditions and the following disclaimer.
13
+ * * Redistributions in binary form must reproduce the above
14
+ * copyright notice, this list of conditions and the following
15
+ * disclaimer in the documentation and/or other materials provided
16
+ * with the distribution.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ *
32
+ * ----------------------------------------------------------------------- */
33
+
34
+ /*
35
+ * nasm.h main header file for the Netwide Assembler: inter-module interface
36
+ */
37
+
38
+ #ifndef NASM_NASM_H
39
+ #define NASM_NASM_H
40
+
41
+ #include "compiler.h"
42
+
43
+ #include <stdio.h>
44
+ #include <time.h>
45
+
46
+ #include "nasmlib.h"
47
+ #include "strlist.h"
48
+ #include "preproc.h"
49
+ #include "insnsi.h" /* For enum opcode */
50
+ #include "directiv.h" /* For enum directive */
51
+ #include "opflags.h"
52
+ #include "regs.h"
53
+
54
+ /* Time stamp for the official start of compilation */
55
+ struct compile_time {
56
+ time_t t;
57
+ bool have_local, have_gm, have_posix;
58
+ int64_t posix;
59
+ struct tm local;
60
+ struct tm gm;
61
+ };
62
+ extern struct compile_time official_compile_time;
63
+
64
+ #define NO_SEG -1L /* null segment value */
65
+ #define SEG_ABS 0x40000000L /* mask for far-absolute segments */
66
+
67
+ #ifndef FILENAME_MAX
68
+ #define FILENAME_MAX 256
69
+ #endif
70
+
71
+ #ifndef PREFIX_MAX
72
+ #define PREFIX_MAX 10
73
+ #endif
74
+
75
+ #ifndef POSTFIX_MAX
76
+ #define POSTFIX_MAX 10
77
+ #endif
78
+
79
+ #define IDLEN_MAX 4096
80
+ #define DECOLEN_MAX 32
81
+
82
+ /*
83
+ * Name pollution problems: <time.h> on Digital UNIX pulls in some
84
+ * strange hardware header file which sees fit to define R_SP. We
85
+ * undefine it here so as not to break the enum below.
86
+ */
87
+ #ifdef R_SP
88
+ #undef R_SP
89
+ #endif
90
+
91
+ /*
92
+ * We must declare the existence of this structure type up here,
93
+ * since we have to reference it before we define it...
94
+ */
95
+ struct ofmt;
96
+
97
+ /*
98
+ * Values for the `type' parameter to an output function.
99
+ */
100
+ enum out_type {
101
+ OUT_RAWDATA, /* Plain bytes */
102
+ OUT_RESERVE, /* Reserved bytes (RESB et al) */
103
+ OUT_ADDRESS, /* An address (symbol value) */
104
+ OUT_RELADDR, /* A relative address */
105
+ OUT_SEGMENT, /* A segment number */
106
+
107
+ /*
108
+ * These values are used by the legacy backend interface only;
109
+ * see output/legacy.c for more information. These should never
110
+ * be used otherwise. Once all backends have been migrated to the
111
+ * new interface they should be removed.
112
+ */
113
+ OUT_REL1ADR,
114
+ OUT_REL2ADR,
115
+ OUT_REL4ADR,
116
+ OUT_REL8ADR
117
+ };
118
+
119
+ enum out_sign {
120
+ OUT_WRAP, /* Undefined signedness (wraps) */
121
+ OUT_SIGNED, /* Value is signed */
122
+ OUT_UNSIGNED /* Value is unsigned */
123
+ };
124
+
125
+ /*
126
+ * The data we send down to the backend.
127
+ * XXX: We still want to push down the base address symbol if
128
+ * available, and replace the segment numbers with a structure.
129
+ */
130
+ struct out_data {
131
+ int64_t offset; /* Offset within segment */
132
+ int32_t segment; /* Segment written to */
133
+ enum out_type type; /* See above */
134
+ enum out_sign sign; /* See above */
135
+ int inslen; /* Length of instruction */
136
+ int insoffs; /* Offset inside instruction */
137
+ int bits; /* Bits mode of compilation */
138
+ uint64_t size; /* Size of output */
139
+ const struct itemplate *itemp; /* Instruction template */
140
+ const void *data; /* Data for OUT_RAWDATA */
141
+ uint64_t toffset; /* Target address offset for relocation */
142
+ int32_t tsegment; /* Target segment for relocation */
143
+ int32_t twrt; /* Relocation with respect to */
144
+ int64_t relbase; /* Relative base for OUT_RELADDR */
145
+ };
146
+
147
+ /*
148
+ * A label-lookup function.
149
+ */
150
+ typedef bool (*lfunc)(char *label, int32_t *segment, int64_t *offset);
151
+
152
+ /*
153
+ * And a label-definition function. The boolean parameter
154
+ * `is_norm' states whether the label is a `normal' label (which
155
+ * should affect the local-label system), or something odder like
156
+ * an EQU or a segment-base symbol, which shouldn't.
157
+ */
158
+ typedef void (*ldfunc)(char *label, int32_t segment, int64_t offset,
159
+ char *special, bool is_norm, bool isextrn);
160
+
161
+ void define_label(char *label, int32_t segment, int64_t offset,
162
+ char *special, bool is_norm, bool isextrn);
163
+
164
+ /*
165
+ * Token types returned by the scanner, in addition to ordinary
166
+ * ASCII character values, and zero for end-of-string.
167
+ */
168
+ enum token_type { /* token types, other than chars */
169
+ TOKEN_INVALID = -1, /* a placeholder value */
170
+ TOKEN_EOS = 0, /* end of string */
171
+ TOKEN_EQ = '=',
172
+ TOKEN_GT = '>',
173
+ TOKEN_LT = '<', /* aliases */
174
+ TOKEN_ID = 256, /* identifier */
175
+ TOKEN_NUM, /* numeric constant */
176
+ TOKEN_ERRNUM, /* malformed numeric constant */
177
+ TOKEN_STR, /* string constant */
178
+ TOKEN_ERRSTR, /* unterminated string constant */
179
+ TOKEN_FLOAT, /* floating-point constant */
180
+ TOKEN_REG, /* register name */
181
+ TOKEN_INSN, /* instruction name */
182
+ TOKEN_HERE, /* $ */
183
+ TOKEN_BASE, /* $$ */
184
+ TOKEN_SPECIAL, /* BYTE, WORD, DWORD, QWORD, FAR, NEAR, etc */
185
+ TOKEN_PREFIX, /* A32, O16, LOCK, REPNZ, TIMES, etc */
186
+ TOKEN_SHL, /* << */
187
+ TOKEN_SHR, /* >> */
188
+ TOKEN_SDIV, /* // */
189
+ TOKEN_SMOD, /* %% */
190
+ TOKEN_GE, /* >= */
191
+ TOKEN_LE, /* <= */
192
+ TOKEN_NE, /* <> (!= is same as <>) */
193
+ TOKEN_DBL_AND, /* && */
194
+ TOKEN_DBL_OR, /* || */
195
+ TOKEN_DBL_XOR, /* ^^ */
196
+ TOKEN_SEG, /* SEG */
197
+ TOKEN_WRT, /* WRT */
198
+ TOKEN_FLOATIZE, /* __floatX__ */
199
+ TOKEN_STRFUNC, /* __utf16*__, __utf32*__ */
200
+ TOKEN_IFUNC, /* __ilog2*__ */
201
+ TOKEN_DECORATOR, /* decorators such as {...} */
202
+ TOKEN_OPMASK /* translated token for opmask registers */
203
+ };
204
+
205
+ enum floatize {
206
+ FLOAT_8,
207
+ FLOAT_16,
208
+ FLOAT_32,
209
+ FLOAT_64,
210
+ FLOAT_80M,
211
+ FLOAT_80E,
212
+ FLOAT_128L,
213
+ FLOAT_128H
214
+ };
215
+
216
+ /* Must match the list in string_transform(), in strfunc.c */
217
+ enum strfunc {
218
+ STRFUNC_UTF16,
219
+ STRFUNC_UTF16LE,
220
+ STRFUNC_UTF16BE,
221
+ STRFUNC_UTF32,
222
+ STRFUNC_UTF32LE,
223
+ STRFUNC_UTF32BE
224
+ };
225
+
226
+ enum ifunc {
227
+ IFUNC_ILOG2E,
228
+ IFUNC_ILOG2W,
229
+ IFUNC_ILOG2F,
230
+ IFUNC_ILOG2C
231
+ };
232
+
233
+ size_t string_transform(char *, size_t, char **, enum strfunc);
234
+
235
+ /*
236
+ * The expression evaluator must be passed a scanner function; a
237
+ * standard scanner is provided as part of nasmlib.c. The
238
+ * preprocessor will use a different one. Scanners, and the
239
+ * token-value structures they return, look like this.
240
+ *
241
+ * The return value from the scanner is always a copy of the
242
+ * `t_type' field in the structure.
243
+ */
244
+ struct tokenval {
245
+ char *t_charptr;
246
+ int64_t t_integer;
247
+ int64_t t_inttwo;
248
+ enum token_type t_type;
249
+ int8_t t_flag;
250
+ };
251
+ typedef int (*scanner)(void *private_data, struct tokenval *tv);
252
+
253
+ struct location {
254
+ int64_t offset;
255
+ int32_t segment;
256
+ int known;
257
+ };
258
+ extern struct location location;
259
+
260
+ /*
261
+ * Expression-evaluator datatype. Expressions, within the
262
+ * evaluator, are stored as an array of these beasts, terminated by
263
+ * a record with type==0. Mostly, it's a vector type: each type
264
+ * denotes some kind of a component, and the value denotes the
265
+ * multiple of that component present in the expression. The
266
+ * exception is the WRT type, whose `value' field denotes the
267
+ * segment to which the expression is relative. These segments will
268
+ * be segment-base types, i.e. either odd segment values or SEG_ABS
269
+ * types. So it is still valid to assume that anything with a
270
+ * `value' field of zero is insignificant.
271
+ */
272
+ typedef struct {
273
+ int32_t type; /* a register, or EXPR_xxx */
274
+ int64_t value; /* must be >= 32 bits */
275
+ } expr;
276
+
277
+ /*
278
+ * Library routines to manipulate expression data types.
279
+ */
280
+ bool is_reloc(const expr *vect);
281
+ bool is_simple(const expr *vect);
282
+ bool is_really_simple(const expr *vect);
283
+ bool is_unknown(const expr *vect);
284
+ bool is_just_unknown(const expr *vect);
285
+ int64_t reloc_value(const expr *vect);
286
+ int32_t reloc_seg(const expr *vect);
287
+ int32_t reloc_wrt(const expr *vect);
288
+ bool is_self_relative(const expr *vect);
289
+ void dump_expr(const expr *vect);
290
+
291
+ /*
292
+ * The evaluator can also return hints about which of two registers
293
+ * used in an expression should be the base register. See also the
294
+ * `operand' structure.
295
+ */
296
+ struct eval_hints {
297
+ int64_t base;
298
+ int type;
299
+ };
300
+
301
+ /*
302
+ * The actual expression evaluator function looks like this. When
303
+ * called, it expects the first token of its expression to already
304
+ * be in `*tv'; if it is not, set tv->t_type to TOKEN_INVALID and
305
+ * it will start by calling the scanner.
306
+ *
307
+ * If a forward reference happens during evaluation, the evaluator
308
+ * must set `*fwref' to true if `fwref' is non-NULL.
309
+ *
310
+ * `critical' is non-zero if the expression may not contain forward
311
+ * references. The evaluator will report its own error if this
312
+ * occurs; if `critical' is 1, the error will be "symbol not
313
+ * defined before use", whereas if `critical' is 2, the error will
314
+ * be "symbol undefined".
315
+ *
316
+ * If `critical' has bit 8 set (in addition to its main value: 0x101
317
+ * and 0x102 correspond to 1 and 2) then an extended expression
318
+ * syntax is recognised, in which relational operators such as =, <
319
+ * and >= are accepted, as well as low-precedence logical operators
320
+ * &&, ^^ and ||.
321
+ *
322
+ * If `hints' is non-NULL, it gets filled in with some hints as to
323
+ * the base register in complex effective addresses.
324
+ */
325
+ #define CRITICAL 0x100
326
+ typedef expr *(*evalfunc)(scanner sc, void *scprivate,
327
+ struct tokenval *tv, int *fwref, int critical,
328
+ struct eval_hints *hints);
329
+
330
+ /*
331
+ * Special values for expr->type.
332
+ * These come after EXPR_REG_END as defined in regs.h.
333
+ * Expr types : 0 ~ EXPR_REG_END, EXPR_UNKNOWN, EXPR_...., EXPR_RDSAE,
334
+ * EXPR_SEGBASE ~ EXPR_SEGBASE + SEG_ABS, ...
335
+ */
336
+ #define EXPR_UNKNOWN (EXPR_REG_END+1) /* forward references */
337
+ #define EXPR_SIMPLE (EXPR_REG_END+2)
338
+ #define EXPR_WRT (EXPR_REG_END+3)
339
+ #define EXPR_RDSAE (EXPR_REG_END+4)
340
+ #define EXPR_SEGBASE (EXPR_REG_END+5)
341
+
342
+ /*
343
+ * preprocessors ought to look like this:
344
+ */
345
+ struct preproc_ops {
346
+ /*
347
+ * Called once at the very start of assembly.
348
+ */
349
+ void (*init)(void);
350
+
351
+ /*
352
+ * Called at the start of a pass; given a file name, the number
353
+ * of the pass, an error reporting function, an evaluator
354
+ * function, and a listing generator to talk to.
355
+ */
356
+ void (*reset)(char *file, int pass, StrList **deplist);
357
+
358
+ /*
359
+ * Called to fetch a line of preprocessed source. The line
360
+ * returned has been malloc'ed, and so should be freed after
361
+ * use.
362
+ */
363
+ char *(*getline)(void);
364
+
365
+ /* Called at the end of a pass */
366
+ void (*cleanup)(int pass);
367
+
368
+ /* Additional macros specific to output format */
369
+ void (*extra_stdmac)(macros_t *macros);
370
+
371
+ /* Early definitions and undefinitions for macros */
372
+ void (*pre_define)(char *definition);
373
+ void (*pre_undefine)(char *definition);
374
+
375
+ /* Include file from command line */
376
+ void (*pre_include)(char *fname);
377
+
378
+ /* Include path from command line */
379
+ void (*include_path)(char *path);
380
+
381
+ /* Unwind the macro stack when printing an error message */
382
+ void (*error_list_macros)(int severity);
383
+ };
384
+
385
+ extern const struct preproc_ops nasmpp;
386
+ extern const struct preproc_ops preproc_nop;
387
+
388
+ /* List of dependency files */
389
+ extern StrList *depend_list;
390
+
391
+ /*
392
+ * Some lexical properties of the NASM source language, included
393
+ * here because they are shared between the parser and preprocessor.
394
+ */
395
+
396
+ /*
397
+ * isidstart matches any character that may start an identifier, and isidchar
398
+ * matches any character that may appear at places other than the start of an
399
+ * identifier. E.g. a period may only appear at the start of an identifier
400
+ * (for local labels), whereas a number may appear anywhere *but* at the
401
+ * start.
402
+ * isbrcchar matches any character that may placed inside curly braces as a
403
+ * decorator. E.g. {rn-sae}, {1to8}, {k1}{z}
404
+ */
405
+
406
+ #define isidstart(c) (nasm_isalpha(c) || \
407
+ (c) == '_' || \
408
+ (c) == '.' || \
409
+ (c) == '?' || \
410
+ (c) == '@')
411
+
412
+ #define isidchar(c) (isidstart(c) || \
413
+ nasm_isdigit(c) || \
414
+ (c) == '$' || \
415
+ (c) == '#' || \
416
+ (c) == '~')
417
+
418
+ #define isbrcchar(c) (isidchar(c) || \
419
+ (c) == '-')
420
+
421
+ /* Ditto for numeric constants. */
422
+
423
+ #define isnumstart(c) (nasm_isdigit(c) || (c) == '$')
424
+ #define isnumchar(c) (nasm_isalnum(c) || (c) == '_')
425
+
426
+ /*
427
+ * inline function to skip past an identifier; returns the first character past
428
+ * the identifier if valid, otherwise NULL.
429
+ */
430
+ static inline char *nasm_skip_identifier(const char *str)
431
+ {
432
+ const char *p = str;
433
+
434
+ if (!isidstart(*p++)) {
435
+ p = NULL;
436
+ } else {
437
+ while (isidchar(*p++))
438
+ ;
439
+ }
440
+ return (char *)p;
441
+ }
442
+
443
+ /*
444
+ * Data-type flags that get passed to listing-file routines.
445
+ */
446
+ enum {
447
+ LIST_READ,
448
+ LIST_MACRO,
449
+ LIST_MACRO_NOLIST,
450
+ LIST_INCLUDE,
451
+ LIST_INCBIN,
452
+ LIST_TIMES
453
+ };
454
+
455
+ /*
456
+ * -----------------------------------------------------------
457
+ * Format of the `insn' structure returned from `parser.c' and
458
+ * passed into `assemble.c'
459
+ * -----------------------------------------------------------
460
+ */
461
+
462
+ /* Verify value to be a valid register */
463
+ static inline bool is_register(int reg)
464
+ {
465
+ return reg >= EXPR_REG_START && reg < REG_ENUM_LIMIT;
466
+ }
467
+
468
+ enum ccode { /* condition code names */
469
+ C_A, C_AE, C_B, C_BE, C_C, C_E, C_G, C_GE, C_L, C_LE, C_NA, C_NAE,
470
+ C_NB, C_NBE, C_NC, C_NE, C_NG, C_NGE, C_NL, C_NLE, C_NO, C_NP,
471
+ C_NS, C_NZ, C_O, C_P, C_PE, C_PO, C_S, C_Z,
472
+ C_none = -1
473
+ };
474
+
475
+ /*
476
+ * token flags
477
+ */
478
+ #define TFLAG_BRC (1 << 0) /* valid only with braces. {1to8}, {rd-sae}, ...*/
479
+ #define TFLAG_BRC_OPT (1 << 1) /* may or may not have braces. opmasks {k1} */
480
+ #define TFLAG_BRC_ANY (TFLAG_BRC | TFLAG_BRC_OPT)
481
+ #define TFLAG_BRDCAST (1 << 2) /* broadcasting decorator */
482
+ #define TFLAG_WARN (1 << 3) /* warning only, treat as ID */
483
+
484
+ static inline uint8_t get_cond_opcode(enum ccode c)
485
+ {
486
+ static const uint8_t ccode_opcodes[] = {
487
+ 0x7, 0x3, 0x2, 0x6, 0x2, 0x4, 0xf, 0xd, 0xc, 0xe, 0x6, 0x2,
488
+ 0x3, 0x7, 0x3, 0x5, 0xe, 0xc, 0xd, 0xf, 0x1, 0xb, 0x9, 0x5,
489
+ 0x0, 0xa, 0xa, 0xb, 0x8, 0x4
490
+ };
491
+
492
+ return ccode_opcodes[(int)c];
493
+ }
494
+
495
+ /*
496
+ * REX flags
497
+ */
498
+ #define REX_MASK 0x4f /* Actual REX prefix bits */
499
+ #define REX_B 0x01 /* ModRM r/m extension */
500
+ #define REX_X 0x02 /* SIB index extension */
501
+ #define REX_R 0x04 /* ModRM reg extension */
502
+ #define REX_W 0x08 /* 64-bit operand size */
503
+ #define REX_L 0x20 /* Use LOCK prefix instead of REX.R */
504
+ #define REX_P 0x40 /* REX prefix present/required */
505
+ #define REX_H 0x80 /* High register present, REX forbidden */
506
+ #define REX_V 0x0100 /* Instruction uses VEX/XOP instead of REX */
507
+ #define REX_NH 0x0200 /* Instruction which doesn't use high regs */
508
+ #define REX_EV 0x0400 /* Instruction uses EVEX instead of REX */
509
+
510
+ /*
511
+ * EVEX bit field
512
+ */
513
+ #define EVEX_P0MM 0x0f /* EVEX P[3:0] : Opcode map */
514
+ #define EVEX_P0RP 0x10 /* EVEX P[4] : High-16 reg */
515
+ #define EVEX_P0X 0x40 /* EVEX P[6] : High-16 rm */
516
+ #define EVEX_P1PP 0x03 /* EVEX P[9:8] : Legacy prefix */
517
+ #define EVEX_P1VVVV 0x78 /* EVEX P[14:11] : NDS register */
518
+ #define EVEX_P1W 0x80 /* EVEX P[15] : Osize extension */
519
+ #define EVEX_P2AAA 0x07 /* EVEX P[18:16] : Embedded opmask */
520
+ #define EVEX_P2VP 0x08 /* EVEX P[19] : High-16 NDS reg */
521
+ #define EVEX_P2B 0x10 /* EVEX P[20] : Broadcast / RC / SAE */
522
+ #define EVEX_P2LL 0x60 /* EVEX P[22:21] : Vector length */
523
+ #define EVEX_P2RC EVEX_P2LL /* EVEX P[22:21] : Rounding control */
524
+ #define EVEX_P2Z 0x80 /* EVEX P[23] : Zeroing/Merging */
525
+
526
+ /*
527
+ * REX_V "classes" (prefixes which behave like VEX)
528
+ */
529
+ enum vex_class {
530
+ RV_VEX = 0, /* C4/C5 */
531
+ RV_XOP = 1, /* 8F */
532
+ RV_EVEX = 2 /* 62 */
533
+ };
534
+
535
+ /*
536
+ * Note that because segment registers may be used as instruction
537
+ * prefixes, we must ensure the enumerations for prefixes and
538
+ * register names do not overlap.
539
+ */
540
+ enum prefixes { /* instruction prefixes */
541
+ P_none = 0,
542
+ PREFIX_ENUM_START = REG_ENUM_LIMIT,
543
+ P_A16 = PREFIX_ENUM_START,
544
+ P_A32,
545
+ P_A64,
546
+ P_ASP,
547
+ P_LOCK,
548
+ P_O16,
549
+ P_O32,
550
+ P_O64,
551
+ P_OSP,
552
+ P_REP,
553
+ P_REPE,
554
+ P_REPNE,
555
+ P_REPNZ,
556
+ P_REPZ,
557
+ P_TIMES,
558
+ P_WAIT,
559
+ P_XACQUIRE,
560
+ P_XRELEASE,
561
+ P_BND,
562
+ P_NOBND,
563
+ P_EVEX,
564
+ P_VEX3,
565
+ P_VEX2,
566
+ PREFIX_ENUM_LIMIT
567
+ };
568
+
569
+ enum extop_type { /* extended operand types */
570
+ EOT_NOTHING,
571
+ EOT_DB_STRING, /* Byte string */
572
+ EOT_DB_STRING_FREE, /* Byte string which should be nasm_free'd*/
573
+ EOT_DB_NUMBER /* Integer */
574
+ };
575
+
576
+ enum ea_flags { /* special EA flags */
577
+ EAF_BYTEOFFS = 1, /* force offset part to byte size */
578
+ EAF_WORDOFFS = 2, /* force offset part to [d]word size */
579
+ EAF_TIMESTWO = 4, /* really do EAX*2 not EAX+EAX */
580
+ EAF_REL = 8, /* IP-relative addressing */
581
+ EAF_ABS = 16, /* non-IP-relative addressing */
582
+ EAF_FSGS = 32, /* fs/gs segment override present */
583
+ EAF_MIB = 64 /* mib operand */
584
+ };
585
+
586
+ enum eval_hint { /* values for `hinttype' */
587
+ EAH_NOHINT = 0, /* no hint at all - our discretion */
588
+ EAH_MAKEBASE = 1, /* try to make given reg the base */
589
+ EAH_NOTBASE = 2, /* try _not_ to make reg the base */
590
+ EAH_SUMMED = 3 /* base and index are summed into index */
591
+ };
592
+
593
+ typedef struct operand { /* operand to an instruction */
594
+ opflags_t type; /* type of operand */
595
+ int disp_size; /* 0 means default; 16; 32; 64 */
596
+ enum reg_enum basereg;
597
+ enum reg_enum indexreg; /* address registers */
598
+ int scale; /* index scale */
599
+ int hintbase;
600
+ enum eval_hint hinttype; /* hint as to real base register */
601
+ int32_t segment; /* immediate segment, if needed */
602
+ int64_t offset; /* any immediate number */
603
+ int32_t wrt; /* segment base it's relative to */
604
+ int eaflags; /* special EA flags */
605
+ int opflags; /* see OPFLAG_* defines below */
606
+ decoflags_t decoflags; /* decorator flags such as {...} */
607
+ } operand;
608
+
609
+ #define OPFLAG_FORWARD 1 /* operand is a forward reference */
610
+ #define OPFLAG_EXTERN 2 /* operand is an external reference */
611
+ #define OPFLAG_UNKNOWN 4 /* operand is an unknown reference
612
+ (always a forward reference also) */
613
+ #define OPFLAG_RELATIVE 8 /* operand is self-relative, e.g. [foo - $]
614
+ where foo is not in the current segment */
615
+
616
+ typedef struct extop { /* extended operand */
617
+ struct extop *next; /* linked list */
618
+ char *stringval; /* if it's a string, then here it is */
619
+ size_t stringlen; /* ... and here's how long it is */
620
+ int64_t offset; /* ... it's given here ... */
621
+ int32_t segment; /* if it's a number/address, then... */
622
+ int32_t wrt; /* ... and here */
623
+ bool relative; /* self-relative expression */
624
+ enum extop_type type; /* defined above */
625
+ } extop;
626
+
627
+ enum ea_type {
628
+ EA_INVALID, /* Not a valid EA at all */
629
+ EA_SCALAR, /* Scalar EA */
630
+ EA_XMMVSIB, /* XMM vector EA */
631
+ EA_YMMVSIB, /* YMM vector EA */
632
+ EA_ZMMVSIB /* ZMM vector EA */
633
+ };
634
+
635
+ /*
636
+ * Prefix positions: each type of prefix goes in a specific slot.
637
+ * This affects the final ordering of the assembled output, which
638
+ * shouldn't matter to the processor, but if you have stylistic
639
+ * preferences, you can change this. REX prefixes are handled
640
+ * differently for the time being.
641
+ *
642
+ * LOCK and REP used to be one slot; this is no longer the case since
643
+ * the introduction of HLE.
644
+ */
645
+ enum prefix_pos {
646
+ PPS_WAIT, /* WAIT (technically not a prefix!) */
647
+ PPS_REP, /* REP/HLE prefix */
648
+ PPS_LOCK, /* LOCK prefix */
649
+ PPS_SEG, /* Segment override prefix */
650
+ PPS_OSIZE, /* Operand size prefix */
651
+ PPS_ASIZE, /* Address size prefix */
652
+ PPS_VEX, /* VEX type */
653
+ MAXPREFIX /* Total number of prefix slots */
654
+ };
655
+
656
+ /*
657
+ * Tuple types that are used when determining Disp8*N eligibility
658
+ * The order must match with a hash %tuple_codes in insns.pl
659
+ */
660
+ enum ttypes {
661
+ FV = 001,
662
+ HV = 002,
663
+ FVM = 003,
664
+ T1S8 = 004,
665
+ T1S16 = 005,
666
+ T1S = 006,
667
+ T1F32 = 007,
668
+ T1F64 = 010,
669
+ T2 = 011,
670
+ T4 = 012,
671
+ T8 = 013,
672
+ HVM = 014,
673
+ QVM = 015,
674
+ OVM = 016,
675
+ M128 = 017,
676
+ DUP = 020
677
+ };
678
+
679
+ /* EVEX.L'L : Vector length on vector insns */
680
+ enum vectlens {
681
+ VL128 = 0,
682
+ VL256 = 1,
683
+ VL512 = 2,
684
+ VLMAX = 3
685
+ };
686
+
687
+ /* If you need to change this, also change it in insns.pl */
688
+ #define MAX_OPERANDS 5
689
+
690
+ typedef struct insn { /* an instruction itself */
691
+ char *label; /* the label defined, or NULL */
692
+ int prefixes[MAXPREFIX]; /* instruction prefixes, if any */
693
+ enum opcode opcode; /* the opcode - not just the string */
694
+ enum ccode condition; /* the condition code, if Jcc/SETcc */
695
+ int operands; /* how many operands? 0-3 (more if db et al) */
696
+ int addr_size; /* address size */
697
+ operand oprs[MAX_OPERANDS]; /* the operands, defined as above */
698
+ extop *eops; /* extended operands */
699
+ int eops_float; /* true if DD and floating */
700
+ int32_t times; /* repeat count (TIMES prefix) */
701
+ bool forw_ref; /* is there a forward reference? */
702
+ bool rex_done; /* REX prefix emitted? */
703
+ int rex; /* Special REX Prefix */
704
+ int vexreg; /* Register encoded in VEX prefix */
705
+ int vex_cm; /* Class and M field for VEX prefix */
706
+ int vex_wlp; /* W, P and L information for VEX prefix */
707
+ uint8_t evex_p[3]; /* EVEX.P0: [RXB,R',00,mm], P1: [W,vvvv,1,pp] */
708
+ /* EVEX.P2: [z,L'L,b,V',aaa] */
709
+ enum ttypes evex_tuple; /* Tuple type for compressed Disp8*N */
710
+ int evex_rm; /* static rounding mode for AVX512 (EVEX) */
711
+ int8_t evex_brerop; /* BR/ER/SAE operand position */
712
+ } insn;
713
+
714
+ /* Instruction flags type: IF_* flags are defined in insns.h */
715
+ typedef uint64_t iflags_t;
716
+
717
+ /*
718
+ * What to return from a directive- or pragma-handling function.
719
+ * Currently DIRR_OK and DIRR_ERROR are treated the same way;
720
+ * in both cases the backend is expected to produce the appropriate
721
+ * error message on its own.
722
+ *
723
+ * DIRR_BADPARAM causes a generic error message to be printed. Note
724
+ * that it is an error, not a warning, even in the case of pragmas;
725
+ * don't use it where forward compatiblity would be compromised
726
+ * (instead consider adding a DIRR_WARNPARAM.)
727
+ */
728
+ enum directive_result {
729
+ DIRR_UNKNOWN, /* Directive not handled by backend */
730
+ DIRR_OK, /* Directive processed */
731
+ DIRR_ERROR, /* Directive processed unsuccessfully */
732
+ DIRR_BADPARAM /* Print bad argument error message */
733
+ };
734
+
735
+ /*
736
+ * A pragma facility: this structure is used to request passing a
737
+ * parsed pragma directive for a specific facility. If the handler is
738
+ * NULL then this pragma facility is recognized but ignored; pragma
739
+ * processing stops at that point.
740
+ *
741
+ * Note that the handler is passed a pointer to the facility structure
742
+ * as part of the struct pragma.
743
+ */
744
+ struct pragma;
745
+
746
+ struct pragma_facility {
747
+ const char *name;
748
+ enum directive_result (*handler)(const struct pragma *);
749
+ };
750
+
751
+ /*
752
+ * This structure defines how a pragma directive is passed to a
753
+ * facility. This structure may be augmented in the future.
754
+ *
755
+ * Any facility MAY, but is not required to, add its operations
756
+ * keywords or a subset thereof into asm/directiv.dat, in which case
757
+ * the "opcode" field will be set to the corresponding D_ constant
758
+ * from directiv.h; otherwise it will be D_unknown.
759
+ */
760
+ struct pragma {
761
+ const struct pragma_facility *facility;
762
+ const char *facility_name; /* Facility name exactly as entered by user */
763
+ const char *opname; /* First word after the facility name */
764
+ const char *tail; /* Anything after the operation */
765
+ enum directive opcode; /* Operation as a D_ directives constant */
766
+ };
767
+
768
+ /*
769
+ * The data structure defining an output format driver, and the
770
+ * interfaces to the functions therein.
771
+ */
772
+ struct ofmt {
773
+ /*
774
+ * This is a short (one-liner) description of the type of
775
+ * output generated by the driver.
776
+ */
777
+ const char *fullname;
778
+
779
+ /*
780
+ * This is a single keyword used to select the driver.
781
+ */
782
+ const char *shortname;
783
+
784
+ /*
785
+ * Output format flags.
786
+ */
787
+ #define OFMT_TEXT 1 /* Text file format */
788
+ unsigned int flags;
789
+
790
+ int maxbits; /* Maximum segment bits supported */
791
+
792
+ /*
793
+ * this is a pointer to the first element of the debug information
794
+ */
795
+ const struct dfmt * const *debug_formats;
796
+
797
+ /*
798
+ * the default debugging format if -F is not specified
799
+ */
800
+ const struct dfmt *default_dfmt;
801
+
802
+ /*
803
+ * This, if non-NULL, is a NULL-terminated list of `char *'s
804
+ * pointing to extra standard macros supplied by the object
805
+ * format (e.g. a sensible initial default value of __SECT__,
806
+ * and user-level equivalents for any format-specific
807
+ * directives).
808
+ */
809
+ macros_t *stdmac;
810
+
811
+ /*
812
+ * This procedure is called at the start of an output session to set
813
+ * up internal parameters.
814
+ */
815
+ void (*init)(void);
816
+
817
+ /*
818
+ * This is the modern output function, which gets passed
819
+ * a struct out_data with much more information. See the
820
+ * definition of struct out_data.
821
+ */
822
+ void (*output)(const struct out_data *data);
823
+
824
+ /*
825
+ * This procedure is called by assemble() to write actual
826
+ * generated code or data to the object file. Typically it
827
+ * doesn't have to actually _write_ it, just store it for
828
+ * later.
829
+ *
830
+ * The `type' argument specifies the type of output data, and
831
+ * usually the size as well: its contents are described below.
832
+ *
833
+ * This is used for backends which have not yet been ported to
834
+ * the new interface, and should be NULL on ported backends.
835
+ * To use this entry point, set the output pointer to
836
+ * nasm_do_legacy_output.
837
+ */
838
+ void (*legacy_output)(int32_t segto, const void *data,
839
+ enum out_type type, uint64_t size,
840
+ int32_t segment, int32_t wrt);
841
+
842
+ /*
843
+ * This procedure is called once for every symbol defined in
844
+ * the module being assembled. It gives the name and value of
845
+ * the symbol, in NASM's terms, and indicates whether it has
846
+ * been declared to be global. Note that the parameter "name",
847
+ * when passed, will point to a piece of static storage
848
+ * allocated inside the label manager - it's safe to keep using
849
+ * that pointer, because the label manager doesn't clean up
850
+ * until after the output driver has.
851
+ *
852
+ * Values of `is_global' are: 0 means the symbol is local; 1
853
+ * means the symbol is global; 2 means the symbol is common (in
854
+ * which case `offset' holds the _size_ of the variable).
855
+ * Anything else is available for the output driver to use
856
+ * internally.
857
+ *
858
+ * This routine explicitly _is_ allowed to call the label
859
+ * manager to define further symbols, if it wants to, even
860
+ * though it's been called _from_ the label manager. That much
861
+ * re-entrancy is guaranteed in the label manager. However, the
862
+ * label manager will in turn call this routine, so it should
863
+ * be prepared to be re-entrant itself.
864
+ *
865
+ * The `special' parameter contains special information passed
866
+ * through from the command that defined the label: it may have
867
+ * been an EXTERN, a COMMON or a GLOBAL. The distinction should
868
+ * be obvious to the output format from the other parameters.
869
+ */
870
+ void (*symdef)(char *name, int32_t segment, int64_t offset,
871
+ int is_global, char *special);
872
+
873
+ /*
874
+ * This procedure is called when the source code requests a
875
+ * segment change. It should return the corresponding segment
876
+ * _number_ for the name, or NO_SEG if the name is not a valid
877
+ * segment name.
878
+ *
879
+ * It may also be called with NULL, in which case it is to
880
+ * return the _default_ section number for starting assembly in.
881
+ *
882
+ * It is allowed to modify the string it is given a pointer to.
883
+ *
884
+ * It is also allowed to specify a default instruction size for
885
+ * the segment, by setting `*bits' to 16 or 32. Or, if it
886
+ * doesn't wish to define a default, it can leave `bits' alone.
887
+ */
888
+ int32_t (*section)(char *name, int pass, int *bits);
889
+
890
+ /*
891
+ * This procedure is called to modify section alignment,
892
+ * note there is a trick, the alignment can only increase
893
+ */
894
+ void (*sectalign)(int32_t seg, unsigned int value);
895
+
896
+ /*
897
+ * This procedure is called to modify the segment base values
898
+ * returned from the SEG operator. It is given a segment base
899
+ * value (i.e. a segment value with the low bit set), and is
900
+ * required to produce in return a segment value which may be
901
+ * different. It can map segment bases to absolute numbers by
902
+ * means of returning SEG_ABS types.
903
+ *
904
+ * It should return NO_SEG if the segment base cannot be
905
+ * determined; the evaluator (which calls this routine) is
906
+ * responsible for throwing an error condition if that occurs
907
+ * in pass two or in a critical expression.
908
+ */
909
+ int32_t (*segbase)(int32_t segment);
910
+
911
+ /*
912
+ * This procedure is called to allow the output driver to
913
+ * process its own specific directives. When called, it has the
914
+ * directive word in `directive' and the parameter string in
915
+ * `value'. It is called in both assembly passes, and `pass'
916
+ * will be either 1 or 2.
917
+ *
918
+ * The following values are (currently) possible for
919
+ * directive_result:
920
+ *
921
+ * 0 - DIRR_UNKNOWN - directive not recognized by backend
922
+ * 1 - DIRR_OK - directive processed ok
923
+ * 2 - DIRR_ERROR - backend printed its own error message
924
+ * 3 - DIRR_BADPARAM - print the generic message
925
+ * "invalid parameter to [*] directive"
926
+ */
927
+ enum directive_result
928
+ (*directive)(enum directive directive, char *value, int pass);
929
+
930
+ /*
931
+ * This procedure is called before anything else - even before
932
+ * the "init" routine - and is passed the name of the input
933
+ * file from which this output file is being generated. It
934
+ * should return its preferred name for the output file in
935
+ * `outname', if outname[0] is not '\0', and do nothing to
936
+ * `outname' otherwise. Since it is called before the driver is
937
+ * properly initialized, it has to be passed its error handler
938
+ * separately.
939
+ *
940
+ * This procedure may also take its own copy of the input file
941
+ * name for use in writing the output file: it is _guaranteed_
942
+ * that it will be called before the "init" routine.
943
+ *
944
+ * The parameter `outname' points to an area of storage
945
+ * guaranteed to be at least FILENAME_MAX in size.
946
+ */
947
+ void (*filename)(char *inname, char *outname);
948
+
949
+ /*
950
+ * This procedure is called after assembly finishes, to allow
951
+ * the output driver to clean itself up and free its memory.
952
+ * Typically, it will also be the point at which the object
953
+ * file actually gets _written_.
954
+ *
955
+ * One thing the cleanup routine should always do is to close
956
+ * the output file pointer.
957
+ */
958
+ void (*cleanup)(void);
959
+
960
+ /*
961
+ * List of pragma facility names that apply to this backend.
962
+ */
963
+ const struct pragma_facility *pragmas;
964
+ };
965
+
966
+ /*
967
+ * Output format driver alias
968
+ */
969
+ struct ofmt_alias {
970
+ const char *shortname;
971
+ const char *fullname;
972
+ const struct ofmt *ofmt;
973
+ };
974
+
975
+ extern const struct ofmt *ofmt;
976
+ extern FILE *ofile;
977
+
978
+ /*
979
+ * ------------------------------------------------------------
980
+ * The data structure defining a debug format driver, and the
981
+ * interfaces to the functions therein.
982
+ * ------------------------------------------------------------
983
+ */
984
+
985
+ struct dfmt {
986
+ /*
987
+ * This is a short (one-liner) description of the type of
988
+ * output generated by the driver.
989
+ */
990
+ const char *fullname;
991
+
992
+ /*
993
+ * This is a single keyword used to select the driver.
994
+ */
995
+ const char *shortname;
996
+
997
+ /*
998
+ * init - called initially to set up local pointer to object format.
999
+ */
1000
+ void (*init)(void);
1001
+
1002
+ /*
1003
+ * linenum - called any time there is output with a change of
1004
+ * line number or file.
1005
+ */
1006
+ void (*linenum)(const char *filename, int32_t linenumber, int32_t segto);
1007
+
1008
+ /*
1009
+ * debug_deflabel - called whenever a label is defined. Parameters
1010
+ * are the same as to 'symdef()' in the output format. This function
1011
+ * is called after the output format version.
1012
+ */
1013
+
1014
+ void (*debug_deflabel)(char *name, int32_t segment, int64_t offset,
1015
+ int is_global, char *special);
1016
+ /*
1017
+ * debug_directive - called whenever a DEBUG directive other than 'LINE'
1018
+ * is encountered. 'directive' contains the first parameter to the
1019
+ * DEBUG directive, and params contains the rest. For example,
1020
+ * 'DEBUG VAR _somevar:int' would translate to a call to this
1021
+ * function with 'directive' equal to "VAR" and 'params' equal to
1022
+ * "_somevar:int".
1023
+ */
1024
+ void (*debug_directive)(const char *directive, const char *params);
1025
+
1026
+ /*
1027
+ * typevalue - called whenever the assembler wishes to register a type
1028
+ * for the last defined label. This routine MUST detect if a type was
1029
+ * already registered and not re-register it.
1030
+ */
1031
+ void (*debug_typevalue)(int32_t type);
1032
+
1033
+ /*
1034
+ * debug_output - called whenever output is required
1035
+ * 'type' is the type of info required, and this is format-specific
1036
+ */
1037
+ void (*debug_output)(int type, void *param);
1038
+
1039
+ /*
1040
+ * cleanup - called after processing of file is complete
1041
+ */
1042
+ void (*cleanup)(void);
1043
+
1044
+ /*
1045
+ * List of pragma facility names that apply to this backend.
1046
+ */
1047
+ const struct pragma_facility *pragmas;
1048
+ };
1049
+
1050
+ extern const struct dfmt *dfmt;
1051
+
1052
+ /*
1053
+ * The type definition macros
1054
+ * for debugging
1055
+ *
1056
+ * low 3 bits: reserved
1057
+ * next 5 bits: type
1058
+ * next 24 bits: number of elements for arrays (0 for labels)
1059
+ */
1060
+
1061
+ #define TY_UNKNOWN 0x00
1062
+ #define TY_LABEL 0x08
1063
+ #define TY_BYTE 0x10
1064
+ #define TY_WORD 0x18
1065
+ #define TY_DWORD 0x20
1066
+ #define TY_FLOAT 0x28
1067
+ #define TY_QWORD 0x30
1068
+ #define TY_TBYTE 0x38
1069
+ #define TY_OWORD 0x40
1070
+ #define TY_YWORD 0x48
1071
+ #define TY_ZWORD 0x50
1072
+ #define TY_COMMON 0xE0
1073
+ #define TY_SEG 0xE8
1074
+ #define TY_EXTERN 0xF0
1075
+ #define TY_EQU 0xF8
1076
+
1077
+ #define TYM_TYPE(x) ((x) & 0xF8)
1078
+ #define TYM_ELEMENTS(x) (((x) & 0xFFFFFF00) >> 8)
1079
+
1080
+ #define TYS_ELEMENTS(x) ((x) << 8)
1081
+
1082
+ enum special_tokens {
1083
+ SPECIAL_ENUM_START = PREFIX_ENUM_LIMIT,
1084
+ S_ABS = SPECIAL_ENUM_START,
1085
+ S_BYTE,
1086
+ S_DWORD,
1087
+ S_FAR,
1088
+ S_LONG,
1089
+ S_NEAR,
1090
+ S_NOSPLIT,
1091
+ S_OWORD,
1092
+ S_QWORD,
1093
+ S_REL,
1094
+ S_SHORT,
1095
+ S_STRICT,
1096
+ S_TO,
1097
+ S_TWORD,
1098
+ S_WORD,
1099
+ S_YWORD,
1100
+ S_ZWORD,
1101
+ SPECIAL_ENUM_LIMIT
1102
+ };
1103
+
1104
+ enum decorator_tokens {
1105
+ DECORATOR_ENUM_START = SPECIAL_ENUM_LIMIT,
1106
+ BRC_1TO2 = DECORATOR_ENUM_START,
1107
+ BRC_1TO4,
1108
+ BRC_1TO8,
1109
+ BRC_1TO16,
1110
+ BRC_RN,
1111
+ BRC_RD,
1112
+ BRC_RU,
1113
+ BRC_RZ,
1114
+ BRC_SAE,
1115
+ BRC_Z,
1116
+ DECORATOR_ENUM_LIMIT
1117
+ };
1118
+
1119
+ /*
1120
+ * AVX512 Decorator (decoflags_t) bits distribution (counted from 0)
1121
+ * 3 2 1
1122
+ * 10987654321098765432109876543210
1123
+ * |
1124
+ * | word boundary
1125
+ * ............................1111 opmask
1126
+ * ...........................1.... zeroing / merging
1127
+ * ..........................1..... broadcast
1128
+ * .........................1...... static rounding
1129
+ * ........................1....... SAE
1130
+ * ......................11........ broadcast element size
1131
+ * ....................11.......... number of broadcast elements
1132
+ */
1133
+ #define OP_GENVAL(val, bits, shift) (((val) & ((UINT64_C(1) << (bits)) - 1)) << (shift))
1134
+
1135
+ /*
1136
+ * Opmask register number
1137
+ * identical to EVEX.aaa
1138
+ *
1139
+ * Bits: 0 - 3
1140
+ */
1141
+ #define OPMASK_SHIFT (0)
1142
+ #define OPMASK_BITS (4)
1143
+ #define OPMASK_MASK OP_GENMASK(OPMASK_BITS, OPMASK_SHIFT)
1144
+ #define GEN_OPMASK(bit) OP_GENBIT(bit, OPMASK_SHIFT)
1145
+ #define VAL_OPMASK(val) OP_GENVAL(val, OPMASK_BITS, OPMASK_SHIFT)
1146
+
1147
+ /*
1148
+ * zeroing / merging control available
1149
+ * matching to EVEX.z
1150
+ *
1151
+ * Bits: 4
1152
+ */
1153
+ #define Z_SHIFT (4)
1154
+ #define Z_BITS (1)
1155
+ #define Z_MASK OP_GENMASK(Z_BITS, Z_SHIFT)
1156
+ #define GEN_Z(bit) OP_GENBIT(bit, Z_SHIFT)
1157
+
1158
+ /*
1159
+ * broadcast - Whether this operand can be broadcasted
1160
+ *
1161
+ * Bits: 5
1162
+ */
1163
+ #define BRDCAST_SHIFT (5)
1164
+ #define BRDCAST_BITS (1)
1165
+ #define BRDCAST_MASK OP_GENMASK(BRDCAST_BITS, BRDCAST_SHIFT)
1166
+ #define GEN_BRDCAST(bit) OP_GENBIT(bit, BRDCAST_SHIFT)
1167
+
1168
+ /*
1169
+ * Whether this instruction can have a static rounding mode.
1170
+ * It goes with the last simd operand because the static rounding mode
1171
+ * decorator is located between the last simd operand and imm8 (if any).
1172
+ *
1173
+ * Bits: 6
1174
+ */
1175
+ #define STATICRND_SHIFT (6)
1176
+ #define STATICRND_BITS (1)
1177
+ #define STATICRND_MASK OP_GENMASK(STATICRND_BITS, STATICRND_SHIFT)
1178
+ #define GEN_STATICRND(bit) OP_GENBIT(bit, STATICRND_SHIFT)
1179
+
1180
+ /*
1181
+ * SAE(Suppress all exception) available
1182
+ *
1183
+ * Bits: 7
1184
+ */
1185
+ #define SAE_SHIFT (7)
1186
+ #define SAE_BITS (1)
1187
+ #define SAE_MASK OP_GENMASK(SAE_BITS, SAE_SHIFT)
1188
+ #define GEN_SAE(bit) OP_GENBIT(bit, SAE_SHIFT)
1189
+
1190
+ /*
1191
+ * Broadcasting element size.
1192
+ *
1193
+ * Bits: 8 - 9
1194
+ */
1195
+ #define BRSIZE_SHIFT (8)
1196
+ #define BRSIZE_BITS (2)
1197
+ #define BRSIZE_MASK OP_GENMASK(BRSIZE_BITS, BRSIZE_SHIFT)
1198
+ #define GEN_BRSIZE(bit) OP_GENBIT(bit, BRSIZE_SHIFT)
1199
+
1200
+ #define BR_BITS32 GEN_BRSIZE(0)
1201
+ #define BR_BITS64 GEN_BRSIZE(1)
1202
+
1203
+ /*
1204
+ * Number of broadcasting elements
1205
+ *
1206
+ * Bits: 10 - 11
1207
+ */
1208
+ #define BRNUM_SHIFT (10)
1209
+ #define BRNUM_BITS (2)
1210
+ #define BRNUM_MASK OP_GENMASK(BRNUM_BITS, BRNUM_SHIFT)
1211
+ #define VAL_BRNUM(val) OP_GENVAL(val, BRNUM_BITS, BRNUM_SHIFT)
1212
+
1213
+ #define BR_1TO2 VAL_BRNUM(0)
1214
+ #define BR_1TO4 VAL_BRNUM(1)
1215
+ #define BR_1TO8 VAL_BRNUM(2)
1216
+ #define BR_1TO16 VAL_BRNUM(3)
1217
+
1218
+ #define MASK OPMASK_MASK /* Opmask (k1 ~ 7) can be used */
1219
+ #define Z Z_MASK
1220
+ #define B32 (BRDCAST_MASK|BR_BITS32) /* {1to16} : broadcast 32b * 16 to zmm(512b) */
1221
+ #define B64 (BRDCAST_MASK|BR_BITS64) /* {1to8} : broadcast 64b * 8 to zmm(512b) */
1222
+ #define ER STATICRND_MASK /* ER(Embedded Rounding) == Static rounding mode */
1223
+ #define SAE SAE_MASK /* SAE(Suppress All Exception) */
1224
+
1225
+ /*
1226
+ * Global modes
1227
+ */
1228
+
1229
+ /*
1230
+ * This declaration passes the "pass" number to all other modules
1231
+ * "pass0" assumes the values: 0, 0, ..., 0, 1, 2
1232
+ * where 0 = optimizing pass
1233
+ * 1 = pass 1
1234
+ * 2 = pass 2
1235
+ */
1236
+
1237
+ extern int pass0;
1238
+ extern int passn; /* Actual pass number */
1239
+
1240
+ extern bool tasm_compatible_mode;
1241
+ extern int optimizing;
1242
+ extern int globalbits; /* 16, 32 or 64-bit mode */
1243
+ extern int globalrel; /* default to relative addressing? */
1244
+ extern int globalbnd; /* default to using bnd prefix? */
1245
+
1246
+ #endif